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 March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question InvalidCastException: Specified cast is not valid.

Discussion in 'UGUI & TextMesh Pro' started by ArnauKokoro, Dec 15, 2022.

  1. ArnauKokoro

    ArnauKokoro

    Joined:
    Apr 27, 2021
    Posts:
    36
    Suddenly I got this error on Unity:

    InvalidCastException: Specified cast is not valid.
    UnityEngine.UI.ScrollRect.get_viewRect () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/ScrollRect.cs:454)
    UnityEngine.UI.ScrollRect.UpdateCachedData () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/ScrollRect.cs:542)
    UnityEngine.UI.ScrollRect.Rebuild (UnityEngine.UI.CanvasUpdate executing) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/ScrollRect.cs:516)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/CanvasUpdateRegistry.cs:182)
    UnityEngine.UI.ScrollRect:LateUpdate() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/ScrollRect.cs:808)


    The GameObjects using ScrollRect appear as Missing Prefab (Dummy).

    Maybe because I'm changing from Unity Version 2020.3.13f1 to Unity Version 2020.3.15f2 using the same project?

    Which cache should I clear to make it work?

    Thanks!
     
    Last edited: Dec 15, 2022
  2. ArnauKokoro

    ArnauKokoro

    Joined:
    Apr 27, 2021
    Posts:
    36
    SOLVED!

    Deleting entire Project /Library folder and force to recreate again opening the editor solved the problem!