27 lines
774 B
C#
27 lines
774 B
C#
using UnityEngine;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
public class ObjectSpawner : MonoSingleton<ObjectSpawner>
|
|
{
|
|
public GameObject InstantiateObject(GameObject prefab, Transform parent =null, bool setThisAsParent = true)
|
|
{
|
|
if (prefab == null)
|
|
{
|
|
BMLogger.LogError("ObjectSpawner::InstantiateObject, prefab is null");
|
|
return GameObject.CreatePrimitive(PrimitiveType.Cube);
|
|
}
|
|
if (setThisAsParent)
|
|
{
|
|
return Instantiate(prefab, transform);
|
|
}
|
|
return Instantiate(prefab, parent);
|
|
}
|
|
|
|
public void DestroyGameObject(GameObject go, float delayTime=0)
|
|
{
|
|
Destroy(go,delayTime);
|
|
}
|
|
}
|
|
}
|