summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/VersionCompatibilityUtility.cs
blob: 50ec535bbf42438ca3493790320a2f2d2577bfda (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

namespace UMotionEditor
{
    public static class VersionCompatibilityUtility
    {
        #if !UNITY_2017_4_OR_NEWER
        #error "This Unity version is not supported by UMotion. Please update to Unity 2017.4 or higher."
        #endif

        //********************************************************************************
        // Public Properties
        //********************************************************************************

        public enum EditorPlatform
        {
            Windows = 0,
            Mac,
            Linux,
            Invalid
        }

        public static EditorPlatform CurrentEditorPlatform
        {
            get
            {
                switch (Application.platform)
                {
                    case RuntimePlatform.WindowsEditor:
                        return EditorPlatform.Windows;

                    case RuntimePlatform.OSXEditor:
                        return EditorPlatform.Mac;

                    case RuntimePlatform.LinuxEditor:
                        return EditorPlatform.Linux;

                    default:
                        return EditorPlatform.Invalid;
                }
            }
        }

        public static bool Unity2018_1_OrNewer
        {
            get
            {
                #if UNITY_2018_1_OR_NEWER
                return true;
                #else
                return false;
                #endif
            }
        }

        public static bool Unity2018_3_OrNewer
        {
            get
            {
                #if UNITY_2018_3_OR_NEWER
                return true;
                #else
                return false;
                #endif
            }
        }

        public static bool Unity2019_1_Or_Newer
        {
            get
            {
                #if UNITY_2019_1_OR_NEWER
                return true;
                #else
                return false;
                #endif
            }
        }

        public static bool UsesScriptableRenderPipeline
        {
            get
            {
                #if UNITY_2019_1_OR_NEWER
                return (UnityEngine.Rendering.RenderPipelineManager.currentPipeline != null);
                #else
                #if UNITY_2018_1_OR_NEWER
                return (UnityEngine.Experimental.Rendering.RenderPipelineManager.currentPipeline != null);
                #else
                return false;
                #endif
                #endif
            }
        }

        public static string GetCurrentAssemblyName()
        {
            return Assembly.GetExecutingAssembly().GetName().Name;
        }

        //********************************************************************************
        // Private Properties
        //********************************************************************************

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

        //********************************************************************************
        // Private Methods
        //********************************************************************************
    }
}
#endif