public static void ReplacePrefab(GameObject gameObject, string assetPath, MB_ReplacePrefabOption replacePrefabOptions) { if (_MBVersion == null) { _MBVersion = _CreateMBVersionConcrete(); } _MBVersion.ReplacePrefab(gameObject, assetPath, replacePrefabOptions); }
public void ReplacePrefab(GameObject gameObject, string assetPath, MB_ReplacePrefabOption replacePrefabOptions) { #if UNITY_2018_3_OR_NEWER PrefabUtility.SaveAsPrefabAssetAndConnect(gameObject, assetPath, InteractionMode.AutomatedAction); #else GameObject obj = (GameObject)AssetDatabase.LoadAssetAtPath(assetPath, typeof(GameObject)); PrefabUtility.ReplacePrefab(gameObject, obj, (ReplacePrefabOptions)replacePrefabOptions); #endif }
public static void ReplacePrefab(GameObject gameObject, string assetPath, MB_ReplacePrefabOption replacePrefabOptions) { GetInstance().ReplacePrefab(gameObject, assetPath, replacePrefabOptions); }