-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Cold Startup prefab to play directly from gameplay scenes
Add a prefab EditorInitializer that can be place in any gameplay scene to load the persistenceManger Scene additively first. Separate logic for initialization in a different Scene, that is actually the only one present in the Build Settings. This scene will be responsible to load PersistenceManager Scene, ask it to load Main Menu and finally unload itself.
- Loading branch information
1 parent
92e6b42
commit c2d750f
Showing
12 changed files
with
305 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!29 &1 | ||
OcclusionCullingSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 2 | ||
m_OcclusionBakeSettings: | ||
smallestOccluder: 5 | ||
smallestHole: 0.25 | ||
backfaceThreshold: 100 | ||
m_SceneGUID: 00000000000000000000000000000000 | ||
m_OcclusionCullingData: {fileID: 0} | ||
--- !u!104 &2 | ||
RenderSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 9 | ||
m_Fog: 0 | ||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} | ||
m_FogMode: 3 | ||
m_FogDensity: 0.01 | ||
m_LinearFogStart: 0 | ||
m_LinearFogEnd: 300 | ||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, 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: 1 | ||
m_AmbientMode: 0 | ||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} | ||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} | ||
m_HaloStrength: 0.5 | ||
m_FlareStrength: 1 | ||
m_FlareFadeSpeed: 3 | ||
m_HaloTexture: {fileID: 0} | ||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} | ||
m_DefaultReflectionMode: 0 | ||
m_DefaultReflectionResolution: 128 | ||
m_ReflectionBounces: 1 | ||
m_ReflectionIntensity: 1 | ||
m_CustomReflection: {fileID: 0} | ||
m_Sun: {fileID: 0} | ||
m_IndirectSpecularColor: {r: 0.12731689, g: 0.13414702, b: 0.1210784, a: 1} | ||
m_UseRadianceAmbientProbe: 0 | ||
--- !u!157 &3 | ||
LightmapSettings: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 12 | ||
m_GIWorkflowMode: 1 | ||
m_GISettings: | ||
serializedVersion: 2 | ||
m_BounceScale: 1 | ||
m_IndirectOutputScale: 1 | ||
m_AlbedoBoost: 1 | ||
m_EnvironmentLightingMode: 0 | ||
m_EnableBakedLightmaps: 1 | ||
m_EnableRealtimeLightmaps: 0 | ||
m_LightmapEditorSettings: | ||
serializedVersion: 12 | ||
m_Resolution: 2 | ||
m_BakeResolution: 40 | ||
m_AtlasSize: 1024 | ||
m_AO: 0 | ||
m_AOMaxDistance: 1 | ||
m_CompAOExponent: 1 | ||
m_CompAOExponentDirect: 0 | ||
m_ExtractAmbientOcclusion: 0 | ||
m_Padding: 2 | ||
m_LightmapParameters: {fileID: 0} | ||
m_LightmapsBakeMode: 1 | ||
m_TextureCompression: 1 | ||
m_FinalGather: 0 | ||
m_FinalGatherFiltering: 1 | ||
m_FinalGatherRayCount: 256 | ||
m_ReflectionCompression: 2 | ||
m_MixedBakeMode: 2 | ||
m_BakeBackend: 1 | ||
m_PVRSampling: 1 | ||
m_PVRDirectSampleCount: 32 | ||
m_PVRSampleCount: 512 | ||
m_PVRBounces: 2 | ||
m_PVREnvironmentSampleCount: 256 | ||
m_PVREnvironmentReferencePointCount: 2048 | ||
m_PVRFilteringMode: 1 | ||
m_PVRDenoiserTypeDirect: 1 | ||
m_PVRDenoiserTypeIndirect: 1 | ||
m_PVRDenoiserTypeAO: 1 | ||
m_PVRFilterTypeDirect: 0 | ||
m_PVRFilterTypeIndirect: 0 | ||
m_PVRFilterTypeAO: 0 | ||
m_PVREnvironmentMIS: 1 | ||
m_PVRCulling: 1 | ||
m_PVRFilteringGaussRadiusDirect: 1 | ||
m_PVRFilteringGaussRadiusIndirect: 5 | ||
m_PVRFilteringGaussRadiusAO: 2 | ||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 | ||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 | ||
m_PVRFilteringAtrousPositionSigmaAO: 1 | ||
m_ExportTrainingData: 0 | ||
m_TrainingDataDestination: TrainingData | ||
m_LightProbeSampleCountMultiplier: 4 | ||
m_LightingDataAsset: {fileID: 0} | ||
m_LightingSettings: {fileID: 0} | ||
--- !u!196 &4 | ||
NavMeshSettings: | ||
serializedVersion: 2 | ||
m_ObjectHideFlags: 0 | ||
m_BuildSettings: | ||
serializedVersion: 2 | ||
agentTypeID: 0 | ||
agentRadius: 0.5 | ||
agentHeight: 2 | ||
agentSlope: 45 | ||
agentClimb: 0.4 | ||
ledgeDropHeight: 0 | ||
maxJumpAcrossDistance: 0 | ||
minRegionArea: 2 | ||
manualCellSize: 0 | ||
cellSize: 0.16666667 | ||
manualTileSize: 0 | ||
tileSize: 256 | ||
accuratePlacement: 0 | ||
maxJobWorkers: 0 | ||
preserveTilesOutsideBounds: 0 | ||
debug: | ||
m_Flags: 0 | ||
m_NavMeshData: {fileID: 0} | ||
--- !u!1 &864492825 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 864492827} | ||
- component: {fileID: 864492826} | ||
m_Layer: 0 | ||
m_Name: Initializer | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!114 &864492826 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 864492825} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 93cf6573ba6c4efda55231b436915501, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
managersScene: | ||
m_AssetGUID: 84e8448b215c74f4d804a0bab678864c | ||
m_SubObjectName: | ||
m_SubObjectType: | ||
m_EditorAssetChanged: 0 | ||
menuToLoad: | ||
m_AssetGUID: ae666798a74d3a5488e0c0ec42a1265d | ||
m_SubObjectName: | ||
m_SubObjectType: | ||
m_EditorAssetChanged: 0 | ||
menuLoadChannel: | ||
m_AssetGUID: 76d253de60ff54ff79408772ae93a495 | ||
m_SubObjectName: | ||
m_SubObjectType: | ||
m_EditorAssetChanged: 0 | ||
--- !u!4 &864492827 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 864492825} | ||
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_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Assets/ScriptableObjects/Events/LoadMenuEvent_Channel.asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: f2a125052f9a345d997c717978996487, type: 3} | ||
m_Name: LoadMenuEvent_Channel | ||
m_EditorClassIdentifier: | ||
description: Raised to request the loading of a new Menu scene, when going back | ||
to Main Menu or when the game moves from initiatlization to Main Menu at the | ||
beginning |
8 changes: 8 additions & 0 deletions
8
Assets/ScriptableObjects/Events/LoadMenuEvent_Channel.asset.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Fontinixxl.Shared.ScriptableObjects.EventChannels; | ||
using UnityEngine; | ||
using UnityEngine.AddressableAssets; | ||
using UnityEngine.ResourceManagement.AsyncOperations; | ||
using UnityEngine.ResourceManagement.ResourceProviders; | ||
using UnityEngine.SceneManagement; | ||
|
||
namespace Fontinixxl.SceneManagement | ||
{ | ||
/// <summary> | ||
/// This class is responsible for starting the game by loading the persistent managers scene | ||
/// and raising the event to load the Main Menu | ||
/// </summary> | ||
|
||
public class InitializationLoader : MonoBehaviour | ||
{ | ||
[SerializeField] private AssetReference managersScene = default; | ||
[SerializeField] private AssetReference menuToLoad = default; | ||
|
||
[Header("Broadcasting on")] | ||
[SerializeField] private AssetReference menuLoadChannel = default; | ||
|
||
private void Start() | ||
{ | ||
//Load the persistent managers scene | ||
managersScene.LoadSceneAsync(LoadSceneMode.Additive).Completed += LoadEventChannel; | ||
} | ||
|
||
private void LoadEventChannel(AsyncOperationHandle<SceneInstance> obj) | ||
{ | ||
menuLoadChannel.LoadAssetAsync<LoadEventChannelSO>().Completed += LoadMainMenu; | ||
} | ||
|
||
private void LoadMainMenu(AsyncOperationHandle<LoadEventChannelSO> obj) | ||
{ | ||
obj.Result.RaiseEvent(menuToLoad); | ||
|
||
SceneManager.UnloadSceneAsync(0); //Initialization is the only scene in BuildSettings, thus it has index 0 | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.