Tanoda
TriLibImporterEditor.cs
Go to the documentation of this file.
1#pragma warning disable CS0105
2using System;
3using UnityEditor;
4using UnityEditor.Experimental.AssetImporters;
5using Object = UnityEngine.Object;
6#if UNITY_2020_2_OR_NEWER
7using UnityEditor.AssetImporters;
8#else
9using UnityEditor.Experimental.AssetImporters;
10#endif
11namespace TriLibCore.Editor
12{
13 [CustomEditor(typeof(TriLibScriptedImporter))]
14 public class TriLibImporterEditor : ScriptedImporterEditor
15 {
16 private int _currentTab;
17
18 protected override Type extraDataType => typeof(AssetLoaderOptions);
19
20 protected override void InitializeExtraDataInstance(Object extraData, int targetIndex)
21 {
22 var scriptedImporter = (TriLibScriptedImporter) target;
23 var existingAssetLoaderOptions = scriptedImporter.AssetLoaderOptions;
24 EditorUtility.CopySerializedIfDifferent(existingAssetLoaderOptions, extraData);
25 }
26
27 protected override void Apply()
28 {
29 base.Apply();
30 var assetLoaderOptions = (AssetLoaderOptions) extraDataTarget;
31 var scriptedImporter = (TriLibScriptedImporter) target;
32 scriptedImporter.AssetLoaderOptions = assetLoaderOptions;
33 }
34
35 public override void OnInspectorGUI()
36 {
37 AssetLoaderOptionsEditor.ShowInspectorGUI(extraDataSerializedObject, ref _currentTab);
38 ApplyRevertGUI();
39 }
40 }
41}
TriLibCore.AssetLoaderOptions AssetLoaderOptions
Definition: TriLibLoader.cs:9
static void ShowInspectorGUI(SerializedObject serializedObject, ref int currentTab)
override void InitializeExtraDataInstance(Object extraData, int targetIndex)
UnityEngine.Object Object