My animated object works when in animation mode, but disappears in the scene mode.

So, I’ve made a sword and made a script like this one :

#pragma strict

var TheDammage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var TheSword : Transform;

function Update ()
{
if (Input.GetButtonDown(“Fire1”))
{
//Attack animation
TheSword.animation.Play(“attack”);
//Attack function
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection (Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage(“ApplyDammage”, TheDammage, SendMessageOptions.DontRequireReceiver);
}
}
}
if (TheSword.animation.isPlaying == false)
{
TheSword.animation.CrossFade(“idle”);
}
if (Input.GetKey (KeyCode.LeftShift))
{
TheSword.animation.CrossFade(“sprint”);
}
if (Input.GetKeyUp(KeyCode.LeftShift))
{
TheSword.animation.CrossFade(“idle”);
}
}

Now, the sword works correctly, all the animations load when needed… but I want to change the animations, and I can’t ! In the scene menu, the sword is around god-knows-where (completely random place, UNDER all my scenery etc) and when I drag it back to where I want it to be… it disappears.

This sounds like the dreaded “animations sometimes lock an asset in world space” problem. Try parenting it to an empty game object and move that instead.

I’m a total newb, so I am not entirely sure what parenting is, but i guess it’s that drag-and-drop sequence to make an object have that drop-down arrow, isn’t it ? If that’s so, I’ve attached both the sword to a random cube and the cube to the sword, with no effect.

Okay, I fixed this thanks to Brackeys, definetly reccomend checking him out !