UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a cube"
using UnityEngine; public class CreateCube : MonoBehaviour { public GameObject cubePrefab; // Start is called before the first frame update void Start() { // Instantiate the cube at the current position of the script's GameObject GameObject cube = Instantiate(cubePrefab, transform.position, Quaternion.identity); // Set the cube as a child of the script's GameObject cube.transform.SetParent(transform); } }