Mathf.Clamp not working

I start off by saying Im a beginner and this is my first course! lol, but I found this was a little confusing at first and thought to mention it incase someone else hit this problem.

I had serialized my fields and my beginning values were minX as 0 and maxX as 16 - I was trying to work ahead :slight_smile: so when I corrected it to be 1 and 15 in the script it was still not working, as running the game the paddle was still being limited to the original values.

Only when I looked into the inspector for the paddle did I realize the values there were the 0 and 16.

Once those were fixed the game behaved as it should.

1 Like

I guess the good practice is to reset the serialized fields in the inspector (script component -> three dots on the right -> reset) ? :slight_smile:

2 Likes

Privacy & Terms