feat: HTrace WSGI in der Lobby-Szene deaktivieren
Scene-Component HTraceLobbyToggle (in Main) hoert auf additive Szenen-Events und schaltet die HTraceWSGI-Component aus, solange die Lobby geladen ist, sonst an. Lobby-Szenenname im Inspector konfigurierbar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
cdd9fa9532
commit
0128203160
3 files changed
+124
-62
No files matched your search
+55
-62
@@ -23,7 +23,7 @@ RenderSettings:
|
||||
m_AmbientSkyColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 0.75
|
||||
m_AmbientIntensity: 0.6
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
@@ -35,8 +35,8 @@ RenderSettings:
|
||||
m_DefaultReflectionMode: 1
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 0.75
|
||||
m_CustomReflection: {fileID: 957840355}
|
||||
m_ReflectionIntensity: 0.4
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
@@ -4751,6 +4751,51 @@ MonoBehaviour:
|
||||
pointDistanceRange: {x: 1, y: 20}
|
||||
fadeInSpeed: 6
|
||||
fadeOutSpeed: 4
|
||||
--- !u!1 &803506598
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 803506600}
|
||||
- component: {fileID: 803506599}
|
||||
m_Layer: 0
|
||||
m_Name: HTrace Lobby Toggle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &803506599
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 803506598}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 57dab8a6b4fe83c4fa79b6acf54bf25b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::HTraceLobbyToggle
|
||||
lobbySceneName: Lobby
|
||||
--- !u!4 &803506600
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 803506598}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &836612744
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5817,59 +5862,6 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 935933056}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!89 &957840355
|
||||
Cubemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: SkyboxReflection (generated)
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 4
|
||||
m_Width: 128
|
||||
m_Height: 128
|
||||
m_CompleteImageSize: 87380
|
||||
m_MipsStripped: 0
|
||||
m_TextureFormat: 4
|
||||
m_MipCount: 8
|
||||
m_IsReadable: 1
|
||||
m_IsPreProcessed: 0
|
||||
m_IgnoreMipmapLimit: 0
|
||||
m_MipmapLimitGroupName:
|
||||
m_StreamingMipmaps: 0
|
||||
m_StreamingMipmapsPriority: 0
|
||||
m_VTOnly: 0
|
||||
m_AlphaIsTransparency: 0
|
||||
m_ImageCount: 6
|
||||
m_TextureDimension: 4
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 1
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_LightmapFormat: 0
|
||||
m_ColorSpace: 1
|
||||
m_PlatformBlob:
|
||||
image data: 524280
|
||||
_typelessdata: 5a7195ff5a7195ff5a7095ff597095ff597094ff597094ff597094ff597094ff596f94ff596f94ff586f93ff586f93ff586f93ff586f93ff586e93ff586e92ff576e92ff576e92ff576e92ff576d92ff576d91ff566d91ff566d91ff566d91ff576d91ff576d91ff576d92ff576d92ff576d92ff576d92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e93ff576e93ff576e93ff576e93ff586e93ff586e93ff586e93ff586f93ff586f93ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f95ff586f95ff586f95ff586f95ff596f95ff597095ff597095ff597095ff597095ff597095ff597096ff597096ff597096ff597197ff5a7197ff5a7197ff5a7198ff5a7298ff5a7298ff5b7298ff5b7299ff5b7399ff5b7399ff5b7399ff5c739aff5c749aff5c749bff5c749bff5c749bff5d759bff5d759cff5d759cff5d759cff5d759cff5d759cff5e769dff5e769dff5e769dff5e769dff5e779eff5e779eff5f779eff5f779eff5f779eff5f779fff5f789fff5f789fff5f78a0ff6078a0ff6078a0ff6078a0ff6079a0ff6079a1ff6179a1ff617aa1ff617aa2ff617aa2ff627ba3ff627ba3ff627ba3ff637ca4ff637ca4ff637ca4ff637da5ff647da5ff647da5ff647da6ff647ea6ff657ea7ff657ea7ff657fa7ff657fa8ff667fa8ff667fa8ff5a7196ff5a7195ff5a7195ff5a7195ff5a7095ff597095ff597095ff597094ff597094ff597094ff596f94ff596f94ff586f93ff586f93ff586f93ff586f93ff586e93ff586e92ff576e92ff576e92ff576e92ff576d92ff576d92ff576d91ff576d91ff576d92ff576d92ff576d92ff576d92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e93ff576e93ff576e93ff576e93ff586e93ff586e93ff586e93ff586f93ff586f93ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f95ff586f95ff586f95ff596f95ff596f95ff597095ff597095ff597095ff597095ff597095ff597096ff597096ff597096ff597096ff597196ff5a7197ff5a7197ff5a7197ff5a7298ff5a7298ff5b7298ff5b7299ff5b7399ff5b7399ff5b7399ff5c739aff5c749aff5c749aff5c749bff5c749bff5d749bff5d759bff5d759cff5d759cff5d759cff5d759cff5e769dff5e769dff5e769dff5e769dff5e769eff5e779eff5f779eff5f779eff5f779eff5f779fff5f789fff5f789fff5f78a0ff6078a0ff6078a0ff6078a0ff6079a0ff6079a1ff6179a1ff617aa1ff617aa2ff617aa2ff627ba3ff627ba3ff627ba3ff637ca4ff637ca4ff637ca4ff637da5ff647da5ff647da5ff647da6ff647ea6ff657ea7ff657ea7ff657fa7ff667fa8ff667fa8ff6680a8ff6680a8ff5a7196ff5a7196ff5a7196ff5a7196ff5a7195ff5a7195ff5a7195ff5a7095ff597095ff597094ff597094ff597094ff596f94ff596f94ff586f93ff586f93ff586f93ff586f93ff586e93ff586e93ff576e92ff576e92ff576e92ff576e92ff576d92ff576d92ff576d92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e93ff576e93ff576e93ff586e93ff586e93ff586e93ff586f93ff586f93ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f95ff586f95ff596f95ff596f95ff597095ff597095ff597095ff597095ff597095ff597095ff597096ff597096ff597096ff597096ff597196ff5a7196ff5a7197ff5a7197ff5a7198ff5a7298ff5b7298ff5b7298ff5b7299ff5b7399ff5b7399ff5c7399ff5c749aff5c749aff5c749bff5c749bff5c749bff5d759bff5d759cff5d759cff5d759cff5d759cff5e769dff5e769dff5e769dff5e769dff5e769dff5e779eff5e779eff5f779eff5f779eff5f779fff5f789fff5f789fff5f789fff6078a0ff6078a0ff6078a0ff6079a0ff6079a1ff6179a1ff617aa2ff617aa2ff617aa2ff627ba3ff627ba3ff627ba3ff637ca4ff637ca4ff637ca4ff647da5ff647da5ff647da6ff647da6ff647ea6ff657ea7ff657ea7ff657fa7ff667fa8ff667fa8ff6680a8ff6680a8ff6680a9ff5b7296ff5b7296ff5b7196ff5a7196ff5a7196ff5a7196ff5a7195ff5a7195ff5a7195ff5a7095ff597095ff597095ff597094ff597094ff596f94ff596f94ff586f94ff586f93ff586f93ff586f93ff586f93ff586e93ff586e93ff576e92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e92ff576e93ff576e93ff586e93ff586e93ff586e93ff586e93ff586f93ff586f93ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff596f95ff596f95ff596f95ff597095ff597095ff597095ff597095ff597095ff597095ff597096ff597096ff597096ff597096ff597096ff597196ff5a7196ff5a7197ff5a7197ff5a7197ff5a7298ff5a7298ff5b7298ff5b7298ff5b7399ff5b7399ff5b7399ff5c739aff5c749aff5c749aff5c749bff5c749bff5d759bff5d759bff5d759cff5d759cff5d759cff5e769cff5e769dff5e769dff5e769dff5e769dff5e779eff5e779eff5f779eff5f779eff5f779fff5f789fff5f789fff5f789fff6078a0ff6078a0ff6078a0ff6079a0ff6179a1ff6179a1ff617aa2ff617aa2ff617aa2ff627ba3ff627ba3ff627ba3ff637ca4ff637ca4ff637ca4ff647da5ff647da5ff647da6ff647ea6ff657ea6ff657ea7ff657ea7ff657fa7ff667fa8ff667fa8ff6680a8ff6680a8ff6780a9ff6780a9ff5b7297ff5b7297ff5b7296ff5b7296ff5b7296ff5a7196ff5a7196ff5a7196ff5a7196ff5a7195ff5a7195ff5a7095ff597095ff597095ff597094ff597094ff597094ff596f94ff596f94ff586f94ff586f93ff586f93ff586f93ff586f93ff586e93ff586e93ff576e92ff576e92ff576e92ff576e92ff576e92ff576e93ff576e93ff586e93ff586e93ff586e93ff586f93ff586f93ff586f93ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff586f94ff596f94ff596f95ff596f95ff597095ff597095ff597095ff597095ff597095ff597095ff597095ff597095ff597096ff597096ff597096ff597096ff597196ff597196ff5a7196ff5a7197ff5a7197ff5a7197ff5a7197ff5a7298ff5b7298ff5b7298ff5b7399ff5b7399ff5b7399ff5c7399ff5c749aff5c749aff5c749bff5c749bff5d749bff5d759bff5d759cff5d759cff5d759cff5d769cff5e769dff5e769dff5e769dff5e769dff5e779eff5e779eff5f779eff5f779eff5f779eff5f779fff5f789fff5f789fff6078a0ff6078a0ff6078a0ff6079a0ff6179a1ff617aa1ff617aa2ff617aa2ff627ba2ff627ba3ff627ba3ff627ba3ff637ca4Line truncated
|
||||
m_StreamData:
|
||||
serializedVersion: 2
|
||||
offset: 0
|
||||
size: 0
|
||||
path:
|
||||
m_SourceTextures:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
--- !u!1 &993954500
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -6893,7 +6885,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1164194066
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -10259,7 +10251,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1419977426
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -10267,7 +10259,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1419977425}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: aea289474a4f4fdcb217aa68772e5da2, type: 3}
|
||||
m_Name:
|
||||
@@ -10356,11 +10348,11 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
_globalSettingsTab: 1
|
||||
_screenSpaceLightingTab: 1
|
||||
_screenSpaceLightingTab: 0
|
||||
_wsgiTab: 1
|
||||
_lightingTab: 1
|
||||
_lightingTab: 0
|
||||
_reflectionsTab: 1
|
||||
_debugTab: 1
|
||||
_debugTab: 0
|
||||
_showVoxelParams: 1
|
||||
_showUpdateOptions: 1
|
||||
--- !u!4 &1419977427
|
||||
@@ -15709,3 +15701,4 @@ SceneRoots:
|
||||
- {fileID: 1902289941}
|
||||
- {fileID: 1040451722}
|
||||
- {fileID: 1353649401}
|
||||
- {fileID: 803506600}
|
||||
@@ -0,0 +1,67 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
/// <summary>
|
||||
/// Disables HTrace WSGI while the additively-loaded Lobby scene is present, and re-enables it everywhere else
|
||||
/// (Main-only, or the match map). HTraceWSGI lives permanently in the always-loaded Main scene, so it can't be
|
||||
/// authored per-scene; this watcher toggles it from Unity's additive scene load/unload events (NGO loads the
|
||||
/// gameplay scenes through the same SceneManager, so those events fire on every machine, host and client alike).
|
||||
///
|
||||
/// Authored on a plain GameObject in the always-loaded Main scene. It toggles the HTraceWSGI COMPONENT's `enabled`
|
||||
/// (not the GameObject), so its own host stays alive and can turn the GI back on. HTraceWSGI.OnDisable/OnEnable
|
||||
/// cleanly unregister/re-register the renderer feature, so flipping `enabled` fully stops and restarts the GI.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
public class HTraceLobbyToggle : MonoBehaviour
|
||||
{
|
||||
[Tooltip("Name of the additively-loaded scene during which HTrace WSGI is disabled. Matches MatchManager.lobbySceneName.")]
|
||||
[SerializeField] private string lobbySceneName = "Lobby";
|
||||
|
||||
private HTraceWSGI.Scripts.HTraceWSGI _gi;
|
||||
|
||||
private void Awake() => Resolve();
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
SceneManager.sceneUnloaded += OnSceneUnloaded;
|
||||
Apply();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
SceneManager.sceneUnloaded -= OnSceneUnloaded;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode) => Apply();
|
||||
private void OnSceneUnloaded(Scene scene) => Apply();
|
||||
|
||||
private void Resolve()
|
||||
{
|
||||
// Include inactive: the HTrace object may have been toggled off by DirectionalLightForHTrace's one-frame
|
||||
// re-init, and once we disable the component a plain search would still find it (component-level toggle),
|
||||
// but caching once is cheaper than re-scanning per event.
|
||||
if (!_gi) _gi = FindAnyObjectByType<HTraceWSGI.Scripts.HTraceWSGI>(FindObjectsInactive.Include);
|
||||
}
|
||||
|
||||
private void Apply()
|
||||
{
|
||||
Resolve();
|
||||
if (!_gi) return;
|
||||
|
||||
bool disableForLobby = IsLobbyLoaded();
|
||||
if (_gi.enabled == !disableForLobby) return; // already in the desired state
|
||||
_gi.enabled = !disableForLobby;
|
||||
}
|
||||
|
||||
private bool IsLobbyLoaded()
|
||||
{
|
||||
for (int i = 0; i < SceneManager.sceneCount; i++)
|
||||
{
|
||||
Scene s = SceneManager.GetSceneAt(i);
|
||||
if (s.isLoaded && s.name == lobbySceneName) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57dab8a6b4fe83c4fa79b6acf54bf25b
|
||||
Reference in new issue
Block a user