Back with what should be an easy problem, but is driving me nuts.
Trying to calculate and display percentage of pick ups collected in the Roll a Ball tutorial, but my percentages go from 0% to 100% with nothing in between.
I have a float named percent declared earlier in the program. 12 pick ups. Should just be able to divide count (pick ups collected so far) by total pick ups (12) * 100 to get percent.
Okay, so the next thing to check is if it’s being called when you collect the other pickups - it probably is, but try adding a Debug.Log statement to the start of the method. If that is called every time you collect another object, add more log messages to the method.
Change 12 to a float worked.
I changed the total to 146 to match all the pickups in the level and added (“#.00”) to my display string and it all works great now.
I’m still working on the Move.Towards Joe recommended. I couldn’t get it to work, but looking at it again, I think I may know why now. If not I’ll be back with another question. Almost ready to present my version of the tutorial for critique.
Had the same problem, was trying to get percentages using Integer math, changed vars to float and it worked. I had even tried casing the calc to float and that didn’t work;