Question by
SQUARE-BADGER · Sep 04, 2016 at 07:40 PM ·
scripting problemscripting beginnerscriptingbasicstagtags
tagged objects problem
I want to set a public gameobject with a in game object, not from the prefabs, i learned how to use tags but my zombie object does not set the tagged ZombieSpawn in its public gameobject, what is the problem? using UnityEngine; using System.Collections;
public class EnemyBehaviour : MonoBehaviour
{
public GameObject spawnscriptobject;
public int life = 100;
// Use this for initialization
void Start()
{
spawnscriptobject = GameObject.FindGameObjectWithTag("ZombieSpawn");
}
// Update is called once per frame
void Update()
{
if (life <= 0)
{
Destroy(this.gameObject);
spawnscriptobject.GetComponent<SpawnScript>().Zombiecount();
}
}
void OnTriggerEnter(Collider Bullet)
{
life -= 10;
}
}
Comment
yes i want to set it as the spawnscriptobject
Your answer
Follow this Question
Related Questions
Timer wont work 0 Answers
Make enemy patrol without Nav Points? 0 Answers
random spawn enemy problem 0 Answers
Help with Changing the Sprite image in the Script 0 Answers
this script is missed up help? 1 Answer