Snowboarder goes through the ground or randomly gets stuck

Hello! I am following the Unity course about snowboarding game and everything seems to work fine except that sometimes my player randomly gets stuck with his snowboard in the snow or even falls through it. My code is matching Rick’s and in most part of gameplay player collides with the ground as he should.
Not to mention that sometimes if I slightly move my player, or change a bit the shape of the ground I am getting 3 errors such as “GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)”
Any ideas what could be wrong or how to fix it?
I will be grateful for any help!

1 Like

Welcome to the community!

From the looks of it, you seem to have an error on line 189 of your GUIUtilities script, id specifically go there first for troubleshooting.

  1. Double check that the colliders on your player and the snow terrain are set up correctly and are interacting as expected. Double-check collider sizes and positions.

  2. The GUI error probably stems from your code, and it might be triggered by something, line 189 of your GUIUtilities script might help.

If this doesn’t work would you mind pasting your GUIUtilities script into here using the code formatting(</> button at the top when you type, highlight the pasted code then click the button)

Hope this helps!

1 Like

Thank you so much for your response, Christopher! :slight_smile:
So when it comes to colliders, that was my first thought so I checked the lines of colliders right away, however they all seem to be correct, lines are exactly where thy should be and there is really no difference in comparison to places where my player acts as he should. That is why I am stumped.

Regarding the GUIUtilities script, as I am a complete beginner I have to admit I am not even sure how to access it. If you could help me and direct me where I can find it I will be happy to look there. Also what is rather surprising about this error is that most of the time it doesn’t occur. Sometimes a little change in a ground shape or even moving my player at the start for 2 mm to one side or the other can trigger it. On the scene view it doesn’t seem to change anything and yet Unity sees something that causes issues.

Sorry for such a long message and thank you again for your help!

1 Like
  1. Open the Unity Editor.
  2. In the Project window, navigate to the folder where your scripts are stored.
  3. Look for a script named “GUIUtility” or something similar.
  4. Double-click on the script to open it in the code editor.

Once you’ve found the script, navigate to line 189 and examine the code around that line.

If you are having issues with your code, and can’t figure it out, just paste you code in here using code formatting, which is explained above

1 Like

Hello! Thank you again for your help and I am sorry for late reply.

I managed to find a script named “IGUIUtility.cs” (GUIUtility couldn’t be found) by a search bar. It wasn’t in my Script folder as I wasn’t the one who created it. I opened it in VS Code editor and whole file has only 50 lines of code, which makes me believe it is not the script we were looking for.

I didn’t manage to investigate this error better, however I believe I discovered what was causing it. In the course Rick mentions to switch ‘Collision detection’ on RigidBody of the player from ‘Discrete’ to ‘Continuous’. I did that but apparently I had to do it while on Play Mode as it simply didn’t save in my settings. As I remember doing that I didn’t think immediately to check whether it is active or not. Changing it to ‘Continuous’ stops the error from appearing again and everything seems to work just fine.

Thank you again for your help and I am sorry for taking your time on a problem that was a result of my negligence!
Wishing you a nice evening!

1 Like

I’m glad you managed to solve your problem, good luck on the rest of your gamedev journey!

1 Like

Thank you! :slight_smile:

1 Like

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

Privacy & Terms