- Home /
Making a gameobject a prefab using script without using UnityEditor
is there a way to make a gameobject a prefab using script without using UnityEditor?I tried "PrefabUtility.SaveAsPrefabAsset(room, "Assets/Resources/room.prefab");" and it works but when I build it it creates an error saying "error CS0103: The name 'PrefabUtility' does not exist in the current context"
thanks in advance
The UnityEditor namespace is not available in a build and you cannot create a prefab without the editor.
Answer by GoldenretriverYT · Aug 10, 2020 at 02:29 AM
No. Unity exports your assets in a bundled file that can not be edited in runtime. PrefabUtility is a class in UnityEditor, UnityEditor is not bundled when building your game, as the name already says.
What code can I replace PrefabUtility because I do not no how can I do,to that the game build in android phone.
Your answer
Follow this Question
Related Questions
Prefab Script List not being assigned as unique - can you see why? 1 Answer
How can i add all the prefabs in the assets directory and sub directories to List or Array ? 0 Answers
Saving Runtime Generated GameObjects to Prefabs 2 Answers
Scripted mesh combine with animation such as Armor, Clothing, etc. 0 Answers
Handling offline/onling saving support in a mobile game. 0 Answers