using System.Collections; using System.Collections.Generic; using UnityEngine; public class ButtonSphereInstantiation : MonoBehaviour { public GameObject spherePrefab; // Reference to the prefab of the sphere public void OnButtonPress() { // Check if the prefab is assigned if (spherePrefab != null) { // Instantiate the sphere at the position of the button with no rotation Instantiate(spherePrefab, transform.position, Quaternion.identity); } else { Debug.LogError("Sphere prefab is not assigned!"); } } }