Posted on

Random Range Not Working in Unity

If you are ever trying to get a random number between 0 and 1 in Unity and end up only ever getting 0 then this might be your problem and solution. One thing you might not know about Random Range function in Unity is that the second parameter needs be plus one greater than the top number you wish to have for random pick when using ints.

The reason for this is that the Random Range function normally uses float and like when you case afloat into an int, whatever decimal numbers you have will be removed never rounding up.

Posted on

Fix Script Class Cannot be Found in Unity

In this video we will be showing you how to fix the error message of scripting class cannot be found. This whole error message reads, “Can’t add script component “ScriptName” because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.” If you are getting this error, make sure you watch this video to find the solution to this problem. By following this tutorial you will know why you are receiving this error and you know how to fix this problem. If you have any other questions about Unity, C#, or errors you are receiving make sure you tell us in the comments.

Posted on

Why are My UI Buttons Not Working in Unity?

This is an updated video of our last one where we explained why you might be having trouble with your UI components. If you ever find that your UI buttons or sliders are not working you might have this problem and here is how you fix it. The problem occurs when you don’t have an event system game object in your scene. All you have to do to fix it is to create a new event system game object.