im trying to make a sprite spawn via instantiate. when it spawns it performs an animation that i have set to it but is invisible. order in layer is fine, z position is fine (its in 2d) and if i drag the prefab straight from the project menu theres no problems, only when instantiating it. any help?
void SpawnAttack (string dir, int speed, string color)
{
GameObject atk = Instantiate(Attack, attackSpawn.position, attackSpawn.rotation);
atk.transform.SetParent(UiMaster);
if (dir == "left")
{
atk.SendMessage("BeLeft");
}
if (dir == "right")
{
atk.SendMessage("BeRight");
}
if (dir == "up")
{
atk.SendMessage("BeUp");
}
if (dir == "down")
{
atk.SendMessage("BeDown");
}
if (color == "red")
{
atk.GetComponent<SpriteRenderer>().color = Red;
}
}