CD-ROOM/Assets/NavMesh/Tests/Editor/PrefabSavingUtil.cs
Gerard Gascón 341a877b4a init
2025-04-24 17:37:25 +02:00

18 lines
546 B
C#

using System;
using System.Reflection;
using UnityEditor.Experimental.SceneManagement;
public class PrefabSavingUtil {
public static void SavePrefab(PrefabStage prefabStage)
{
if (prefabStage == null)
throw new ArgumentNullException();
var savePrefabMethod = prefabStage.GetType().GetMethod("SavePrefab", BindingFlags.NonPublic | BindingFlags.Instance);
if (savePrefabMethod == null)
throw new InvalidOperationException();
savePrefabMethod.Invoke(prefabStage, null);
}
}