script wont re activate object when my conditions are met

What i am trying to do is set whether or not an object should be simulateded. If a player is within 100 units it should render and simulate the rigidbody, if not then it should disable the game object. However when i try to reactivate it will not work.

@HideInInspector
var PO : GameObject;
@HideInInspector
var D: Vector3;
@HideInInspector
var rendered : boolean = true;
@HideInInspector
var CT : float;

var RenderDistance : float = 100;
var CheckTime : float = 2;

function Awake()
{
	PO = GameObject.FindGameObjectWithTag("Player");	
}

function Update () 
{
	
	CT += Time.deltaTime;
	if(CT >= CheckTime)
	{
		D = GameObject.FindGameObjectWithTag("DistanceProbe").GetComponent("PlayerDistanceMonitor").PlayerPosition;
		
		if(Vector3.Distance(transform.position, D) > RenderDistance)
		{
			gameObject.active = false;
		}
		
		if(Vector3.Distance(transform.position, D) < RenderDistance)
		{
			Debug.LogError("This is still working");
			gameObject.active = true; //however this isnt
			
		}
	}
	
}

I have tried this also by just disabling the physics constraints and renderer. But when it reactivates the mesh renderer does not activate also… Any ideas?

Are you using Unity 4? If so, .active isn’t something you’re going to want to use. As discussed in THIS question, .active probably isn’t going to work right. You can find more information about this HERE (a forum post discussing .active in Unity 4) as well as HERE (I think it’s a blog, but it goes over some more details).