- Home /
Question by
zak666 · Feb 16, 2017 at 01:53 PM ·
instantiateloadresources
resources.load (instantiate from this.transform) rather then the centre of the map?
hey gang, should be a simple thing, I'm using resources.laod to load in my explosions! cool, but their showing up at the centre of my map rather then on the game object thats support to instantiate them!
// Update is called once per frame
void Update () {
if (HealthHP < 1 && Shipclass == 1) {
Transform ExplosionSmall = (Instantiate (Resources.Load ("ExplosionSmall")) as GameObject).transform;
Destroy (this.gameObject);
}
}
Comment
(Instantiate (Resources.Load ("ExplosionSmall")) as GameObject).transform.position = transform.position;
Answer by NoseKills · Feb 16, 2017 at 04:53 PM
Googling "unity instantiate" gives this as the result The examples on the page show how to instantiate an object at a desired location. That's what you want.
Transform ExplosionSmall = (Instantiate (Resources.Load ("ExplosionSmall")) as GameObject, transform.position, Quaternion.identity).transform;