I'm working on my project, and having issues getting my character to Only pick up the Object if it is Dead, Health = 0. I got a separate Health script & Pick Up Trigger script. I tried to combine them but I cant get them to work on only picking up when Dead, my script just picks up. I also have a bullet script that damages the Object"dog". this is just a mock up of my game to function properly.
Code:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PickUpScript : MonoBehaviour { public GameObject realDog; public GameObject fakeDog; public GameObject Chicodog; public void Start() { fakeDog.SetActive(false); Chicodog.SetActive(false); } void OnTriggerEnter(Collider other) { //if (GetComponent<DogHealth>().Health <= 0) { if (other.gameObject.tag == "Player") { realDog.SetActive(false); fakeDog.SetActive(true); Chicodog.SetActive(false); } } } }
Comment