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?