diff --git a/Editor/Tools/Networking/NetworkObject_Editor.cs b/Editor/Tools/Networking/NetworkObject_Editor.cs index 6e4da49..b3acbc9 100644 --- a/Editor/Tools/Networking/NetworkObject_Editor.cs +++ b/Editor/Tools/Networking/NetworkObject_Editor.cs @@ -1,5 +1,6 @@ using UnityEngine; using UnityEditor; +using UnityEditor.Build; #if UNITY_2021_2_OR_NEWER using UnityEditor.SceneManagement; #else @@ -9,7 +10,17 @@ using UnityEditor.Experimental.SceneManagement; namespace Passer { [InitializeOnLoad] - public class NetworkObject_Check { + public class NetworkObject_Check : IPreprocessBuildWithReport { + public int callbackOrder => 0; + + public void OnPreprocessBuild(UnityEditor.Build.Reporting.BuildReport report) { + NetworkObject[] networkObjects = Object.FindObjectsOfType(); + + foreach (NetworkObject networkObject in networkObjects) + CheckForNetworkObject(networkObject.gameObject); + } + + /// Check if this gameObject has the right network transform code static NetworkObject_Check() { NetworkObject[] networkObjects = Object.FindObjectsOfType();