Trigger event script doesn't work

Announcements, support questions, and discussion for Quest Machine.
Adeoon
Posts: 33
Joined: Fri Dec 02, 2022 5:53 am

Trigger event script doesn't work

Post by Adeoon »

So I have weird problem .. My OnTriggerEnter/OnTriggerExit events doesn't work, my player has Player tag, rigidbody, box collider on him. My area has sphere collider with is trigger checkbox selected. Same as in tutorial but my event doesn't seem to detect player is entering the circle. I did everything like in this tutorial:



What can be the problem? My player is on different scene that area can it be the problem? Even tho player's collider is entering area trigger?
Attachments
Zrzut ekranu_20230115_190614.png
Zrzut ekranu_20230115_190614.png (170.24 KiB) Viewed 1604 times
Zrzut ekranu_20230115_190419.png
Zrzut ekranu_20230115_190419.png (174.55 KiB) Viewed 1604 times
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trigger event script doesn't work

Post by Tony Li »

Hi,

It's fine for the player to be in a different scene.

If you're making a 2D game, tick the Quest Machine Welcome Window's USE_PHYSICS2D checkbox.

Select Edit > Project Settings. In Physics (or Physics2D if you're making a 2D game). In the collision matrix, make sure the Default x Default checkbox is ticked.

Two things could be happening:

1. Unity isn't registering a trigger collision, so the TriggerEvent component isn't firing.

2. Or the TriggerEvent component is firing, but it's sending the wrong message or the quest is listening for a different message.

To verify that it's sending a message, temporarily tick the Quest Machine GameObject's Debug Settings > Debug Message System checkbox. Then play. This will log a lot of activity to the Console. When the player enters the ForestArea, watch the Console for a log that indicates it's sending the message.

if it is sending the message, make sure the quest is in a state that's listening for the message.
Adeoon
Posts: 33
Joined: Fri Dec 02, 2022 5:53 am

Re: Trigger event script doesn't work

Post by Adeoon »

Okay so as long as I can see trigger works, I clicked debug in quest machine and I can see that message is sending every time player enter the trigger, but now the case is that my quest doesn't react on that, It should make quest node active, but it doesnt. ://
Attachments
Zrzut ekranu_20230115_210257.png
Zrzut ekranu_20230115_210257.png (40.54 KiB) Viewed 1600 times
Zrzut ekranu_20230115_210429.png
Zrzut ekranu_20230115_210429.png (104.54 KiB) Viewed 1600 times
Adeoon
Posts: 33
Joined: Fri Dec 02, 2022 5:53 am

Re: Trigger event script doesn't work

Post by Adeoon »

In playmode before I enter the area, that quest node named ExploreForest is active, but entering doesn't make that true/success what I want.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trigger event script doesn't work

Post by Tony Li »

Are there any hidden characters such as blank spaces in either the quest's Message Quest Condition or in the TriggerEvent's SendToMessageSystem field?
Adeoon
Posts: 33
Joined: Fri Dec 02, 2022 5:53 am

Re: Trigger event script doesn't work

Post by Adeoon »

No there aren't :/
Adeoon
Posts: 33
Joined: Fri Dec 02, 2022 5:53 am

Re: Trigger event script doesn't work

Post by Adeoon »

This is how it looks like before entering the area, of course correct database is set up in quest machine and in that database there is my quest.
Attachments
Zrzut ekranu_20230116_135931.png
Zrzut ekranu_20230116_135931.png (34.16 KiB) Viewed 1563 times
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trigger event script doesn't work

Post by Tony Li »

Hi,

Does the completed tutorial scene included in QuestMachineTutorialAssets.unitypackage work correctly? (You can download it from the Quest Machine Extras page.)

If the completed tutorial scene doesn't work, please try it in a new, empty project in which you've only imported Quest Machine and the tutorial assets. This will tell us if it's something specific in your original project.
Adeoon
Posts: 33
Joined: Fri Dec 02, 2022 5:53 am

Re: Trigger event script doesn't work

Post by Adeoon »

I mean, I don't really know what did I do, but it works, I deleted conditions and add them again :D
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Trigger event script doesn't work

Post by Tony Li »

Great! I'm glad it's working. Maybe there was a typo somewhere.
Post Reply