bulletSpawn = transform.Find (“bulletSpawn”);
How do i make my bulletSpawn become a parent of something
bulletSpawn = transform.Find (“bulletSpawn”);
How do i make my bulletSpawn become a parent of something
Transform.parent does the trick. The documentation provides an example, so it shouldn’t be difficult to adapt it to your situation.
You need to use Transform.parent.
var parent : Transform;
var bulletSpawn : Transform;
function Start () {
bulletSpawn = transform.Find("bulletSpawn");
bulletSpawn.parent = parent;
}
Edit: Thanks to schnaddlbraag for pointing out that the above example makes the bulletSpawn a child of the parent object. If you want to do the reverse, use
var child : Transform;
var bulletSpawn : Transform;
function Start () {
bulletSpawn = transform.Find("bulletSpawn");
child.parent = bulletSpawn;
}