Scriptum/Assets/Scripts/Objects/GoldOre.cs

33 lines
692 B
C#
Raw Normal View History

2022-06-16 20:00:19 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GoldOre : MonoBehaviour
{
[SerializeField] public GameObject dropedItem;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void DropItem()
{
GameObject globalGUI = GameObject.FindGameObjectsWithTag("GUI")[0];
if(globalGUI)
{
Instantiate(dropedItem, gameObject.transform.position, Quaternion.identity, globalGUI.transform);
} else {
Debug.Log("Can't find global GUI object!!!");
}
}
}