- Home /
Changing Prefab Name through Code
So I have a system that is built to house dozens of very similar prefabs. But since they may differ on occasion, I would like that ever since I change something in the prefab, it's name would update also so It's easier to find through the search function if ever need comes. This updating doesn't need to be done ingame, and it's meant to be only used in the Editor.
I'll try to examplify what I'm trying to accomplish
Prefab Name: Wave
Difficulty 1 ID 19 Type Regular
Press Update Button
Prefab Name: Wave_D1_19_Regular
Can this be done?
Answer by Sergio7888 · Oct 11, 2016 at 07:47 PM
You can use AssetDatabase.RenameAsset.
Also look PrefabUtility for other prefab actions.
Thanks! I managed to solve myself by doing it the other way around. Using the Prefab's name to modify it's data if its simple enough. ;)
Your answer
Follow this Question
Related Questions
Editing a prefab with script wont apply changes 0 Answers
How to get original model prefab from an object a new prefab was created out of? 0 Answers
Is it possible to set a prefab as child of another in the Unity Editor 0 Answers
How to use custom file types as Unity assets 1 Answer
Running scripts from editor 1 Answer