0
votes

In my unity3D project I have a manager script that should take care of initializing a game level, instantiating and placing all relevant prefabs. However, I can't find a way to instantiate a prefab by its class - it turns out that "instantiate" really means something more like "clone" in Unity3D. So as a workaround, I had to make my manager script a MonoBehaviour, attach it to an empty object and assign my prefabs to it from the inspector since it is the only way I have found to make it work at all. This looks kind of awkward. Is there any way to actually instantiate a prefab, without cloning it from a reference?

1

1 Answers

1
votes

You can load prefabs at runtime. Just have a look at the script reference which comes with examples:

http://docs.unity3d.com/Documentation/ScriptReference/Resources.Load.html

Here is an article that should clarify how it works:

http://docs.unity3d.com/Documentation/Manual/LoadingResourcesatRuntime.html