So need to read some variables that are in a static class.
The variables are just strings named Lock1 through Lock4.
Their values are either locked or unlocked.
I’ve been trying to do this without a bunch of if else statements in case more locks need to be added to the game. So what I want to do is to ask the global script for a variable with something like:
function GetLock(lockNum : int) : String
{
//return value of "Lock" + lockNum
}
I’ve tried a few keyworks like pathTo and nothing has worked so far.
You can’t do these typical javascript tricks in Unityscript - variable names cannot be dynamically created or modified. You must use an array if you want to access the variables by index.