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)
Get GameObject when used
Get GameObject when used
Videogame desinger
KOE
KOE
Re: Get GameObject when used
Hi,
Here are a few options:
1. This option assumes you're playing a conversation and your interactable GameObject is used as the conversation's conversant. (See Character GameObject Assignments.) In your C# method, use the property DialogueManager.currentConversant. This is the transform of the conversant.
2. If you want to continue passing GameObject names and you're playing a conversation, you can use Variable["Conversant"] in your Lua function: ModifyGameObject(Variable["Conversant"]). The Dialogue System sets this variable when a conversation starts. More info.
3. If you're not playing a conversation, I recommend using a custom sequencer command instead of a Lua function. Sequencer commands are just as easy to write as Lua functions. Your sequencer command will have access to the properties speaker and listener, which are the transforms of the speaker and listener involved in the sequence.
Here are a few options:
1. This option assumes you're playing a conversation and your interactable GameObject is used as the conversation's conversant. (See Character GameObject Assignments.) In your C# method, use the property DialogueManager.currentConversant. This is the transform of the conversant.
2. If you want to continue passing GameObject names and you're playing a conversation, you can use Variable["Conversant"] in your Lua function: ModifyGameObject(Variable["Conversant"]). The Dialogue System sets this variable when a conversation starts. More info.
3. If you're not playing a conversation, I recommend using a custom sequencer command instead of a Lua function. Sequencer commands are just as easy to write as Lua functions. Your sequencer command will have access to the properties speaker and listener, which are the transforms of the speaker and listener involved in the sequence.