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
  • Object variables are bound to an object via the ObjectVariablesComponent, which has the object ID stored in it's settings.

    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;
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks Gil, that’s perfect
Sign In or Register to comment.