Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to increase or decrease a counter when a gameobject has been destroyed.

The code for destroying gameobject is linked to the gameobject which do the actions.
And the code allows me to increase or decrease a counter is in a separated code. It's necessary because I can't associate these two codes to the same gameobject.


Thus, I need to indicate that when a gameobject is destroyed, it's when we have to modificate the counter.

C#
#pragma strict

var Counter : int = 0;


function Update () {

    Counter++;
    guiText.text = "Counter :"+Counter/80;


}


So, I just need the code which allows me to indicate : "gameobject is destroyed"

Thank you in advance for your help :)
Posted
Comments
Sebastiaan Meijerink 24-Apr-15 17:25pm    
I'm sorry to say, you'll have to provide more info.
This doesn't look like javascript. Where is the code for the game object.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900