This is an interesting one… For the fun of trying it out, I tried building my game, but I quickly noticed that for god knows what reason, my Dialogue ‘Next’ button did not get involved in my game build, so I can’t really progress in the conversations. Why is that the case?
First of all, great job! Most people wind up not being able to compile because they left a stray bit of editor code here or there.
The Next() bug is caused by the lookup dictionary not being created in the Dialogue ScriptableObject.
We create it in OnValidate(), but as it turns out while OnValidate is always called in the Editor, the callback is never invoked in a built game.
The solution is to add in Awake() or Start() (outside of any #if UNITY_EDITOR block)
void Awake()
{
OnValidate(); //Build the node look up.
}
Considering how I’m walking on eggshells to make sure I don’t crash this project, I’m grateful this didn’t have any weird problems
Apart from that, that fixed it. As usual, thanks again Brian
And… I got greeted by the one and only bug that I’d be dead before I fix… the Quest infinity reward bug (which I tried getting rid of multiple times, but never was successful…!). This bug is, quite literally, driving me nuts!
there are a bunch of reasons why ur next button isn’t working
double-check the button’s scripting
also, inspect if any build settings or optimizations are affecting ui elements
as Brian mentioned earlier, it just didn’t get exported because OnValidate() wasn’t called. Alls’ good now though, thanks again man for the input
I do have an aggressive bug though, one I can’t figure out till this day, which… well… every player will definitely want in the game because it’s a cheat system, but I want it out. Everytime I quit my quest after finishing it off, my rewards duplicate when I try get out of it, and it triples if I try walk away…
@Brian_Trotter OK this one WAS A HUGE NIGHTMARE FOR SO LONG FOR ME TO FIX IT, but considering that I BUILT MY GAME again and THE GLITCH IS GONE, I can finally say… I FIXED IT. Here’s what was driving me NUTS:
I took inspiration from the Infinity loot glitch we had earlier because of my onDie() function that was on my Health script, that was causing an explosion of loot on my ground whenever I return to my game, because… well… this one was an explosion of rewards as well, so it made me think ‘hmm… they look similar’, and I start exploring my hierarchy in my QuestGiver first… nothing seemed too fishy there.
Naturally, I go to my code, and I search for a bit. Low and behold, I find two functions, in ‘QuestList.cs’, called ‘AddQuest()’ and ‘CompleteObjective()’, which also miraculously are exactly where my bug was coming from, and then I see a familiar pattern:
For my loot explosion bug, we had an ‘onDie()’ event that was causing me the chaos in Health.UpdateState(). Do you see the pattern here? in “QuestList.cs”, we had an Action event called ‘onUpdate()’, which was the source of the bug this entire time. I commented it out, and now I have no duplication issues.
TLDR: comment out the ‘onUpdate()’ event call if statement, in both ‘QuestList.AddQuest()’ and ‘QuestList.CompletedObjective()’
One last question though, does commenting this action out have any long term negative effects on my game?