Boolean not switching?

So I have this scipt:

#pragma strict
 
 private var inArea : boolean = false;
 var missile : Transform;
 var player : GameObject;
 //BlastDistance being called from somewher else
 function BlastDistance () {
 
     inArea = true;
 
 }
 function OnTriggerEnter (meow : Collider) {
 
 if (inArea == true) {
 
     if (meow.gameObject.name == "Player") {
     
     
     Debug.Log ("MEOW");
         }
     }
 }

but the boolean never switches. If you want the script that called it :

#pragma strict

var partical2 : Transform;
var blastTrigger : Transform;

function OnCollisionEnter (col : Collision) {
	
	if (col.gameObject.name == "Player") {
	BroadcastMessage ("BlastDistance");
	WaitForSeconds (0.1);
		Destroy (col.gameObject);
	
	}
	
					Instantiate (partical2, this.transform.position, this.transform.rotation);
						Destroy (this.gameObject);
}
	
Any help?

Thanks in advance.

Alright so I haven’t worked with the Unity API in quite a while now, but I feel like you could solve this a bit easier with C#. However, I do see that you are working with UnityScript in the question, so feel free to figure it out otherwise if you would rather use that.

However, I think that this simple C# class can do everything you’re trying to do, in one file. If there are any syntax issues in the code, I guess I’ll leave it up to you to solve them, so you can learn on your own.

Label the file you copy and paste the code into as Blast.cs

using UnityEngine;
using System.Collections;

public class Blast : MonoBehavior
{
	// Store local private boolean
	private bool inArea;
	
	public void Start()
	{
		// At the start, set boolean to false
		this.inArea = false;
	}
	
	public void BlastDistance()
	{
		// On BlastDistance call, set boolean to true
		this.inArea = true;
	}
	
	public void OnTriggerEnter( Collider meow )
	{
		// Log your boolean before you check inArea
		Debug.Log(area.ToString());
		if(inArea) {
			// If meow is a GameObject and it's name == Player
			if (meow is GameObject && meow.gameObject.name == "Player") {
				Debug.Log("MEOW");
			} else {
				Debug.Log(meow.GetType().ToString());
				Debug.Log((meow is GameObject) ? meow.gameObject.name.ToString() : "NOT A GAMEOBJECT");
			}
		}
	}
	
	public IEnumerable OnCollisionEnter( Collider col )
	{
		// Again, check if collider is a gameobject and the name is Player
		if (col is GameObject && col.gameObject.name == "Player") {
			this.BlastDistance();
			yield return new WaitForSeconds (0.1);
			Destroy(col.gameObject);
		} else {
			Debug.Log((col is GameObject) ? col.gameObject.name.toString() : "NOT A GAMEOBJECT");
		}
	}
}

Hi again, really sorry for not getting back to you sooner!
Below are your scripts which are fixed, just replace these in your project. The main issue was that the Player object was being destroyed before the Blast Trigger code was executed, so the Player object was no longer in the blast area. I have moved all the destroy code and particle instantiate into the “stuff” script, now called “Blast_Script”. The message triggers and everything works.
I have put a quick comment in your “Missile” script about the use of yields, and have reformatted your “controller” code. You might want to rename the “controller” script to something more specific like “Player_Controller_Script”, up to you though.
Again sorry for the delay, Geometry Wars 3 Dimensions took over my life for a couple of days… :D[36125-fixed+scripts.zip|36125]