Forum rules - please read before posting.

Get variable by name

Is there any easy way to get a variable by name? Thanks.

Comments

  • There's no provided function, since multiple variables can share the same name.

    You can iterate through the list, however:

    foreach (GVar variable in GlobalVariables.GetAllVars ())
    {
        if (variable.label == "MyVariable")
        {
            // Found it
        }
    }
    
  • I was afraid of that. Thank you :)

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.