Hey, I have a setup where a box collider (is Trigger) is in front of the moving character. It follows the mouse and applies a rigidbody.AddForce on any object caught in the trigger.
This is supposed to apply only to props like crates and similar, but it also applies by default to objects without rigidbodies. Hence I get this error:
MissingComponentException: There is no 'Rigidbody' attached to the "platformA_1" game object, but a script is trying to access it. You probably need to add a Rigidbody to the game object "platformA_1". Or your script needs to check if the component is attached before using it. UnityEngine.Rigidbody.AddForce (Vector3 force) (at E:/BuildAgent/work/71ca6fec1b41cc30/Runtime/Export/Generated/NewDynamics.cs:469) fieldBehaviour.OnTriggerStay (UnityEngine.Collider collisionInfo) (at Assets/Scripts/behaviours/hero/fieldBehaviour.js:18)
It doesn't currently affect the game, but I get the ugly error and it interferes with debugging.
Is there any way to filter through the rigidbody.AddForce to only objects with a rigidbody? More specifically, how can I check if the Collider I get from
function OnTriggerStay (collisionInfo : Collider ) {
has a rigidbody attached to it or not?
thanks