Hiya, just bought the asset, this is my first post here. Really amazing!
I know there was a post about this but I got lost trying to understand it. What I want to do is simple: trigger a conversation with an NPC when the player enters the NPC's sphere collider. What I have done so far:
- make sure that the npc's Sphere Collider on the NPC has the IsTrigger property set to true;
- add the Converstation Trigger component to the NPC with the trigger property set to OnTriggerEnter.
- The dialogue Manager is in the scene with an initial database assigned.
Now, what happens is that when I start the scene, the dialog is displayed right away, as if the OnTrigger condition was met. However the player is far from the NPC and I know the Sphere Collider works (as I am using it for other OnTriggerEnter events on other components).
Anything I am missing here? Or do you have a best guess that would point me in the right direction?
Many thanks,
- Jeff
Using OnTriggerEnter properly to trigger a conversation
Re: Using OnTriggerEnter properly to trigger a conversation
Hi Jeff,
Some other object is probably starting inside the NPC's sphere collider, causing it to detect OnTriggerEnter.
To fix this, inspect the Conversation Trigger. Expand Condition > Accepted Tags. Set the Size to 1, and set Element 0 to "Player" (without quotes). Then make sure your player GameObject's tag is set to "Player".
Some other object is probably starting inside the NPC's sphere collider, causing it to detect OnTriggerEnter.
To fix this, inspect the Conversation Trigger. Expand Condition > Accepted Tags. Set the Size to 1, and set Element 0 to "Player" (without quotes). Then make sure your player GameObject's tag is set to "Player".
Re: Using OnTriggerEnter properly to trigger a conversation
Thanks for the quick and concise answer. That fixed it, should have thought of it. Thanks
Re: Using OnTriggerEnter properly to trigger a conversation
Glad I could help!