VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
AVR_Behaviour_Editor.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEditor;
5 
6 using AVR.Core;
7 
8 namespace AVR.UEditor.Core
9 {
10  [CustomEditor(typeof(AVR_Behaviour), true)]
11  [CanEditMultipleObjects]
12  public class AVR_Behaviour_Editor : UnityEditor.Editor
13  {
14  public override void OnInspectorGUI()
15  {
16  DrawToolbar(target);
17 
18  DrawDefaultInspector();
19  }
20 
21  protected void DrawToolbar(object target)
22  {
23  try {
24  DrawToolbar(AVR.Core.Utils.Misc.GetAttribute<AVR.Core.Attributes.DocumentationUrl>(target.GetType()).getDocumentationUrl());
25  } catch(System.Exception) {
26  AVR_DevConsole.warn("Object does not have a DocumentationUrl set: " + target);
27  }
28  }
29 
30  protected virtual void DrawToolbar(string docu_url) {
31  EditorGUILayout.BeginHorizontal();
32 
33  // Documentation button
34  AVR.UEditor.Core.AVR_EditorUtility.Documentation_Url(docu_url);
35 
36  EditorGUILayout.EndHorizontal();
37  }
38  }
39 }
Monobehaviour but with an added URL button to a documentation page.
virtual void DrawToolbar(string docu_url)