Changing the name of the GameObject isn’t really the best way to store information. Why can’t you just have an int in your Score script? It would be much cheaper to access ints directly than to constantly be creating new strings, setting gameObject’s name, and parsing them into ints.
Thank you guys for your well appreciated suggestions!
Unfortunately, still no luck with my score…
I tried using TryParse but the script does not want to recognize Gameobject.name as an int - I fear that I am scripting it wrong somehow - I have never used it before, although I tried many different ways…
You see, I have around 15000 cubes - the 1 player being a sphere that moves around -
aim of the game = score the max by hitting green high-value cubes.
13000 cubes have instead a “turn red if hit” script - they DO NOT matter “score-wise”
2000 cubes have a “turn green if hit” script - they matter “score-wise”
The 2000 cubes are all named individually with 2000 non-repeating numbers - which is why I am trying to use their name for scoring purposes as opposed to writing 2000 different scripts!
Well, should anyone have any other suggestion, that would be grand - in the meantime, I will continue trying with TryParse as it seems the best option so far!
Thank you,
Alma
P.S. — each of the 2000 cubes has (on the surface to be hit) a GUI text named “XXX Text” and carrying text = “XXX” (XXX being a number representing the Cube’s name/number) perhaps this can be of use for my scoring purposes instead of using the name of the cube?