Skip to content

Commit 97a87a5

Browse files
committed
Fix support for Unity 2018.x
1 parent 1cdca4c commit 97a87a5

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

Assets/Editor Toolbox/Editor/Editors/ToolboxScriptedImporterEditor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
using UnityEditor;
2+
#if UNITY_2020_2_OR_NEWER
23
using UnityEditor.AssetImporters;
4+
#else
5+
using UnityEditor.Experimental.AssetImporters;
6+
#endif
37

48
namespace Toolbox.Editor.Editors
59
{
@@ -15,11 +19,12 @@ public sealed override void OnInspectorGUI()
1519
public virtual void DrawCustomInspector()
1620
{
1721
Drawer.DrawEditor(serializedObject);
22+
#if UNITY_2020_2_OR_NEWER
1823
if (extraDataType != null)
1924
{
2025
Drawer.DrawEditor(extraDataSerializedObject);
2126
}
22-
27+
#endif
2328
ApplyRevertGUI();
2429
}
2530

Assets/Editor Toolbox/Editor/ToolboxEditorSceneView.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ private static List<GameObject> GetObjectsUnderCursor()
3939

4040
private static void UpdateEventCallback()
4141
{
42+
#if UNITY_2019_1_OR_NEWER
4243
UnityEditor.SceneView.duringSceneGui -= SceneViewDuringSceneGUI;
4344

4445
if (UseToolboxSceneView)
4546
{
4647
UnityEditor.SceneView.duringSceneGui += SceneViewDuringSceneGUI;
4748
}
49+
#endif
4850
}
4951

5052
private static void SceneViewDuringSceneGUI(UnityEditor.SceneView sceneView)

Assets/Examples/Editor/SampleScriptedImporter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using UnityEditor.AssetImporters;
1+
#if UNITY_2020_2_OR_NEWER
2+
using UnityEditor.AssetImporters;
23
using UnityEngine;
34

45
[ScriptedImporter(1, "sample")]
@@ -11,4 +12,5 @@ public class SampleScriptedImporter : ScriptedImporter
1112

1213
public override void OnImportAsset(AssetImportContext ctx)
1314
{ }
14-
}
15+
}
16+
#endif
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
using Toolbox.Editor.Editors;
1+
#if UNITY_2020_2_OR_NEWER
2+
using Toolbox.Editor.Editors;
23
using UnityEditor;
34

45
[CustomEditor(typeof(SampleScriptedImporter))]
56
public class SampleScriptedImporterEditor : ToolboxScriptedImporterEditor
6-
{ }
7+
{ }
8+
#endif

0 commit comments

Comments
 (0)