Search Issue Tracker

By Design

Votes

1

Found in

2017.1.0p4

Issue ID

956455

Regression

No

OnTriggerStay not called when Script is added during Runtime on Collision to a Collider game object that is a child Of RigidBody

Physics

-

Steps to reproduce:
1.Open attached “RuntimeAddScriptTrigger.zip” Unity project
2.Open scene “Test"
3.Enter Play mode
4.Expand “Parent” object in the Hierarchy to see its child objects
5.Attach the “Triggers.cs” script to “TriggerObject”

Expected results:
OnTriggerStay is called and debug message “Stay triggered by BoxCollider" is shown
Actual results:
OnTriggerStay is not called

Reproduced in: 2017.3.0b3, 2017.2.0f3, 2017.1.2f1, 5.6.4f1, 5.5.5f1, 5.5.0f1

Note: Works as expected if the script is attached while not in runtime or parent object does not have a Rigidbody component.
_____________
By design:
OnTriggerStay depends on having processed OnTriggerEnter first internally, which is not done if there were no scripts interested in that event at the time the overlap was detected first (for performance reasons)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.