Advice on refactoring

As a kinda experienced programmer, I too found the Quiz game part hard to follow, especially during the script part. I think my problems might be related to not strictly copying the code from the video.

Maybe subconsciously I am not liking the code I am given. It makes the code hard to follow.

To save time debugging (going back and forth between script and UI), I rewrote the code.

Using a more OOP approach for the Timer class really helps, the timer should know nothing but time left and duration. The timer should not have anything to do with “shouldLoadNextQuestion”. It just doesn’t make sense to me. Maybe in the game dev world it does make sense, in that case I will accept it. I am new to game dev.

Handle the game flow in Quiz.cs. Finally everything works and I can move on to next video :joy:

1 Like

Imho, you are not wrong. I haven’t done the course, but from the number of questions I’ve answered (and downloaded peoples’ projects to find issues) I can honestly say that Quiz Master is riddled with issues. If it was up to me, I’d have it removed or redone.

Game dev is just dev. There is a slight restriction that you have to do things the way the engine wants (eg. Unity don’t want us to use constructors on MonoBehaviours) but you stick to good programming practices.

I have personally written my own code for all the courses I’ve done here, instead of just copying everything. As long as you understand what the intention was, the code can be your own. It does, however, make it a little difficult for us here on the forum to figure out and solve a problem, because the code don’t match what we know…

2 Likes

Keep in mind that the course is created with beginners in mind, that’s why sometimes the instructors fall into bad practices, they can’t use all the tools in their belts, if they do, they might alienate a lot of students or/and the courses would get way too long trying to explain everything.

That being said, I 100% agree with @bixarrio, that part of the course needs a revamp. I haven’t been as active in the past couple of years in the forums, but I’ve helped a lot of people here and that part of the course causes a lot of confusion to the point I’ve suggested students to skip it entirely and finish it last.

1 Like

Privacy & Terms