- Home /
SendMessage illogical errors
hey guys how's it going? I'm trying to display 2 GUI Textures the 1st is if the player collides with the door with no cells the 2nd is if he collides with it with less cells than the necessary amount to open it.
1st script:
101010
static var charge : int = 0; var collectSound : AudioClip;
var hudCharge : Texture2D[];
var chargeHudGUI : GUITexture;
var meterCharge : Texture2D[];
var meter : Renderer;
function Start () {
charge = 0;
}
function Update () {
}
function CellPickup () {
HUDon();
AudioSource.PlayClipAtPoint(collectSound, transform.position);
charge++;
chargeHudGUI.texture = hudCharge[charge];
meter.material.mainTexture = meterCharge[charge];
}
function HUDon(){
if(!chargeHudGUI.active){
chargeHudGUI.active = true;
}
}
And 2nd script:
101010
function Start () {
}
function Update () {
}
var doorLight : Light;
var lockedSound : AudioClip;
var textHints : GUIText;
function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == "Player") {
if(Inventory.charge == 4) {
transform.FindChild("door").SendMessage("DoorCheck");
if(GameObject.Find("PowerGUI")){
Destroy(GameObject.Find("PowerGUI"));
doorLight.color = Color.green;
}
}
else if(Inventory.charge > 0 && Inventory.charge < 4){
textHints.SendMessage("ShowHint", "It needs more power");
transform.FindChild("door").audio.PlayOneShot(lockedSound);
}
else {
transform.FindChild("door").audio.PlayOneShot(lockedSound);
col.gameObject.SendMessage("HUDon");
textHints.SendMessage("ShowHint", "It's locked, I think the generator needs some power...");
}
}
}
the thing is the console is displaying 4 sendmessage has no receiver error for the HUDon and ShowHint functions, although the 1st message "it's locked..." appears but only once even after entering and re-entering the collider Thanks in advance for your help.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Unity BCE0005 Error. Please Help! 2 Answers
Getting Unknown Identifier Error 1 Answer
SendMessage setName has no receiver! 1 Answer