Hello,
I’m executing a script on a game object and I’m trying to find a way of getting the object variables object ID via the script, so I can can access the object variables. I’m know how to access the variables by using an Object ID, but I don’t know how to get that id from the object by code.
My coding skills are at a beginner level so a detailed explanation would be great if anyone can help?
Thanks
Here's an example on how to get it from a game object (with complete namespace for the component):
string objectID = gameObject.GetComponent<GamingIsLove.Makinom.Components.ObjectVariablesComponent>().settings.objectID;
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
This works great. How do i get/reference object variables from the game object the script is attached to it the variables are local and not set to an object ID?
For example, I have a game object with an object variables component attached to it, the variables are set to local, and I want to access a string called ‘test’ ?
Thanks
VariableHandler handler = ComponentHelper.ToVariableHandler(yourThing);
The handler gives you access to the variables.
This also works for anything else with variables, e.g. a combatant, an ability, etc.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!