From 5ca98dfca8a9d2c3292ecf177b67d0f46b28f27b Mon Sep 17 00:00:00 2001 From: Nukadelic Date: Thu, 19 Mar 2020 03:11:38 +0700 Subject: [PATCH] build support --- Scripts/Editor/Baker.cs | 6 +++++- Scripts/Editor/Editor.cs | 6 +++++- Scripts/Editor/EditorUtils.cs | 11 ++++++++++- Scripts/Editor/LightmapEditorData.cs | 6 +++++- Scripts/Editor/PanelComponentsOverride.cs | 6 +++++- Scripts/Editor/Window.cs | 7 +++++-- 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Scripts/Editor/Baker.cs b/Scripts/Editor/Baker.cs index 7f38d25..7e82587 100644 --- a/Scripts/Editor/Baker.cs +++ b/Scripts/Editor/Baker.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +#if UNITY_EDITOR + +using System.Collections.Generic; using UnityEditor; using UnityEngine; using UnityEngine.SceneManagement; @@ -233,3 +235,5 @@ static SceneLightmap SaveSceneLightmap( int lightmap_index, string name ) } } } + +#endif \ No newline at end of file diff --git a/Scripts/Editor/Editor.cs b/Scripts/Editor/Editor.cs index 83bd4f5..f8d46b4 100644 --- a/Scripts/Editor/Editor.cs +++ b/Scripts/Editor/Editor.cs @@ -1,4 +1,6 @@ -using UnityEngine; +#if UNITY_EDITOR + +using UnityEngine; using UnityEditor; namespace PrefabLightMapBaker @@ -158,3 +160,5 @@ void DrawTextures( Texture2D[] textures, ref Vector2 scroll ) } } } + +#endif \ No newline at end of file diff --git a/Scripts/Editor/EditorUtils.cs b/Scripts/Editor/EditorUtils.cs index a7be337..888fa0c 100644 --- a/Scripts/Editor/EditorUtils.cs +++ b/Scripts/Editor/EditorUtils.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +#if UNITY_EDITOR + +using System.Collections.Generic; using System.Linq; using UnityEditor; using UnityEngine; @@ -177,6 +179,11 @@ public static void UpdatePrefab( GameObject prefab ) public static Texture2D SaveLightmapAsset( string copyFrom, string saveTo ) { + if( saveTo.Contains(Application.dataPath) ) + { + saveTo.Replace( Application.dataPath, "" ); + } + UpdateAsset( copyFrom ); var importer = AssetImporter.GetAtPath( copyFrom ) as TextureImporter; importer.isReadable = true; @@ -279,3 +286,5 @@ public static void Reset( PrefabBaker prefab ) } } } + +#endif \ No newline at end of file diff --git a/Scripts/Editor/LightmapEditorData.cs b/Scripts/Editor/LightmapEditorData.cs index e26e1c0..55db098 100644 --- a/Scripts/Editor/LightmapEditorData.cs +++ b/Scripts/Editor/LightmapEditorData.cs @@ -1,4 +1,6 @@ -using System; +#if UNITY_EDITOR + +using System; using System.Linq; using System.Reflection; using System.Collections.Generic; @@ -65,3 +67,5 @@ public static void SetProfileQuickBake() } } } + +#endif \ No newline at end of file diff --git a/Scripts/Editor/PanelComponentsOverride.cs b/Scripts/Editor/PanelComponentsOverride.cs index 59647d7..5c675b1 100644 --- a/Scripts/Editor/PanelComponentsOverride.cs +++ b/Scripts/Editor/PanelComponentsOverride.cs @@ -1,4 +1,6 @@ -using System; +#if UNITY_EDITOR + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -56,3 +58,5 @@ public static void Apply( GameObject root ) } } } + +#endif \ No newline at end of file diff --git a/Scripts/Editor/Window.cs b/Scripts/Editor/Window.cs index 30b79f3..b442dde 100644 --- a/Scripts/Editor/Window.cs +++ b/Scripts/Editor/Window.cs @@ -1,4 +1,5 @@ - +#if UNITY_EDITOR + using System.IO; using System.Linq; using System.Collections.Generic; @@ -399,4 +400,6 @@ bool FolderGUI() #endregion // ---------------------------- } -} \ No newline at end of file +} + +#endif \ No newline at end of file