Answer the question
In order to leave comments, you need to log in
Unable to call Event. c#, unity. What's the catch?
Code + error.
using UnityEngine;
public class Gun
{
public delegate void Shoot();
public event Shoot ShootEvent;
}
public class GunManager : MonoBehaviour
{
public Gun SmallGun;
private void Start()
{
SmallGun.ShootEvent += First;
SmallGun.ShootEvent += Two;
if(SmallGun.ShootEvent() != null)
{
SmallGun.ShootEvent();
}
}
public void First()
{
Debug.Log("Jojo");
}
public void Two()
{
Debug.Log("Jojo2");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question