VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
AVR_LocomotionProvider_Editor.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEditor;
5 
6 using AVR.Motion;
7 using AVR.Core;
8 
9 namespace AVR.UEditor.Motion {
10  [CustomEditor(typeof(AVR_LocomotionProvider))]
11  [CanEditMultipleObjects]
12  public class AVR_LocomotionProvider_Editor : AVR.UEditor.Core.AVR_Component_Editor
13  {
14  protected bool rigHasCharacterController = false;
15 
16  void OnEnable()
17  {
18  }
19 
20  public override void OnInspectorGUI()
21  {
22  DrawToolbar(target);
23 
24  AVR_PlayerRig rig = FindObjectOfType<AVR_PlayerRig>();
25  if(rig==null) {
26  EditorGUILayout.HelpBox("No AVR_PlayerRig object could be found!", MessageType.Error);
27  }
28  else if(rig.GetComponent<CharacterController>() == null) {
29  EditorGUILayout.HelpBox("Parent AVR_PlayerRig does not have a Charactercontroller component. AVR_LocomotionProvider requires a Charactercontroller to work.", MessageType.Warning);
30  if(GUILayout.Button("FIX NOW: Add Charactercontroller to "+rig.gameObject.name)) {
31  rig.gameObject.AddComponent<CharacterController>();
32  }
33  }
34 
35  DrawDefaultInspector();
36  }
37  }
38 }
Represents the players VR setup. Only one instance at a time is allowed.
Provides locomotion-movement to a controller.