|
Hey,I've been searching around a lot after a kill counter script for like 2 days now but I can't find anything that actually really works - I want my score to increase everytime I kill a zombie with like 5 points or something... I know that I gotta have a script that tells my GUI text to change and another one to tell it when the zombie dies but I can't still get it to work... Anyone know an example I can look on or an answered question that works?
(comments are locked)
|
|
You could add a script to your zombies, e.g.:
The GUI script would then be:
So, whenever a zombie is destroyed it will add the points its worth to the pointer counter. GUISKIN: Read the answer below... When I add them I just get alot of errors - Insert a semicolon at the end. Unexpected token: int.
May 12 '11 at 02:57 PM
simpleone
Hm, are you adding this to a javascript file?
May 12 '11 at 04:48 PM
Ejlersen
The above code is in C#
May 12 '11 at 04:53 PM
GesterX
by looking at this code it looks like points will always be 0, you aren't increasing by anything...
May 12 '11 at 05:08 PM
sp00ks
GesterX: Yes, thats why I'm asking if he is adding it to a JavaScript file :)
May 12 '11 at 05:42 PM
Ejlersen
(comments are locked)
|
|
Just going to create a new answer for the comment:
You can use a GUISkin for that. You create the GUISkin in Unity in Project Hierarchy, then in the GUISkin you can choose label. In there you can set a font, size, and so on. You use the GUISkin in the code by adding: Can edit your script above it? I added what you told me, nothing happened - I probably wrote wrong ...
May 12 '11 at 09:47 PM
simpleone
Done. Remember to assign the GUIskin in the inspector.
May 12 '11 at 10:09 PM
Ejlersen
(comments are locked)
|
