- Home /
Question by
slpyhd · Jul 28, 2018 at 02:38 AM ·
scripting probleminstantiate-objects
How to spawn new object if the one before moved out of its spawn point
I want to have a mechanism where if an object moved out of its spawn point, then the spawner will instantiate a new one. I think it has to do something with the collider or trigger where it continuously check whether the object before is in/out of its spawn point, but I'm not good with scripting and I'm having trouble implementing it. I have been looking for spawner problems and most of them are just time-based spawner.
Comment
Answer by Burnoisette · Jul 28, 2018 at 03:20 AM
Check in each frame if the position of that object is different than the initial position. When this happens spawn a new object.
So for this you need to keep track of the initial position in a variable.