Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

my explosion animation is stuck on last frame rather then getting destroyed after finishing

$
0
0
so im new to game making and stuff and i am trying to make this simple space shooter game. when i fire bullet hit the target destroys it and explosion animation is played but the last frame is stuck on the screen rather then completely disappearing. for animation im using a prefab here is my script for enemy: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Enemy : MonoBehaviour { public int health = 100; public GameObject deathEffect; public void takeDamage(int damage) { health -= damage; if (health <= 0) { die(); } } void die() { Instantiate(deathEffect, transform.position, Quaternion.identity); Destroy(gameObject); } } ![alt text][1] [1]: /storage/temp/125583-game.jpg

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>