Files
HauntedBloodlines/Assets/HTraceWSGI/Scripts/PipelinesConfigurator/HMenuAndFilesManager.cs
2025-05-29 22:31:40 +03:00

52 lines
1.4 KiB
C#

#if UNITY_EDITOR
using UnityEngine;
using Debug = UnityEngine.Debug;
using UnityEditor;
namespace HTraceWSGI.Scripts.PipelinesConfigurator
{
public class HMenuAndFilesManager : EditorWindow
{
[MenuItem("GameObject/Rendering/HTrace World Space Global Illumination", false, priority: 30)]
static void CreateHTraceGameObject(MenuCommand menuCommand)
{
HTraceWSGI[] hTraces = FindObjectsOfType(typeof(HTraceWSGI)) as HTraceWSGI[];
if (hTraces != null && hTraces.Length > 0)
{
Debug.Log("Can't create HTrace, because the scene already contains HTrace instance");
return;
}
GameObject go = new GameObject("HTraceWSGI");
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
go.AddComponent<HTraceWSGI>();
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
Selection.activeObject = go;
}
[MenuItem("Window/HTrace/HTrace WSGI Open documentation", false)]
private static void OpenDocumentation()
{
Application.OpenURL("https://ipgames.gitbook.io/htrace-wsgi");
}
// Rect buttonRect;
// private void OnGUI()
// {
// {
// GUILayout.Label("Editor window with Popup example", EditorStyles.boldLabel);
// if (GUILayout.Button("Popup Options", GUILayout.Width(200)))
// {
// PopupWindow.Show(buttonRect, new PopupExample());
// }
// if (Event.current.type == EventType.Repaint) buttonRect = GUILayoutUtility.GetLastRect();
// }
// }
}
}
#endif