How to order newly created Objects?

Hello all,

I’ve searched the web for help, but haven’t found any suitable or at least I haven’t understood it ^^

I’ve created a script that orders an Object (e.g. a Cube) to Position A and then B.
This works well, with a pre-placed Object, because I can attach the Script to it and then set the Positons A and B with the Inspector.

My Problem now is, that his isn’t working with Prefab. I’ve drag&dropped this Cube into a newly created Prefab and initiated it to my Scene. This works well and it pops out of nowhere… the problem is, that Prefab won’t apply my settings to it, instead there is just “None” as comment and I can’t edit it there… My newly created/initiated Cubes are just laying on the ground, doing nothing… instead of moving to A and B…
What’s wrong?

Another Question is, how can I remove this Cube when it reaches B? I’ve used a Collider and the Destroy() Command but it doesn’t work. I guess I have wrong settings there or syntaxes. Any help would be cool.

Thanks in advance! :slight_smile:

Prefabs can’t remember references to objects in the scene. When you instantiate them, you need to find the waypoint and assign it to them. You can destroy the object when you are within a certain radius, or right on the spot.

if (Vector3.Distance(transform.position, B.position) < 0.1f)