Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

How to set some global values depending on IOS Device?

Hello all,

I am working on a game for iOS and tvOS and am looking for a way to set some global AC variables depending on the iOS device the player is using. I guess the right way to go would be to use …

https://docs.unity3d.com/ScriptReference/iOS.Device-generation.html

…, but as I am no programmer, I hope to find a clue here how to let AC access this value (maybe even a script example or a link to it).

Thank you so much,

Jensen

Comments

  • AC global variables can be manipulated through script - see the Manual's "Variable scripting" chapter, as well as the front page of the scripting guide.

    Setting variable values by iOS device, then, is a case of e.g.:

    public void SetVariables ()
    {
        if (iOS.Device.generation == iOS.DeviceGeneration.Iphone6)
        {
            AC.GlobalVariables.SetIntegerValue (3, true);
        }
    }
    

    (Where "3" is the ID number of a global Boolean variable)

    If you place such code in a new MonoBehaviour script, and place it in your scene, you can then use AC's Object: Call event or Object: Send message Actions to run this "SetVariables" method from an ActionList - if that's necessary.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.