Im trying to send message to score to -5 when ever I instantiate an object, i’ve managed to get everything else fine but now it’s late and i’m derping it.
var spentAmount : int = -5;
if(GameObject.Find("__GameMaster").GetComponent(Score).score >= 5){
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit)) {
Instantiate (particle, hit.point, transform.rotation);
GameObject.Find("__GameMaster").GetComponent(Score).score)SendMessage("SetScore"), spentAmount);
I know the error is that last line but for the life of me i cant get it to work… this is how i did my others via on trigger
function OnTriggerEnter(other: Collider){
if(other.gameObject.tag == "Enemy"){
//Debug.Log("Enemy");
guiRef.SendMessage("SetStability", stabilityAmount);
Destroy(other.gameObject);
Destroy(other.transform.parent.gameObject);
}
but this one is attached to the object and it works fine need to figure out the top one