Search Unity

Prefab missing script and animator errors

Discussion in '2D' started by arkord76, Mar 16, 2022.

  1. arkord76

    arkord76

    Joined:
    Mar 14, 2022
    Posts:
    4
    Hi everyone!

    I'm new to Unity and struggling with a buyed asset.

    After I imported the asset as a unitypackage I got errors that a associated script is missing.
    img3.png

    img1.png
    I could fix the error by assigning an empty script to each instance.

    But inspecting the Animator there are still errors and I don't know how to fix them.
    img2.png
    Any hints how I could fix this are appreciated!
     
  2. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,465
    So using pre-created assets can come with a warning, such as things deprecate and the owner doesnt update anymore. The fix is technically quite simple, but actually figuring out what script and what sprite is the hard part. You need to go to the Asset folder, find the prefab and open it in the prefab mode. Then, you need to assign the script by clicking the little circle next to "Missing (Mono Script)" and use the correct script. What the correct script is, we have no idea.

    The same for the animation. Go into that animation and you need to apply that sprite.
     
  3. arkord76

    arkord76

    Joined:
    Mar 14, 2022
    Posts:
    4
    @Cornysam Thank you for your answer. I already did what you suggested. The problem is the package contains no script, which I could reasign. Therfore I created an empty one and assigned this, which worked.

    Regarding the sprite, as you can see it is applied to the animation (the one below is correct). Could it be that the "Mono Behaviour.Displayed Sprite" error is caused by missing something in the script?
     
  4. Cornysam

    Cornysam

    Joined:
    Feb 8, 2018
    Posts:
    1,465
    Doubtful. The animator doesn't know what is going on a script unless you put an event or call the animator to change a parameter. If you click that yellow text you showed in your image, it may take you to or highlight the part. My guess is in the prefab if you dive into the hierarchy and go to that bone_003 you will see what is there. Check that and look in the sprite renderer component on the object and make sure something is assigned. If that is okay, you may need to check out the actual frames in the animation and make sure at each frame where there is a position/rotation/scale change that the bone_003 has a sprite attached.
     
  5. arkord76

    arkord76

    Joined:
    Mar 14, 2022
    Posts:
    4
    I will take a look at. Thank you very much for your help.
     
  6. arkord76

    arkord76

    Joined:
    Mar 14, 2022
    Posts:
    4
    I figured out what the error means! The elements under "bone_003" are properties. It seams there was as "MonoBehaviour.DisplayedSprite" property from the SlashFX_000 sprite assigned. But the MonoBehaviour class don't have any DisplayedSprite property and never had. Good to know what causes the error. I hope I can find a solution to fix it.

    img2.png