I am currently at a stage where I am implementing quest rewards upon quest completion. I intend to spawn a treasure chest as the quest reward. Therefore, I created a script that contains a method to spawn a chest near the player. I thought the most intuitive place to call this method would be through a UnityEvent in the 'successful' state of the quest on the Quest Machine window.
Unfortunately, I could not find the new method I have created in this UnityEvent dropdown (shown on attached image). Why is this so? If this is not the right place to call a method upon quest completion, where should we be doing it?
Code: Select all
public void SpawnRewards()
{
GameObject player = GameObject.FindGameObjectWithTag("Player");
foreach (GameObject reward in rewardsToSpawn)
{
GameObject rewardSpawned = Instantiate(reward);
rewardSpawned.transform.position = GetDropLocation(player.transform.position);
rewardSpawned.transform.LookAt(player.transform.position);
}
}