Unity-Technologies / BoatAttack

Demo Project using the Universal RP from Unity3D
Other
2.56k stars 958 forks source link

ArgumentOutOfRangeException: Index was out of range. Must be non-negative.. #170

Open derikbr opened 2 years ago

derikbr commented 2 years ago

Does anybody know how to solve this? I opened the project in the correct version and the error continues. After compiling the game does not load the scene of "level_Island"

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0) **Cinemachine.CinemachineBrain.UpdateFrame0** (System.Single deltaTime) (at Library/PackageCache/com.unity.cinemachine@2.6.11/Runtime/Behaviours/CinemachineBrain.cs:690) Cinemachine.CinemachineBrain.ManualUpdate () (at Library/PackageCache/com.unity.cinemachine@2.6.11/Runtime/Behaviours/CinemachineBrain.cs:349) GameplayIngredients.Editor.LinkGameView.UpdateCinemachinePreview (System.Boolean value) (at Library/PackageCache/net.peeweek.gameplay-ingredients@2020.2.10/Editor/GameViewLink/LinkGameView.cs:247) GameplayIngredients.Editor.LinkGameView.set_CinemachineActive (System.Boolean value) (at Library/PackageCache/net.peeweek.gameplay-ingredients@2020.2.10/Editor/GameViewLink/LinkGameView.cs:58) GameplayIngredients.Editor.LinkGameView.OnPlayModeChanged (UnityEditor.PlayModeStateChange state) (at Library/PackageCache/net.peeweek.gameplay-ingredients@2020.2.10/Editor/GameViewLink/LinkGameView.cs:104) UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange state) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)

NPatch commented 2 years ago

Yeah, go to File->Build Settings and check the checkbox next to that scene. The problem was that the scene was not included in the game, therefore the utility class which searches the scene index by name, on runtime, did not find the scene registered, so it returned -1, hence the exception you're getting.