NRSessionBehaviourEditor.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. using UnityEngine;
  10. using UnityEditor;
  11. namespace NRKernal
  12. {
  13. [CustomEditor(typeof(NRSessionBehaviour))]
  14. public class NRSessionBehaviourEditor : Editor
  15. {
  16. SerializedProperty LogLevel;
  17. SerializedProperty SessionConfig;
  18. private void OnEnable()
  19. {
  20. // Setup the SerializedProperties
  21. LogLevel = serializedObject.FindProperty("LogLevel");
  22. SessionConfig = serializedObject.FindProperty("SessionConfig");
  23. }
  24. override public void OnInspectorGUI()
  25. {
  26. NRSessionBehaviour sessionBehav = (NRSessionBehaviour)target;
  27. serializedObject.Update();
  28. EditorGUILayout.PropertyField(LogLevel);
  29. EditorGUILayout.PropertyField(SessionConfig);
  30. EditorGUILayout.Space();
  31. // if (GUILayout.Button("Open NRSDK Configuration"))
  32. // {
  33. // Selection.activeObject = NRProjectConfigHelper.GetProjectConfig();
  34. // }
  35. // Apply values to the target
  36. serializedObject.ApplyModifiedProperties();
  37. //Provide link to the unique NRProjectConfig
  38. if (GUILayout.Button("Open NRProjectConfig"))
  39. {
  40. Selection.activeObject = (sessionBehav.SessionConfig).GlobalProjectConfig;
  41. }
  42. }
  43. }
  44. }