Page 1 of 1

OnTriggerEnter Issue

Posted: Wed May 25, 2016 5:53 pm
by Nazazel
Hi Tony,

This is Naz. My team and I are having issues with our scripts working with the ones from the Dialogue Manager specifically with a script that uses the OnTriggerEnter method. The issue is that one of our scripts also uses OnTriggerEnter as a means to transition from scene to scene within our game but when used with the Dialogue Manager--say on a character within our game--it overrides our script because it takes the Dialogue Manager's scripts as priority. Is there a work around this issue?

Re: OnTriggerEnter Issue

Posted: Wed May 25, 2016 9:09 pm
by Tony Li
Hi Naz,

It's possible to change the priority of scripts (Edit > Project Settings > Script Execution Order), but this may not be what you really want to do.

When a GameObject with a collider and rigidbody enters another GameObject's trigger collider, Unity calls the OnTriggerEnter method on all scripts on both GameObjects. All of the OnTriggerEnter methods will be called in the same frame.

Can you put these scripts on the GameObjects that aren't the player character? For example, if you have a GameObject with a trigger collider that transitions to another scene, put the script on that GameObject, not the player.

Similarly, if you have an NPC that starts a conversation when its trigger collider is entered, put the Conversation Trigger on the NPC, not on the player.

If the info above doesn't help, please post some more details about what you're trying to do and what's happening. Or feel free to send an example project to tony (at) pixelcrushers.com.

Re: OnTriggerEnter Issue

Posted: Thu May 26, 2016 12:11 am
by Nazazel
Thank you so much for the suggestions. Ultimately, we decided to remove our script from the scene to avoid any overlap with the way the Dialogue Manager works. Instead, rather than having something initiate a transition into the next scene, we'll be making it timed. So, after a certain amount of time, the scene will just transition.

Re: OnTriggerEnter Issue

Posted: Thu May 26, 2016 8:35 am
by Tony Li
Sounds good! If any other issues come up, just let me know! :-)