mirror of
https://github.com/noakdsv/AtomCraft-2.28.git
synced 2025-02-12 08:49:47 +01:00
23 lines
618 B
C#
23 lines
618 B
C#
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!");
|
|
}
|
|
}
|
|
}
|