A moving big box along a path spawns small boxes via a game object spawner, the small boxes match the spawner’s speed, how can I make small boxes not move but remain in the position they are spawned?
cube.transform.localPosition = Vector3.zero, is the spawn position, I have also tried making the spawned boxes static objects, but that doesn’t work…
You’re possibly spawning the small boxes winting the transform of the large box.
Transforms are a hierarchy, moving the parent transform moves all the child transforms within it. If you set the spawned small box transform.parent = null, it will move it to the root of the scene hierarchy.
Thanks for your reply Cameron!
I tried it earlier and it didn’t work, I made a Detach from Parent script - the instantiated clones remain in the spawner hierarchy. I tried using Rigidbodies, but also nothing, it seems like the spawner on the path overrides everything I try…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Detatch_From_Parent : MonoBehaviour
{
public void DetachFromParent()
{
// Detaches the transform from its parent.
transform.parent = null;
}
}
Did you look in the hierarchy to see where it spawned your small boxes? Are they at the root level or parented to the large box?
What the video carefully if you don’t understand. Transform hierarchies are a fundamental concept you’ll need to know to get anywhere in Unity.
They are still there even with the script applied. See attached image. I have just figured out a simple workaround, I don’t think it is ideal, but it works for now. I gave the small boxes their own speed script and made them go in the opposite direction to the path spawner direction, now the small boxes remain in place and don’t move.

That image is about what I expected.
You’re spawning them parented to the moving box in the hierarchy.
Try and find some other resources that explain the transform hierarchy, maybe do some introductional tutorials with scripting and the hierarchy. It’s a fundamental concept and until you grok that things are not going to behave how you expect them to and you might get very frustrated.
That script you posted earlier also won’t do anything unless you specifically call the Detach_From_Parent method that changes the transform.parent. You could also simply spawn the boxes not parented to anything to start with then it wouldn’t be needed.