I just try Quest Machine for Unity, I already finish the tutorial from youtube and read the document. I already try to apply it to my project and stuck at the reward system. First of all I'm sorry if my english was bad and I'm not good with programming.
May I ask if there is a way for my GameObject in the scene to update the value same as the Prefabs in UnityEvent ? Here is the picture and detail :
This is the Actions on Success quest, prefabs have value 100 points
This is prefabs image where the value increase from 100 to 200 when quest Success
This is GameObject where the value still 100 when quest Success, but change to 200 when I stop the game and play again.
And here is the script :
Code: Select all
public TextMeshProUGUI pointText;
public TextMeshProUGUI crystalText;
[SerializeField] public int totalPoints;
[SerializeField] public int totalCrystals;
void Start()
{
pointText.text = "P : " + totalPoints;
crystalText.text = "C : " + totalCrystals;
}
void Update()
{
pointText.text = "P : " + totalPoints;
}
public void getPointsQuest(int value)
{
totalPoints += value;
}
//public int pointsQuest
//{
//get { return totalPoints; }
//set
//{
//totalPoints += value;
//}
//}