How can I instantiate animations (in 2D)?

I need to instantiate an animation, I have no problems instantiating other
objects, but the animation just doesnt appear in the game when I put a vector
in the instantiation.

//this makes the explosion animation appear, but not where I want it
Instantiate(explosion_prefab);

//this makes the instantiation, but the explosion animation doesnt appear at all
 Instantiate(explosion_prefab,Vector3(0, 0,3), Quaternion.identity);

I want the instantiation to be over an object (no problems with that), the problem is just that the animation doesnt appear giving it a vector and rotation.

I appreciate any help in advance.

What do you mean instantiate an animation? You need to ask how to show the animation. First create a plane object Rotate x: 90 y:180 Then create a folder inside unity and put all ur 2d textures inside that folder Then make the plane transparent unlit cutout as far as I remember I mean the plane obj has to be transparent Then load ur textures one by one to that plane obj to show It is much easier like this

Thank you tbkn, it worked

1 Answer

1

First, try new Vector3(0, 0, 3).

Second, make sure your camera’s Z and range are so that the explosion is not behind it, or too far.

Third, though I can’t think of any reason this would be required, you can try instantiating normally (the first option) and then setting the position:

Transform explotion = Instantiate(explotion_prefab) as Transform;
explotion.position = new Vector3(0, 0, 3);