Get GameObject when used
Posted: Thu Mar 07, 2024 5:32 am
Hi! In my game, I want the player to interactuate with a GameObject and then apply some modifications to that GameObject. Now I'm registering the C# method that makes the modifications to LUA and calling it by the Dialogue System Trigger.
My problem is that I'm passing the name of that GameObject in the LUA call to find it and modify it, and in the future I'm going to have tons of interactuable GameObjects. I will have to change the call of the function for each new GameObject.
Is there a way to pass the name of the GameObject to the method without typing it?
My current calls in LUA: ModifyGameObject("TestingGO"); ModifyGameObject("TestingGO2"); ModifyGameObject("TestingGO3")...
What I want: ModifyGameObject(ThisGOName)
My problem is that I'm passing the name of that GameObject in the LUA call to find it and modify it, and in the future I'm going to have tons of interactuable GameObjects. I will have to change the call of the function for each new GameObject.
Is there a way to pass the name of the GameObject to the method without typing it?
My current calls in LUA: ModifyGameObject("TestingGO"); ModifyGameObject("TestingGO2"); ModifyGameObject("TestingGO3")...
What I want: ModifyGameObject(ThisGOName)