using UnityEngine;

public class Utils {
	
	public static T Create<T>(Transform parent, Vector3 position) where T : MonoBehaviour{
		GameObject gameObject = new GameObject();
		gameObject.name = typeof(T).Name;
		gameObject.transform.parent = parent;
		gameObject.transform.localPosition = position;
		
		T component = gameObject.AddComponent<T>(); 
		return component;
	}
	
	public static T Create<T>(Transform parent) where T : MonoBehaviour{
		return Create<T>(parent, Vector3.zero);
	}
}

