Object will not instantiate at Transform.

Simple script, Has a game object (I attach whatever I want to have instantiated, as well as a Transfrom, (an empty game object who’s position I am using for the Instantiation starting position.)

#pragma strict

var resource : 		GameObject;
var spawnSocket : 	Transform;


function Start ()
{
	Instantiate(resource, spawnSocket.transform.position, transform.rotation);
}

This should be pretty straight forward, yet the object comes out of the position of the object this script is attached too, and not the “spawnSocket” empty game object position.

Am I missing something here?

try this and see if it works when it pauses the editor:

function Start ()
{
    var rs : GameObject;
    rs = Instantiate(resource, spawnSocket.position, transform.rotation);
    print("The spawn socket is at " + spawnSocket.position + ", but the resource is at " + rs.transform.position);
    Debug.Break();
}

If it is, and it pops back somewhere else on the next frame (or a few frames later), it’s being moved somewhere else in your scripts.

Upon further searching, I have discovered that this is an issue with Unity’s animation system being “locked” to world space. Meaning that when the animation is played, it snaps to the position you animated it too. This is why it appeared to be “ignoring” the Transform position.

The only fix for this, is to parent the animated object underneath another object.