Turn off Object and children - scripting noob please take pity

Ok this is prbably the easiest thing in the world to you hardcore scripters but I suck real bad at coding

.I have a million art related tasks to complete today and have already wasted hours on this one so would much appreciate any input.

Basically i just need a script to turn off an obejct (called “PTPropLift”) and all of its children at startup.

Here you can see my previous attemps at getting it to work, im sure the correct code is in there somewhere!

//var proposal = ("PTPropLift");
//var proposal = GetComponentsInChildren(Renderer);


function Start () {

	//GameObject.Find("PTPropLift"): GetComponentsInChildren(Renderer);

//var proposal = GameObject.Find("PTPropLift");
//var proprender = proposal.GetComponentsInChildren(Renderer);

//var proprender = proposal.GetComponentsInChildren(Renderer);
//proposal.enabled = false;

//var ObjectToSwap2 = GameObject.Find("PTPropLift");

	//GameObject.Find("PTPropLift");

//GetComponentsInChildren.enabled = false;

//Object1.renderer.enabled = false;

}

You want to turn off the gameobject and all gameobjects under it.

function Start() {
     var go : GameObject = GameObject.Find("PTPropLift");
     if (go)
          go.SetActiveRecursively(false);
}

Look up SetActiveRecursively in the docs.

Thanks for the reply!

This may take this thread in a completly different direction but what I need to achieve is toggling a proposed (PTPropLift) and existing (ExistingMaster) object on/off using a gui button.

The proposal needs to be deactivated at startup and the colliders also need to toggle on/off with the relative object.

Currently I using the following script which works great apart from the fact that at the start both objects are visible and collision is still enabled on the invisible objects.

Any ideas? This is way beond my coding expertise.

Cheers

var Object1 = "ExistingMaster";
var Object2 = "PTPropLift";
var ButtonLabel = "";
var ButtonX = 120;
var ButtonY = 40;
var ButtonWidth = 80;
var ButtonHeight = 20;

function OnGUI ()
{
	if (ButtonLabel == "")
	{
		ButtonLabel = "Toggle";
	}
	var ObjectToSwap1 = GameObject.Find("ExistingMaster");
	var SwapRenderer1 = ObjectToSwap1.GetComponentsInChildren(Renderer);
	var ObjectToSwap2 = GameObject.Find("PTPropLift");
	var SwapRenderer2 = ObjectToSwap2.GetComponentsInChildren(Renderer);
	if (GUI.Button (Rect (ButtonX,ButtonY,ButtonWidth,ButtonHeight), ButtonLabel))
		{
			for (var eachRenderer1 in SwapRenderer1)
			for (var eachRenderer2 in SwapRenderer2)
			
	{
			if (eachRenderer1  eachRenderer2)
		{
			eachRenderer1.enabled = !eachRenderer1.enabled;
			eachRenderer2.enabled = !eachRenderer1.enabled; //set from Renderer1, so that there is always exactly one activated
		}
		else
		{
			print("Error finding objects");
		}
	}
}

}

try this (code in C#)

void Start() 
{

	GameObject go = GameObject.Find("PTPropLift");
	if (go != null) SetRendererRecursive(go.transform, false);
}

public void SetRendererRecursive(Transform tr, bool enabled)
{
	Renderer r = tr.GetComponent<Renderer>();
	if (r != null) r.enabled = enabled;

	if (tr.childCount == 0) return;
	for (int i = 0; i < tr.childCount; i++)
	{
		SetRendererRecursive(tr.GetChild(i).transform, enabled);			
	}
}