public static Entity CreateEntity(GameObject prefab, bool addToGame = true, bool initialize = true) { GameObject gameObject = Instantiate(prefab); Entity entity = gameObject.GetComponent <Entity>(); entity.DoCreated(); if (initialize) { entity.DoInitialize(); } if (addToGame) { entity.AddToGame(); } return(entity); }