Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[Cinemachine] Array index is out of range?

Discussion in 'Cinemachine' started by Glowing_Slab, Aug 31, 2018.

  1. Glowing_Slab

    Glowing_Slab

    Joined:
    Jun 19, 2015
    Posts:
    27
    I occasionally pick up lots of errors from the Cinemachine FreeLook cameras I'm using. Am I missing something obvious?

    Error is:

    IndexOutOfRangeException: Array index is out of range.
    Cinemachine.CinemachineFreeLook.UpdateCachedSpline () (at /Users/me/Library/Unity/cache/packages/packages.unity.com/com.unity.cinemachine@2.2.7/Runtime/Behaviours/CinemachineFreeLook.cs:634)
    Cinemachine.CinemachineFreeLook.GetLocalPositionForCameraFromInput (Single t)

    ... which makes me wonder if it's something to do with the vcam initial position?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,063
    I've never seen those. If you can manage to repro consistently, please file a bug report with full repro steps and we'll get right on it.
     
  3. SideEffectsDave

    SideEffectsDave

    Joined:
    Jul 16, 2018
    Posts:
    1
    We get the same error (seemingly at random and only within the editor). We can reproduce it (more or less consistently) when we build the project or publish/update the scene containing the Cinemachine Brain using Unity Collaborate. It first appeared when someone copied a Freelook Camera in the scene containing the Cinemachine Brain and published the changes using Unity Collaborate. After that the Freelook Cameras started exposing their Rigs in the hierarchy when activated/deactivated.

    To fix it we open a scene not containing a cinemachine brain then reimport the scene containing the Cinemachine Brain and the error is gone (at least for a while :D).
     
    Last edited: Sep 4, 2018
  4. Glowing_Slab

    Glowing_Slab

    Joined:
    Jun 19, 2015
    Posts:
    27
    Interesting! I also use Collaborate, and would certainly have copied a Freelook camera too. I use three Freelook cameras and two brains in the scene. I found the issue difficult to reproduce, but it only occurs in the editor. I have also seen some of the Freelook cameras exposing at least part of their rigs on occasion.
     
  5. JonneSir

    JonneSir

    Joined:
    Jun 27, 2018
    Posts:
    2
    I had this same problem. I restarted the scene and it seems to have dissapeared.
     
  6. Glowing_Slab

    Glowing_Slab

    Joined:
    Jun 19, 2015
    Posts:
    27
    Sometimes it takes a while to reappear, restarting has not solved the issue for me.
     
  7. dval

    dval

    Joined:
    Jul 25, 2012
    Posts:
    15
    Edit:
    I just removed ExecuteInEditMode from the directives in CinemachineBrain.cs.
    Works fine in playmode. No more errors in edit mode.

    Any reason to keep ExecuteInEditMode?


    Yeah, this is still a thing. I get:
    IndexOutOfRangeException: Index was outside the bounds of the array.
    Cinemachine.CinemachineFreeLook.UpdateCachedSpline () (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Behaviours/CinemachineFreeLook.cs:617)
    Cinemachine.CinemachineFreeLook.GetLocalPositionForCameraFromInput (System.Single t) (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Behaviours/CinemachineFreeLook.cs:597)
    Cinemachine.CinemachineFreeLook.PushSettingsToRigs () (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Behaviours/CinemachineFreeLook.cs:534)
    Cinemachine.CinemachineFreeLook.InternalUpdateCameraState (UnityEngine.Vector3 worldUp, System.Single deltaTime) (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Behaviours/CinemachineFreeLook.cs:283)
    Cinemachine.CinemachineCore.UpdateVirtualCamera (Cinemachine.CinemachineVirtualCameraBase vcam, UnityEngine.Vector3 worldUp, System.Single deltaTime) (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Core/CinemachineCore.cs:288)
    Cinemachine.CinemachineCore.UpdateAllActiveVirtualCameras (System.Int32 layerMask, UnityEngine.Vector3 worldUp, System.Single deltaTime) (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Core/CinemachineCore.cs:209)
    Cinemachine.CinemachineBrain.UpdateVirtualCameras (Cinemachine.CinemachineCore+UpdateFilter updateFilter, System.Single deltaTime) (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Behaviours/CinemachineBrain.cs:293)
    Cinemachine.CinemachineBrain.LateUpdate () (at Library/PackageCache/com.unity.cinemachine@2.2.0/Runtime/Behaviours/CinemachineBrain.cs:242)


    Every second my mouse is over the Scene window. It happens more often if I move the mouse.
    So, just opening the project, I am greeted with about 40 error messages. Nothing seems to be broken gameplay wise, but it makes it hard to see actual issues.
     
    Last edited: Feb 10, 2019
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,063
    I would strongly recommend upgrading to the latest version of CM, which currently is 2.2.8.