I’m trying to swipe the enemy sprite, after his death. There’s a code which does this in the Unity tutorial, but my entire code is in Javascript. I tried to do the same thing but is not working, and I don’t know why… How do I fix this?
function Death(){
//gets the Sprite renderer of my enemy
ren = GameObject.Find(this.name).GetComponent(SpriteRenderer);
var renderers = GetComponentsInChildren(SpriteRenderer);
//desables all the other past sprites
for(var s : SpriteRenderer in renderes){
s.enabled = false;
}
//and then enables a new one
ren.sprite = DeadSprite;
ren.enabled = true;
}
Unity is not is not changing the Sprite at all…