Efficient way of checking changed positions

Hi guys,

I’m hitting my head against a brick wall right now, long day.
Anyway, lets say i have an array of positions, which are stored on Start (initial instantiated positions of objects). I want to check whether or not these positions have changed. If a positions has changed, fire an action, and then set the initial position to the new position.
Currently i have an array which stores all these positions on one object. This object checks their current position against their initial positions in a for loop. Extremely inefficient i know.
Would there be any other way i could go about doing this? Another method that i might be able to try is to keep the check local to each position, and check if its current position is different to it’s old position → send message to manager, then fire event.

But would 1000 objects checking themselves against a Vector3 then sending a message be more efficient than one object checking 1000 objects against an array of 1000 Vector3’s?

Thanks!

I would suggest you this :
Do not check the position of all those in a loop.
Instead in the script where you could modify those positions - check the appropriate ones.

Example - the movement script, it sends the message that he updated his position after each movement.
Example #2 - if the player/whatever blows stuff up - add an ivisible sphere collider with “Is Trigger” enabled, corresponding to the maximum range that the player could affect anything and check only the objects INSIDE this range - could save you up alot of checks.