本文共 699 字,大约阅读时间需要 2 分钟。
[ContextMenu("保存灯光配置")] void SaveLightObject() { DictionarylightPaths = new Dictionary { { "light_uicar", "Assets/Prefabs/SceneObjs/light_uicar.prefab" }, { "light_uimain", "Assets/Prefabs/SceneObjs/light_uimain.prefab" } }; foreach (var pair in lightPaths) { GameObject go = UnityEngine.GameObject.Find(pair.Key); if (go == null) { Debug.Log($"{pair.Key} not found"); continue; } UnityEditor.PrefabUtility.SaveAsPrefabAssetAndConnect(go, pair.Value, UnityEditor.InteractionMode.UserAction); Debug.Log($"{pair.Value} saved!"); } }
转载地址:http://teszb.baihongyu.com/