i got this script to instantiate and destroy objects when a certain button is pressed, but somehow it won't work, it's not giving me errors, so i can't figure out what's wrong.. Here's the script:
var currentObject : Transform;
var idle : Transform;
var walk : Transform;
var run : Transform;
var jump : Transform;
var fight : Transform;
function Update ()
{
var currentPosition;
currentPosition = transform.TransformPoint(Vector3.zero);
}
//function Start ()
//{
// var obj = Instantiate(idle, transform.position, transform.rotation);
// obj.transform.parent=transform;
//}
if (Input.GetButton("Jump"))
{
//Destroy(idle.gameObject);
var obj = Instantiate(jump, transform.position, transform.rotation);
obj.transform.parent=transform;
}