Unity3D: Load Prefab dynamically

In Unity3D, there may be such a need: you want to instantiate a prefab, and the prefab is not in the scene. At this time, you need to create a Resources folder under Assets, and then drag the prefab that needs to be instantiated into this folder. And finally instantiate it like this in the code:

?
1
Instantiate(Resources.Load( "PrefabName" ), position, rotation)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326407216&siteId=291194637
Recommended