- Home /
Is it possible to intercept variable alteration/function calls on an object (From within the object)?
For instance, I have an object with a lot of colliders attached, and it basically freezes the game whenever transform.position is altered. BUT, if you alter its position with rigidbody.position, the object moves with very little performance cost. So, I want a script that I can attach to my object that can intercept any time a script or the editor tries to alter its transform.position (but not its rigidbody.position), so that I can disable its colliders first so that my game/the editor does not freeze.
So firstly, is there a way to tell when an object is moved with rigidbody.position vs. transform.position/
Secondly, is there an efficient way to interecept changes to this variable, besides for just setting up a variable comparision in the Update() function. Is there a more fundamental way to get an alert or something whenever that variable is altered?
Your answer
Follow this Question
Related Questions
Move gameObject with mouse 1 Answer
How do i move an object relative to another objects axis. 2 Answers
GameObject uses his "own" Transform 0 Answers
Confuse about transform.InverseTransformPoint 1 Answer
Help with Rotating code? 2 Answers