Answers for "unity how to what gameobject instantiate another"

C#
0

instantiate object inside of object Unity

// Makes the camera follow this object by
// making it a child of this transform.
 
// Get the transform of the camera
var cameraTransform = Camera.main.transform;    
 
// make it a child of the current object
cameraTransform.parent = transform;
 
// place it behind the current object
cameraTransform.localPosition = -Vector3.forward * 5;
 
// make it point towards the object
cameraTransform.LookAt(transform);
Posted by: Guest on June-08-2021
0

instantiate object inside of object Unity

var newObj = GameObject.Instantiate(somePrefabReference);
newObj.transform.parent = GameObject.Find("EmptyGameObject").transform;
Posted by: Guest on June-08-2021

Code answers related to "unity how to what gameobject instantiate another"

C# Answers by Framework

Browse Popular Code Answers by Language