Closed BattlehubCode closed 1 year ago
When removing the problematic line RenderPipelineInfo.UseForegroundLayerForUI = false;
I see that the script just does not change layout in WebGL build. While works correctly when launched in editor.
using Battlehub.RTCommon;
using Battlehub.RTEditor;
using Battlehub.UIControls.DockPanels;
using UnityEngine;
/// <summary>
/// Initializes the runtime editor with a minimal layout and a scene with no header and frame
/// </summary>
public class BasicLayout : LayoutExtension
{
protected override void OnInit()
{
Debug.Log("Initializing BasicLayout");
base.OnInit();
//Disable foreground ui layer.
//Better in terms of performance, but does not allow to switch SceneWindow and GameWindow to "floating" mode when using UnversalRP or HDRP
//RenderPipelineInfo.UseForegroundLayerForUI = false;
//Hide main menu and footer
IRTEAppearance appearance = IOC.Resolve<IRTEAppearance>();
Debug.Log($"Initializing BasicLayout: appearance found: {appearance}");
appearance.IsMainMenuActive = false;
appearance.IsFooterActive = false;
appearance.IsUIBackgroundActive = false;
}
protected override void OnRegisterWindows(IWindowManager wm)
{
Debug.Log("BasicLayout OnRegisterWindows");
}
protected override void OnBeforeBuildLayout(IWindowManager wm)
{
Debug.Log("BasicLayout OnBeforeBuildLayout");
//Hide header toolbar
wm.OverrideTools(null);
}
protected override LayoutInfo GetLayoutInfo(IWindowManager wm)
{
Debug.Log("BasicLayout GetLayoutInfo");
//Initializing a layout with one window - Scene
LayoutInfo layoutInfo = wm.CreateLayoutInfo(BuiltInWindowNames.Scene);
layoutInfo.IsHeaderVisible = false;
return layoutInfo;
}
}
Unable to reproduce, Unity 2020.3.43, Universal RP, Scene 1 - Minimal, Scene 80 - Terrain Editor
Hi. I am build a WebGL build. In runtime it throws the following exception on loadind, after I set RenderPipelineInfo.UseForegroundLayerForUI = false; NullReferenceException: Object reference not set to an instance of an object.
at Battlehub.RTCommon.URP.CameraUtilityURP.RequiresDepthTexturlue (UnityEngine.Camera camera, System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTTerrain.TerrainAreaTool.CreateHandle (Battlehub.RTCommon.RuntimeWindow scene) [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.Demo.CustomHandleExtensiond__85.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.MonoBehaviour.StartCoroutineManaged2 (System.Collections.IEnumerator enumerator) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) [0x00000] in <00000000000000000000000000000000>:0
at Battlehub.RTEditor.RuntimeEditor.Battlehub.RTCommon.IRTE.StartCoroutine (System.Collections.IEnumerator method) [0x00000] in <00000000000000000000000000000000>:0
at Battlehub.RTEditor.Workspace.SetLayout (System.Func
1[T].CreateHandle (UnityEngine.Transform windowTransform) [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.Demo.CustomHandleExtension
1[T].OnAfterLayout (Battlehub.RTEditor.IWindowManager wm) [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.WindowManager.OnAfterLayout (Battlehub.RTEditor.Workspace obj) [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.Workspace+2[T,TResult] buildLayoutCallback, System.String activateWindowOfType) [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.Workspace.SetDefaultLayout () [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.WindowManager.SetDefaultLayout () [0x00000] in <00000000000000000000000000000000>:0 at Battlehub.RTEditor.WindowManager.Start () [0x00000] in <00000000000000000000000000000000>:0 UnityEngine.MonoBehaviour:StartCoroutineManaged2(IEnumerator) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) Battlehub.RTEditor.RuntimeEditor:Battlehub.RTCommon.IRTE.StartCoroutine(IEnumerator) Battlehub.RTEditor.Workspace:SetLayout(Func
2, String) Battlehub.RTEditor.Workspace:SetDefaultLayout() Battlehub.RTEditor.WindowManager:SetDefaultLayout() Battlehub.RTEditor.WindowManager:Start()Is that a fixable problem?