Kill Counter --> Score

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?

                                             / Thanks

You could add a script to your zombies, e.g.:

public class Zombie : MonoBehaviour
    public int points = 1; // You can edit this in the inspector

    void OnDestroy()
        PointCounter.points += points;

The GUI script would then be:

public class PointCounter : MonoBehaviour
    public GUISkin guiSkin = null;
    public static int points = 0;

    void OnGUI()
    { = guiSkin;
        GUI.Label(new Rect(0.0f, 0.0f, 128.0f, 32.0f), points.ToString()); = null;

So, whenever a zombie is destroyed it will add the points its worth to the pointer counter.

GUISKIN: Read the answer below...

Just going to create a new answer for the comment:

... but how can I add a font or a texture to it? ...

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: ` = mySkin;` in `OnGUI()` just before the label. You can then add the GUISkin by creating a public variable in the top of `PointCounter` with points. Then you can drag the GUISkin on to the GUISkin variable in the inspector.