Which i think works well, in unity now you have todo
GameObject prefab = Resources.Load("prefabName") as GameObject;
GameObject instance = Instantiate(prefab);
I think I prefer having a separation between GameObject and Prefab, to make it clear when the game object you have is an Asset and not a gameobject in the world.
Using it from a variable would be:
public AssetRef<Prefab> prefab;
public void Start();
{
GameObject instance = prefab.Instantiate();
}
And in Unity:
public GameObject prefab;
public void Start();
{
GameObject instance = Instantiate(prefab);
}
Prefabs are just GameObjects as Resources
The easiest API would be something like:
Which i think works well, in unity now you have todo
I think I prefer having a separation between GameObject and Prefab, to make it clear when the game object you have is an Asset and not a gameobject in the world.
Using it from a variable would be:
And in Unity: