diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-30 20:02:00 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-05-30 20:02:00 +0800 |
| commit | 7af759cfd8cae024fb4df4972dcfb15b041fa106 (patch) | |
| tree | 9c43cab80dcef875edbcdd719bf61b866d38874b /Assets/Scripts/PlayerPosition.cs | |
| parent | 7735b716401f630697d5b02910d50dbf8f3416af (diff) | |
完成了动态场景加载
Diffstat (limited to 'Assets/Scripts/PlayerPosition.cs')
| -rw-r--r-- | Assets/Scripts/PlayerPosition.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Assets/Scripts/PlayerPosition.cs b/Assets/Scripts/PlayerPosition.cs index 9b839f8..baf4e66 100644 --- a/Assets/Scripts/PlayerPosition.cs +++ b/Assets/Scripts/PlayerPosition.cs @@ -23,7 +23,9 @@ public class PlayerPosition : MonoBehaviour while (true) { yield return new WaitUntil(() => _playerLocomotion == null); - _playerLocomotion = GetComponent<PlayerLocomotion>(); + var list = Resources.FindObjectsOfTypeAll<PlayerLocomotion>(); + if (list.Length > 0) + _playerLocomotion = list[0]; yield return new WaitForSeconds(5f); } } |
