C#
I want to call the function that is in the OnTriggerStay but it’s only calling it for one object at a time. how can i make it so that it calls it for all the game objects at the same time? this will be used for an explosion-type damage.
using UnityEngine;
using System.Collections;
public class EnemyDamageZone : MonoBehaviour {
public float AmountOfDamage;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerStay (Collider ObjectToDamage){
if(ObjectToDamage.gameObject == GameObject.FindGameObjectWithTag("Enemy")){
ObjectToDamage.gameObject.GetComponent<ExperimentalEnemy> ().EnemyDamage (AmountOfDamage);
}
}
}