Forum rules - please read before posting.

How to access Unity Object from Global Variable via Script

I have an actionlist which saves an audioclip as a global variable (unity object). But how do I get the audio clip in my script?

Comments

  • You first get a reference to the variable's GVar class using GetVariable, and then cast its UnityObjectValue to an AudioClip:

    AC.GVar myVariable = AC.GlobalVariables.GetVariable ("MyVariableName");
    AudioClip audioClip = (AudioClip) myVariable.UnityObjectValue;
    
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.