"Number Wizard" Project Significant Glitch | C# Unity Game Developer 2D

A major glitch has made itself present while I was working on finishing my “Number Wizard” game project from the “COMPLETE C# UNITY GAME DEVELOPER 2D” Course on Udemy. If I’m not mistaken, I have followed the project instructions for code to a “t”, so, is this glitch native to the project? Or have I made a mistake in my code? Can anyone help me out?

The Glitch: In the game, the Player is prompted to choose a number between 1 and 1000, and the game then guesses the number, but the game shouldn’t be able to go above 1000 or below 1. In my build, there seems to be an odd relationship between the “It’s Lower” button and the “It’s Higher” button: While the “Lower” button keeps a solid boundary, the “Higher” button will randomly switch between a range of 3-4 integer numbers once it’s reached it’s “maximum boundary”; at which point, hitting the “Lower” button increments the “random range” by one, allowing the Player to slowly increment the “Guess” above the boundary.

For a better reference of the glitch, I have also posted this on the GameDev Communty Facebook page with a video of the glitch in action: https://www.facebook.com/groups/completeunitydeveloper/permalink/2844245105831376/

Hi Nicklefritz,

In the original code, we do not prevent the player from cheating. If you want to do that, you’ll have to analyse the code a bit further. You already did that and figured out when the problem occurs. With if-statements, you can prevent this from happening. You could even define the moment, when the player is cheating and render a corresponding message on your game screen.

Give it a try. :slight_smile:

1 Like

Thank you for the advice! I made a post on the GameDev.tv “Unity Course Community” Facebook Page, and got a lot of helpful feedback from people. In the end, I was able to solve this problem with the following code:

Fantastic! :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms