File tree Expand file tree Collapse file tree 5 files changed +18
-14
lines changed Expand file tree Collapse file tree 5 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ MonoBehaviour:
139
139
m_Script : {fileID: 11500000, guid: 3a698c89160b64541b11228f3098737b, type: 3}
140
140
m_Name :
141
141
m_EditorClassIdentifier :
142
- m_MovementSpeed : 10
142
+ m_MovementSpeed : 2.5
143
143
m_AnimatorController : {fileID: 214216475}
144
144
--- !u!1001 &1171686176522753923
145
145
PrefabInstance :
Original file line number Diff line number Diff line change @@ -2763,11 +2763,6 @@ PrefabInstance:
2763
2763
propertyPath : m_Name
2764
2764
value : Player
2765
2765
objectReference : {fileID: 0}
2766
- - target : {fileID: 8083381679980500539, guid: 67db914bd437a69468c6d966454659b0,
2767
- type : 3}
2768
- propertyPath : m_MovementSpeed
2769
- value : 2.5
2770
- objectReference : {fileID: 0}
2771
2766
m_RemovedComponents : []
2772
2767
m_SourcePrefab : {fileID: 100100000, guid: 67db914bd437a69468c6d966454659b0, type: 3}
2773
2768
--- !u!1001 &2096555481
Original file line number Diff line number Diff line change 1
1
using UnityEngine ;
2
+ using UnityEngine . SceneManagement ;
2
3
using UnityEngine . AddressableAssets ;
3
4
4
5
public class GameManager : MonoBehaviour
@@ -15,12 +16,13 @@ public void ExitGame()
15
16
16
17
public static void LoadNextLevel ( )
17
18
{
18
- //TODO: Show old workflow
19
+ // We are going to be using the Addressables API to manage our scene loading and unloading, the equivalent way on the UnityEngine.SceneManagement API is:
20
+ // SceneManager.LoadSceneAsync("LoadingScene", LoadSceneMode.Single);
19
21
22
+ // Scene loaded in Single mode, the previously loaded scenes will be disposed by the Addressables.
20
23
Addressables . LoadSceneAsync ( "LoadingScene" , UnityEngine . SceneManagement . LoadSceneMode . Single , true ) ;
21
24
}
22
25
23
- /// <summary>
24
26
public static void LevelCompleted ( )
25
27
{
26
28
s_CurrentLevel ++ ;
Original file line number Diff line number Diff line change 5
5
6
6
public class Loading : MonoBehaviour
7
7
{
8
- private bool m_LoadingComplete = false ;
8
+ // private bool m_LoadingComplete = false;
9
9
10
10
[ SerializeField ]
11
11
private Slider m_LoadingSlider ;
@@ -14,7 +14,7 @@ public class Loading : MonoBehaviour
14
14
private GameObject m_PlayButton ;
15
15
16
16
// TODO: Maybe just have it inside the Start method and not class-wide
17
- AsyncOperationHandle m_SceneHandle ;
17
+ private AsyncOperationHandle m_SceneHandle ;
18
18
19
19
// Start is called before the first frame update
20
20
void OnEnable ( )
@@ -49,6 +49,4 @@ private void Update()
49
49
m_LoadingSlider . value = m_SceneHandle . PercentComplete ;
50
50
}
51
51
}
52
-
53
- //Make the oncomplete
54
52
}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ public class PlayerConfigurator : MonoBehaviour
7
7
[ SerializeField ]
8
8
private Transform m_HatAnchor ;
9
9
10
- // Start is called before the first frame update
11
10
void Start ( )
12
11
{
13
12
//TODO: Remove this random stuff, just for testing atm
@@ -17,13 +16,23 @@ void Start()
17
16
// TODO: Change the string parameter
18
17
public void SetHat ( string hatKey )
19
18
{
19
+ // We are using the InstantiateAsync function on the Addressables API, the non-Addressables way
20
+ // looks something like the following line, however, this version is not Asynchronous
21
+ // GameObject.Instantiate(prefabToInstantiate);
22
+
20
23
Addressables . InstantiateAsync ( hatKey , m_HatAnchor , false ) . Completed += OnHatInstantiated ;
21
24
}
22
25
23
- // TOASK: Where to unsubscribe
26
+ private void OnDisable ( )
27
+ {
28
+ // TODO: Unsubscribe
29
+ }
24
30
31
+ // TOASK: Where to unsubscribe
25
32
private void OnHatInstantiated ( AsyncOperationHandle < GameObject > obj )
26
33
{
27
34
Debug . Log ( "Hat Instantiated" ) ;
35
+
36
+
28
37
}
29
38
}
You can’t perform that action at this time.
0 commit comments