fix 2019 deprecation warnings

This commit is contained in:
BlackMATov
2021-01-08 15:05:45 +07:00
parent 93baf5e7e9
commit 795da42197

View File

@@ -57,14 +57,12 @@ namespace FTEditor.Editors {
if ( clip_go ) { if ( clip_go ) {
var prefab_path = GetPrefabPath(clip); var prefab_path = GetPrefabPath(clip);
if ( !string.IsNullOrEmpty(prefab_path) ) { if ( !string.IsNullOrEmpty(prefab_path) ) {
var prefab = AssetDatabase.LoadMainAssetAtPath(prefab_path); prefab_path = AssetDatabase.GenerateUniqueAssetPath(prefab_path);
if ( !prefab ) { #if UNITY_2018_3_OR_NEWER
prefab = PrefabUtility.CreateEmptyPrefab(prefab_path); result = PrefabUtility.SaveAsPrefabAsset(clip_go, prefab_path);
} #else
result = PrefabUtility.ReplacePrefab( result = PrefabUtility.CreatePrefab(prefab_path, clip_go);
clip_go, #endif
prefab,
ReplacePrefabOptions.ConnectToPrefab);
} }
GameObject.DestroyImmediate(clip_go, true); GameObject.DestroyImmediate(clip_go, true);
} }