UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a cube and make it fall"
using UnityEngine; public class FallingCube : MonoBehaviour { public GameObject cubePrefab; private GameObject cubeInstance; void Start() { // Create a cube at specified position Vector3 cubePosition = new Vector3(0, 10, 0); cubeInstance = Instantiate(cubePrefab, cubePosition, Quaternion.identity); // Add a Rigidbody component to the cube to make it fall cubeInstance.AddComponent<Rigidbody>(); } }