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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Repeating Error - Bug: InvalidCastException: Cannot cast from source type to destination type?

Discussion in 'Editor & General Support' started by CloudyVR, Aug 18, 2019.

  1. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    709
    I just created a simple .prefab in 2019.1.3f1, but when I click on it I get a repeating error:

    InvalidCastException: Cannot cast from source type to destination type.
    UnityEditor.PrefabImporterEditor.HasDirtyPrefabAssets () (at C:/buildslave/unity/build/Editor/Mono/Prefabs/PrefabImporterEditor.cs:144)
    UnityEditor.PrefabImporterEditor.Update () (at C:/buildslave/unity/build/Editor/Mono/


    I cannot add the prefab, what should I do?
     
    Last edited: Aug 18, 2019
    Hradz likes this.
  2. Domas_L

    Domas_L

    Unity Technologies

    Joined:
    Nov 27, 2018
    Posts:
    111
    Hello! Could you please submit a bug report with a minimal reproduction project for this issue and reply in here with the issue ID?
     
  3. Hradz

    Hradz

    Joined:
    Jun 21, 2017
    Posts:
    1
    I also have the same problem. Suddenly my prefab got corrupted and every time I click on it, it displays that error
     
  4. Malkyne

    Malkyne

    Joined:
    Nov 18, 2009
    Posts:
    39
    I've run into the same problem. In my case, it turned out to be linked to the SpriteToParticles asset on the Asset Store. When I removed the Sprite To Particles component from the prefab, it stopped spewing that error in the console. I've tried the latest version of the asset, and it's still having this problem.

    The same component is also causing problems in 2018.4.9f1, but I get no errors in the console. Instead, it thrashes the prefab asset preview, reloading over and over again.