Page 1 of 2

Trigger event script doesn't work

Posted: Sun Jan 15, 2023 1:08 pm
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?

Re: Trigger event script doesn't work

Posted: Sun Jan 15, 2023 2:57 pm
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.

Re: Trigger event script doesn't work

Posted: Sun Jan 15, 2023 3:04 pm
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. ://

Re: Trigger event script doesn't work

Posted: Sun Jan 15, 2023 3:06 pm
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.

Re: Trigger event script doesn't work

Posted: Sun Jan 15, 2023 3:14 pm
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?

Re: Trigger event script doesn't work

Posted: Mon Jan 16, 2023 7:48 am
by Adeoon
No there aren't :/

Re: Trigger event script doesn't work

Posted: Mon Jan 16, 2023 8:01 am
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.

Re: Trigger event script doesn't work

Posted: Mon Jan 16, 2023 10:30 am
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.

Re: Trigger event script doesn't work

Posted: Mon Jan 16, 2023 12:09 pm
by Adeoon
I mean, I don't really know what did I do, but it works, I deleted conditions and add them again :D

Re: Trigger event script doesn't work

Posted: Mon Jan 16, 2023 2:16 pm
by Tony Li
Great! I'm glad it's working. Maybe there was a typo somewhere.