浏览代码

Editor cold startup tweaks

It now works even if the SceneDataSO is not referenced
/main
Ciro Continisio 4 年前
当前提交
3b82d4e6
共有 3 个文件被更改,包括 14 次插入4 次删除
  1. 2
      UOP1_Project/Assets/Prefabs/Gameplay/EditorInitializer.prefab
  2. 13
      UOP1_Project/Assets/Scripts/SceneManagement/EditorColdStartup.cs
  3. 3
      UOP1_Project/Assets/Scripts/SceneManagement/EditorColdStartup.cs.meta

2
UOP1_Project/Assets/Prefabs/Gameplay/EditorInitializer.prefab


m_SubObjectName:
m_SubObjectType:
m_EditorAssetChanged: 0
_onSceneReadyChannel: {fileID: 11400000, guid: b729e40fc41dd8b4ea7aaf5c857f7186,
type: 2}

13
UOP1_Project/Assets/Scripts/SceneManagement/EditorColdStartup.cs


[SerializeField] private GameSceneSO _thisSceneSO = default;
[SerializeField] private GameSceneSO _persistentManagersSO = default;
[SerializeField] private AssetReference _notifyColdStartupChannel = default;
[SerializeField] private VoidEventChannelSO _onSceneReadyChannel = default;
private void Start()
{

private void OnNotifyChannelLoaded(AsyncOperationHandle<LoadEventChannelSO> obj)
{
LoadEventChannelSO loadEventChannelSO = (LoadEventChannelSO)_notifyColdStartupChannel.Asset;
loadEventChannelSO.RaiseEvent(_thisSceneSO);
if(_thisSceneSO != null)
{
obj.Result.RaiseEvent(_thisSceneSO);
}
else
{
//Raise a fake scene ready event, so the player is spawned
_onSceneReadyChannel.RaiseEvent();
//When this happens, the player won't be able to move between scenes because the SceneLoader has no conception of which scene we are in
}
}
#endif
}

3
UOP1_Project/Assets/Scripts/SceneManagement/EditorColdStartup.cs.meta


externalObjects: {}
serializedVersion: 2
defaultReferences:
- _onSceneReady: {fileID: 11400000, guid: b729e40fc41dd8b4ea7aaf5c857f7186, type: 2}
- _loadSceneEventChannel: {fileID: 11400000, guid: 00e3063edc5902e40832ea618644c597,
- _onSceneReadyChannel: {fileID: 11400000, guid: b729e40fc41dd8b4ea7aaf5c857f7186,
type: 2}
executionOrder: 0
icon: {instanceID: 0}

正在加载...
取消
保存