var Box : GameObject;
function OnMouseUp(){
this.SendMessage(“Sliding”);
Debug.Log(“1”);
Box.transform.Translate(Vector3(0,-3,0));
Debug.Log(“2”);
yield WaitForSeconds(1);
Box.transform.Translate(Vector3(0,3,0));
Debug.Log(“3”);
}
//////
(script2)
var second : Texture;
var third : Texture;
function Start () {
sliding = false;
MatLoop(0.1);
}
function MatLoop (speed : float) {
if(sliding == false){
while(true)
{
renderer.material.mainTexture = first;
yield WaitForSeconds(speed);
renderer.material.mainTexture = second;
yield WaitForSeconds(speed);
}
}
else{
renderer.material.mainTexture = third;
}
}
function Sliding(){
sliding = true;
while(sliding){
Debug.Log("Sliding ...");
}
yield WaitForSeconds(2);
sliding = false;
}
Ok , I’ve created these two scripts . One is meant to create the illusuion of running(Script2) , as in the textures changing all the time so it looks like your running . The other is so when you click a button the running animation stops turns into a third sliding texture . So when you click the button it’s ment to send a message to the second script function Sliding which makes it stop and activate the sliding and also make the gameobject go lower . But the message doesnt send and i get a - SendMessage Sliding has no reciever !.
This always happens to me with bloody SendMessage’s ! the “have no reciever” even though the functions there . Can someone explain how to fix it please ?
Thanks
Stealth