summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/EditorVersionCompatibilityUtility.cs
blob: 318bd59e65fab9c539b5b85d27fc4de1707182d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UnityEditor.Compilation;
#if UNITY_2018_3_OR_NEWER
using UnityEditor.Experimental.SceneManagement;
#endif

namespace UMotionEditor
{
	public static class EditorVersionCompatibilityUtility
	{
		//********************************************************************************
		// Public Properties
		//********************************************************************************

		//********************************************************************************
		// Private Properties
		//********************************************************************************
		
		//----------------------
		// Inspector
		//----------------------
		
		//----------------------
		// Internal
		//----------------------

		//********************************************************************************
		// Public Methods
		//********************************************************************************

        public static bool IsModelPrefab(GameObject gameObject)
        {
            #if UNITY_2018_3_OR_NEWER
            return (PrefabUtility.GetPrefabAssetType(gameObject) == PrefabAssetType.Model);
            #else
            return (PrefabUtility.GetPrefabType(gameObject) == PrefabType.ModelPrefab);
            #endif
        }

        public static bool IsPrefab(GameObject gameObject)
        {
            #if UNITY_2018_3_OR_NEWER
            return (PrefabUtility.GetPrefabAssetType(gameObject) != PrefabAssetType.NotAPrefab);
            #else
            return (PrefabUtility.GetPrefabType(gameObject) != PrefabType.None);
            #endif
        }

		public static bool IsInPrefabStage()
		{
			#if UNITY_2018_3_OR_NEWER
			return (PrefabStageUtility.GetCurrentPrefabStage() != null);
			#else
			return false;
			#endif
		}

		//********************************************************************************
		// Private Methods
		//********************************************************************************
		
	}
}