Global Variable GameObject Path

TrumTrum 8 months ago in Game Creator updated by Marti (Lead Developer) 8 months ago 3

I found the need to access a Global Variable's GameObject Path a few times and was wondering why it isn't an option. Maybe I am using variables incorrectly.

Unity version:
2018.4.15f1 (LTS)
Game Creator version:
Under review

Hi Trum Trum;

By game object path you mean the hierarchy path? For example, if the Player is under a "Floor" object, the path would return "Floor/Player".

Is that what you mean?

Actually, It's Unity and its prefabs is why I thought I needed this. I just didn't understand Unity (nor Game Creator for that matter). I don't think what I am asking for is necessary anymore but this is what I meant:

When using the action Variable Gameobject, Global Variable doesn't have the option to reference its Gameobject path.

I wanted to get a Local Variable (or any of its child objects) of a Global Variable Gameobject's path.


Hi Trum Trum.

Understood. Sorry if that's not clear enough. The Game Object Path is the same as the Game Object option. The difference is that the later one allows to show a drop-down of options, while the "Game Object Path" lets you directly write down the Local Variable name.

The only benefit from using the "Game Object Path" option is when you want to use the "/" shortcut. This is useful when you want to access the local variable referenced by another local variable's game object.

For example, you can use "myLocalVariableA/myLocalVariableB" path to access the game object in "myLocalVariableA", which points to an object that has a local variable called "myLocalVariableB".

Hope this makes sense. Cheers!