Attackers not showing up after Instantiation

The Spawn code:

void Spawn( GameObject myGameObject) {
    GameObject myAttacker = Instantiate(myGameObject) as GameObject;
    Debug.Log("Spawned " + myAttacker);
    Debug.Log("gameObject " + gameObject);
    myAttacker.transform.SetParent(gameObject.transform, false);
    Debug.Log("Attacker Parent " + myAttacker.transform.parent);
    myAttacker.transform.position = gameObject.transform.position;
    Debug.Log("Position " + myAttacker.transform.position);
}

The output:

Spawned Lizard(Clone) (UnityEngine.GameObject)
UnityEngine.Debug:Log(Object)

gameObject Spawner (4) (UnityEngine.GameObject)
UnityEngine.Debug:Log(Object)

Attacker Parent Spawner (4) (UnityEngine.Transform)
UnityEngine.Debug:Log(Object)

Position (12.0, 5.0, 0.5)
UnityEngine.Debug:Log(Object)

The Attacker does not show on the Game screen, the Scene screen, or the Hierarchy.

Of course, the Attackers work when added to the scene.

I tried added a Sprite Renderer but still nothing.

Any ideas?

1 Like

I found the problem.

The Attacker was Instantiating in the Shredder. The worlld coordinates start at the Core Game for me, so I had to set the start x to 10.

1 Like

Privacy & Terms