Problem with instantiated prefab animation

Hello,

I’m making a match-3 game and I’m having an issue with a simple animation prefab.
I’m calling the prefab like this:

GameObject instance = Instantiate(explosionPrefab) as GameObject;
instance.transform.parent = grid.transform;
instance.transform.localPosition = new Vector3( item.point.x * Data.cellWidth, item.point.y * -Data.cellHeight, -5f)

But the animation is not showing in the game (altough, I can see it working in the scene)
I’ve left the animation Culling Mode in “Always Animate” and already checked the sorting layers.

If I add a particles system in the prefab the particles will show, but not the sprite animation.

Any clues? Thanks for the help :slight_smile:

I think you should check the z position of the instantiated animation at run-time and try to tweak that. Apart from that if it doesn’t helps then you shall try it separately by turning the grid off. Also make sure that it the position assigned to the prefab is correct.

Hello cbothra,

The z position did the magic trick, thank you for your answer :wink: