N
N
NeoLight32020-07-21 16:39:12
Unity
NeoLight3, 2020-07-21 16:39:12

How to instantiate a GameObject from a .prefab file in C#?

There is a .prefab file, how can I instantiate it?
For example, prefabs in Resources can be instantiated using the function:

UnityEngine.Object.Instantiate((GameObject)(Resources.Load(string.Concat("prefabs/game/civilianZombie_1"))));

However, this function takes a GameObject as one of its parameters, how can I create a GameObject variable that contains my prefab from the .prefab file?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question