Fix scene load arguments
This commit is contained in:
@@ -1697,7 +1697,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!114 &2050966537
|
--- !u!114 &2050966537
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ PrefabInstance:
|
|||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 5353799689805060140, guid: cdecf5aa30b8c3649aa7cc748758d68a, type: 3}
|
||||||
|
propertyPath: scene
|
||||||
|
value: TempleB
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5353799689805060140, guid: cdecf5aa30b8c3649aa7cc748758d68a, type: 3}
|
- target: {fileID: 5353799689805060140, guid: cdecf5aa30b8c3649aa7cc748758d68a, type: 3}
|
||||||
propertyPath: spawnPoint
|
propertyPath: spawnPoint
|
||||||
value:
|
value:
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
spawnPoint: {fileID: 361166861}
|
spawnPoint: {fileID: 361166861}
|
||||||
sceneIndex: 2
|
scene: TempleC
|
||||||
--- !u!23 &1156064028215898908
|
--- !u!23 &1156064028215898908
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -970,7 +970,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
spawnPoint: {fileID: 1864713635}
|
spawnPoint: {fileID: 1864713635}
|
||||||
sceneIndex: 0
|
scene: TempleB
|
||||||
--- !u!65 &4444024360594741996
|
--- !u!65 &4444024360594741996
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -799,6 +799,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3124016421593227013, guid: 285b65b1583472147a5dcee7cfb4a4e0, type: 3}
|
||||||
|
propertyPath: scene
|
||||||
|
value: TempleD
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3124016421593227013, guid: 285b65b1583472147a5dcee7cfb4a4e0, type: 3}
|
- target: {fileID: 3124016421593227013, guid: 285b65b1583472147a5dcee7cfb4a4e0, type: 3}
|
||||||
propertyPath: sceneIndex
|
propertyPath: sceneIndex
|
||||||
value: 3
|
value: 3
|
||||||
@@ -931,6 +935,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_Enabled
|
propertyPath: m_Enabled
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5353799689805060140, guid: cdecf5aa30b8c3649aa7cc748758d68a, type: 3}
|
||||||
|
propertyPath: scene
|
||||||
|
value: TempleB
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5353799689805060140, guid: cdecf5aa30b8c3649aa7cc748758d68a, type: 3}
|
- target: {fileID: 5353799689805060140, guid: cdecf5aa30b8c3649aa7cc748758d68a, type: 3}
|
||||||
propertyPath: spawnPoint
|
propertyPath: spawnPoint
|
||||||
value:
|
value:
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
spawnPoint: {fileID: 524613079}
|
spawnPoint: {fileID: 524613079}
|
||||||
sceneIndex: 2
|
scene: TempleC
|
||||||
--- !u!1 &705507993
|
--- !u!1 &705507993
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Scampz.GameJam
|
|||||||
{
|
{
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
GameManager.Instance.LoadScene(SceneManager.GetSceneByName(SceneNames.TempleC), LoadSceneMode.Additive);
|
GameManager.Instance.LoadScene(SceneNames.TempleC, LoadSceneMode.Additive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,21 +17,21 @@ namespace Scampz.GameJam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadScene(Scene scene, LoadSceneMode loadSceneMode)
|
public void LoadScene(string sceneName, LoadSceneMode loadSceneMode)
|
||||||
{
|
{
|
||||||
StartCoroutine(LoadSceneAsync(scene, loadSceneMode));
|
StartCoroutine(LoadSceneAsync(sceneName, loadSceneMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnloadScene(Scene scene)
|
public void UnloadScene(string sceneName)
|
||||||
{
|
{
|
||||||
StartCoroutine(UnloadSceneAsync(scene));
|
StartCoroutine(UnloadSceneAsync(sceneName));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator LoadSceneAsync(Scene scene, LoadSceneMode loadSceneMode)
|
private IEnumerator LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode)
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
var loadSceneOperation = SceneManager.LoadSceneAsync(scene.name, loadSceneMode);
|
var loadSceneOperation = SceneManager.LoadSceneAsync(sceneName, loadSceneMode);
|
||||||
loadSceneOperation.allowSceneActivation = false;
|
loadSceneOperation.allowSceneActivation = false;
|
||||||
while (!loadSceneOperation.isDone)
|
while (!loadSceneOperation.isDone)
|
||||||
{
|
{
|
||||||
@@ -43,11 +43,11 @@ namespace Scampz.GameJam
|
|||||||
yield return loadSceneOperation;
|
yield return loadSceneOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator UnloadSceneAsync(Scene scene)
|
private IEnumerator UnloadSceneAsync(string sceneName)
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
if (SceneManager.GetSceneByName(scene.name).IsValid())
|
if (SceneManager.GetSceneByName(sceneName).IsValid())
|
||||||
SceneManager.UnloadSceneAsync(scene);
|
SceneManager.UnloadSceneAsync(sceneName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Scampz.GameJam
|
|||||||
private bool loaded = false;
|
private bool loaded = false;
|
||||||
public Transform spawnPoint;
|
public Transform spawnPoint;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public int scene;
|
private string scene;
|
||||||
|
|
||||||
void OnTriggerEnter(Collider collider)
|
void OnTriggerEnter(Collider collider)
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ namespace Scampz.GameJam
|
|||||||
var player = GameObject.FindWithTag("Player");
|
var player = GameObject.FindWithTag("Player");
|
||||||
var cc = player.GetComponent<CharacterController>();
|
var cc = player.GetComponent<CharacterController>();
|
||||||
cc.enabled = false;
|
cc.enabled = false;
|
||||||
GameManager.Instance.LoadScene(SceneManager.GetSceneByName(SceneNames.TempleA), LoadSceneMode.Additive);
|
GameManager.Instance.LoadScene(scene, LoadSceneMode.Additive);
|
||||||
player.transform.position = spawnPoint.position;
|
player.transform.position = spawnPoint.position;
|
||||||
player.transform.rotation = spawnPoint.rotation;
|
player.transform.rotation = spawnPoint.rotation;
|
||||||
cc.enabled = true;
|
cc.enabled = true;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Scampz.GameJam
|
|||||||
{
|
{
|
||||||
if (Input.GetButtonDown(InputOptions.Submit))
|
if (Input.GetButtonDown(InputOptions.Submit))
|
||||||
{
|
{
|
||||||
GameManager.Instance.LoadScene(SceneManager.GetSceneByName(SceneNames.BaseScene), LoadSceneMode.Single);
|
GameManager.Instance.LoadScene(SceneNames.BaseScene, LoadSceneMode.Single);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
|
|
||||||
namespace Scampz.GameJam
|
namespace Scampz.GameJam
|
||||||
{
|
{
|
||||||
public class UnloadScene : MonoBehaviour
|
public class UnloadScene : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public Scene scene;
|
private string scene;
|
||||||
private bool unloaded = false;
|
private bool unloaded = false;
|
||||||
|
|
||||||
void OnTriggerEnter(Collider collider)
|
void OnTriggerEnter(Collider collider)
|
||||||
|
|||||||
Reference in New Issue
Block a user