Jump to content
Unity Insider Forum

Prime31 2d character control collisionStay event only allows trigger once


Gerolmed

Recommended Posts

I use prime 31 2d controller in mzy 2D platformer. To activate the game object "lever" you simply walk in the collision box and press enter. Now the weird thing is this only works once unless you leave the collision area and enter again.

I call the lever (in the collisionevent with parameter Collision2d col):

col.gameobject.getComponent<LeverScript>().trigger ();

If it exists. Trigger() has a cool down on it. What has got to change,to let me press the lever multipletimes and not having to reengage the area over and over again.

Link zu diesem Kommentar
Auf anderen Seiten teilen

Not sure what the problem is without seeing the code. Normally, onCollisionStay is triggered several times. Perhaps other things are happening (in code) if you leave or enter the collision box, like reset the level object or prepare to use it (here you have to inspect and debug the LevelScript code).

Link zu diesem Kommentar
Auf anderen Seiten teilen

vor 18 Stunden schrieb Zer0Cool:

Not sure what the problem is without seeing the code. Normally, onCollisionStay is triggered several times. Perhaps other things are happening (in code) if you leave or enter the collision box, like reset the level object or prepare to use it (here you have to inspect and debug the LevelScript code).

Due tofurther testing I was able to discover that if you don't move the event is called ~20 times. As soon as you move a bit it starts again. Maybe it is a unity error.

Btw I'm using Unity 5.6.0

Link zu diesem Kommentar
Auf anderen Seiten teilen

Archiviert

Dieses Thema ist jetzt archiviert und für weitere Antworten gesperrt.

×
×
  • Neu erstellen...