OnTriggerEnter is only called once with multiple triggers.

I have this code.

    void OnTriggerEnter(Collider col){
        Instantiate (pref, new Vector3(0, col.transform.position.y + yOffset, -10), Quaternion.identity);
        Debug.Log("hitTrig");
    }

It is attached to a player that is moving upwards towards the triggers, the “pref” object has a trigger in it, and when the player passes through it, it spawns another one of itself, but it only works for the first trigger, then when it reaches the second one and passes through it, the code is not called.

My player is using FixedUpdate to move (I think it is relevant?)

Misaligned triggers. Never work at 1:45 am.

3 Likes