#UnityEvent didn't get invoke of how i wanted to

1 messages · Page 1 of 1 (latest)

magic bone
#
 [SerializeField] Boss Firstboss;
    [SerializeField] UnityEvent BossEvent;

    [SerializeField] GameObject SecondBoss;
    public void NextSpawn()
    {
        if (Firstboss.FirstBossDied == true)
        {
            BossEvent?.Invoke();
        }
    }

    public void SpawnSecondBoss()
    {
        Instantiate(SecondBoss, new Vector3(0, 0, -15), Quaternion.identity);
        Debug.Log("Activate");
    }``` 

Ok this seems to work when i press a button on the canvas. But i want this to invoke the moment that FirstBossDied turn true. But it didnt, is there anything i did wrong?
reef flower
#

Unless you are calling NextSpawn every frame, how is it supposed to detect changes in FirstBossDied instantly?