Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Prefab keeps "recreating" components that I have deleted.

Discussion in 'Prefabs' started by HeckingHeckeroo, Apr 15, 2021.

  1. HeckingHeckeroo

    HeckingHeckeroo

    Joined:
    Jul 4, 2018
    Posts:
    5
    I can't find a fix to this anywhere online and it is getting quite annoying to figure out.

    I have a player prefab that uses a character controller to move, however whenever I open the prefab unity creates a Rigidbody and a Capsule collider all on its own. if I delete these they just pop back up whenever I reopen the prefab or it is loaded in game.

    I have checked all scripts and none of them require any of those components.

    Code (CSharp):
    1. Creating missing CapsuleCollider component for PlayerController in DClassPlayer.
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Code (CSharp):
    1. Creating missing Rigidbody component for PlayerController in DClassPlayer.
    2. UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
    3.  
    these are the lines I get and I can't open them to see what is going on in the code either.
     
    twixthehero likes this.
  2. For the readers (I see you have found the issue already), this is a known bug, can be tracked here.
     
    twixthehero likes this.
  3. HeckingHeckeroo

    HeckingHeckeroo

    Joined:
    Jul 4, 2018
    Posts:
    5
    Thank you for your response, I did and I will make sure to keep track of it :)
     
  4. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Could you check
    PlayerController.cs
    , I would guess that this has a dependency on those components
     
  5. HeckingHeckeroo

    HeckingHeckeroo

    Joined:
    Jul 4, 2018
    Posts:
    5
    Thank you for your response, I have checked the script and there are no dependencies on it directly, my only thought is that Mirror is using them for something as it is a NetworkBehavior. however I have had no luck finding the cause through Mirror.
     
  6. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Is PlayerController perhaps derived from something that does require those Components?

    Without a project to look at I can only go by the info you posted and that warning message tell that PlayerControllor is causing these components to appear because they are required.
     
  7. HeckingHeckeroo

    HeckingHeckeroo

    Joined:
    Jul 4, 2018
    Posts:
    5
    Sorry, it derives from a Mirror Network Behaviour, it might just be the new version of mirror that adds them automatically via that script or it might be an import error because I did have a bit of trouble when first updating Mirror, I will look into that script once I am home to double check :)
     
    unity_4nCFrb5L3C2qdQ likes this.
  8. Jove

    Jove

    Joined:
    Aug 23, 2013
    Posts:
    21
    Ran into the same problem, turns out that renaming my script from "PlayerController.cs" to another name fixed it (remember to update the class name within the script as well).

    Not sure if maybe there are some underlying assumptions from Mirror when you use that specific class name?
     
    mingkimlow likes this.
  9. HeckingHeckeroo

    HeckingHeckeroo

    Joined:
    Jul 4, 2018
    Posts:
    5
    Thank you this worked, it might be down to the Mirror Example Scripts as a few of those are named PlayerController.cs, maybe its those?
     
  10. sn0wch1ld

    sn0wch1ld

    Joined:
    Feb 2, 2022
    Posts:
    2
    Ran into the same issue, I deleted the Example folder from the Mirror folder in my project and it solved the problem.