Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question InvalidCastException: Unable to cast object of type 'SignalReceiver' to type 'CinemachineBrain'

Discussion in 'Timeline' started by chrismarch, Nov 2, 2021.

  1. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    449
    Our Android player is hitting an exception in the Timeline package code, and we need some help understanding why. We are using a Timeline, and eventually, sometimes, the exception is raised from CinemachineMixer.ProcessFrame when trying to cast the playerData argument:

    Code (CSharp):
    1.         public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    2.         {
    3.             base.ProcessFrame(playable, info, playerData);
    4.  
    5.             // Get the brain that this track controls.
    6.             // Older versions of timeline sent the gameObject by mistake.
    7.             GameObject go = playerData as GameObject;
    8.             if (go == null)
    9.                 mBrain = (CinemachineBrain)playerData;
    Unity 2020.3.16f1, Cinemachine 2.7.8
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,392
    This looks to be a Timeline bug. Can you file a bug report with a repro project?
     
  3. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    449
    We don't know how to repro it yet; we discovered the exception in a released player via our logging agregator. Any clues as to how it might happen might help a repro. I don't follow the code that feeds the wrong object to this method, as it is quite complicated.