I’m trying to instantiate a prefab at the location of an enemy when it dies, but it instantiates the prefab in the original position it was created in, I’m currently using GameObject healthOrb = (GameObject)Instantiate (Resources.Load ("HealthOrb"));
How can I get this to be placed at the location of the game object this is attacked to?
You can do:
GameObject healthOrb = Instantiate(Resources.Load("HealthOrb"), "Place position here", "Place rotation here") as GameObject;
or
GameObject healthOrb = Instantiate(Resources.Load("HealthOrb")) as GameObject;
healthOrb.transform.position = "Place position here";
Instantiate exists with more than one parameter. put a comma after HealthOrb")
there comes the position.
OR
change the position of the transform I’d the newly instantiated healthOrb on a new line