Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- /*
- * Compatibility helper for using spine-unity (as of Aug. 1 2016)
- * with Unity 4.x
- */
- namespace UnityEngine
- {
- public static class GUILayoutExtensions
- {
- /// <summary>
- /// Creating dummy placeholders for elements not present in Unity4, but present in Unity5.
- /// </summary>
- public static object EditorStyles_HelpBox(this GUIStyle style)
- {
- return null;
- }
- }
- /// <summary>
- /// Wrapper for GUILayout static class, implementing some Using functionality present in Unity5 but not Unity4.
- /// </summary>
- public class GUILayoutWrapper : IDisposable
- {
- public enum EType
- {
- Horizontal,
- Vertical
- }
- public EType Type { get; private set; }
- public GUILayoutWrapper(EType type, params object [] args)
- {
- Type = type;
- switch (type)
- {
- case EType.Horizontal:
- GUILayout.BeginHorizontal();
- break;
- case EType.Vertical:
- GUILayout.BeginVertical();
- break;
- }
- }
- public void Dispose()
- {
- switch (Type)
- {
- case EType.Horizontal:
- GUILayout.EndHorizontal();
- break;
- case EType.Vertical:
- GUILayout.EndVertical();
- break;
- }
- }
- }
- }
- /// <summary>
- /// Wrapper for EditorGUI static class, implementing some Using functionality present in Unity5 but not Unity4.
- /// </summary>
- namespace UnityEditor
- {
- public class EditorGUIWrapper : IDisposable
- {
- public enum EType
- {
- DisabledGroup
- }
- public EType Type { get; private set; }
- public EditorGUIWrapper(EType type, params object [] args)
- {
- Type = type;
- switch (Type)
- {
- case EType.DisabledGroup:
- EditorGUI.BeginDisabledGroup((bool)args[0]);
- break;
- }
- }
- public void Dispose()
- {
- switch (Type)
- {
- case EType.DisabledGroup:
- EditorGUI.EndDisabledGroup();
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement