calling variable out of a function

I want to call a variable in a function update, but that variable is locked in function start, how do i call this variable now??

Could you post some code so that we can see what is happening?

i want to call idle1 inside function update so now it must be clear :wink:

var currentObject : Transform;

var idle : Transform;
var walk : Transform;
var run : Transform;
var jump : Transform;
var fight : Transform;

var destroyDelay = 5;
public function Start () 
{
	var idle1 = Instantiate(idle, transform.position, transform.rotation);
	idle1.transform.parent=transform;
	
	var jump1 = Instantiate(jump, transform.position, transform.rotation);
	jump1.transform.parent=transform;
		
	var run1 = Instantiate(run, transform.position, transform.rotation);
	run1.transform.parent=transform;
		
	var walk1 = Instantiate(walk, transform.position, transform.rotation);
	walk1.transform.parent=transform;
		
	var fight1 = Instantiate(fight, transform.position, transform.rotation);
	fight1.transform.parent=transform;
	
	jump1.gameObject.active= false;
	run1.gameObject.active= false;
	walk1.gameObject.active= false;
	fight1.gameObject.active= false;
}
function Update ()
{
	if (Input.GetButtonDown("Jump")) 
	{

		idle1.gameObject.active= false;
		jump1.gameObject.active= true;
		
	}
}

That makes no sense, idle1 does not exist when Update is called.

then how do i fix it… or what other method can i use??

I would recommend reading about heaps and stacks first, because it’s fundamental to programming and will be quite handy to understand. Once you exit Start(), any variable declared in that method is no longer valid.

okay than let me ask it like this: As you can see almost all the instantiated objects are deactivated, how can i make them active again when a button is pressed

Find them somehow, this is in the docs, then set them to active, which is also in the docs.