Hi,
i was looking for some way to be able to interact with a NPC with mobile input. How can i set the start a conversation by tapping the screen?
thanks
Start Conversation on Mobile
Re: Start Conversation on Mobile
Hi,
It depends on how your game is designed.
If your game has a player character (PC), you can add a Proximity Selector to it. Then add a trigger collider, Usable component, and Conversation Trigger to the NPC. (This page has a screenshot that shows how Proximity Selectors work.) Set the Proximity Selector's Use Button to "Fire1" to respond to taps. In this setup, the player must walk into the NPC's trigger collider. This will show a "use message". When the player taps on the screen, it will start the conversation.
If you want the PC to walk up to the NPC when the player taps on the NPC, you'll have to do this outside of the Dialogue System. When the PC is in position, invoke the Conversation Trigger's OnUse method.
If your game doesn't have a PC, you can set up a UI button (even an invisible one if you prefer) over each NPC. Configure this button to invoke the Conversation Trigger's OnUse method.
Or you can write a script that has an OnMouseUp() method that invokes the NPC's ConversationTrigger's OnUse method.
It depends on how your game is designed.
If your game has a player character (PC), you can add a Proximity Selector to it. Then add a trigger collider, Usable component, and Conversation Trigger to the NPC. (This page has a screenshot that shows how Proximity Selectors work.) Set the Proximity Selector's Use Button to "Fire1" to respond to taps. In this setup, the player must walk into the NPC's trigger collider. This will show a "use message". When the player taps on the screen, it will start the conversation.
If you want the PC to walk up to the NPC when the player taps on the NPC, you'll have to do this outside of the Dialogue System. When the PC is in position, invoke the Conversation Trigger's OnUse method.
If your game doesn't have a PC, you can set up a UI button (even an invisible one if you prefer) over each NPC. Configure this button to invoke the Conversation Trigger's OnUse method.
Or you can write a script that has an OnMouseUp() method that invokes the NPC's ConversationTrigger's OnUse method.