Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[926150] Missing scripts are not shown in inspector

Discussion in '2017.1 Beta' started by Muuuuo, Jul 1, 2017.

  1. Muuuuo

    Muuuuo

    Joined:
    Apr 16, 2015
    Posts:
    57
    Report #926150

    2017f1 does not show the "Missing MonoBehavior" in the inspector anymore after a script is deleted. However the script still resides in the gameobject and spams the console with missing monobehavior warnings.

    Create new script, attach to object, delete the script file -> does not show up in inspector anymore.

    This makes it completely impossible to fix missing script references when updating assets.
    Are there any workarounds to get them drawn?
     
    ProtonOne likes this.
  2. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    I reported this bug a while ago, a fix is in review:
    https://forum.unity3d.com/threads/r...e-to-remove-missing-component-from-go.474261/

    As for workarounds, the only way I know is to delete your GameObject and recreate it. I know, very painful. I lost all my Cinemachine settings when I upgraded the cinemachine package by deleting the old one and importing the new one because of this. But that's the cost of being on the cutting edge ;)
     
    Muuuuo likes this.
  3. Muuuuo

    Muuuuo

    Joined:
    Apr 16, 2015
    Posts:
    57
    Wait, soon a month in review?

    How does Unity have the audacity to call the current version a release candidate with known bugs like this present? Seriously...
     
  4. Westyfu

    Westyfu

    Joined:
    Mar 30, 2015
    Posts:
    16
    In coming across this, and Doug's earlier report I tried to find it via script using...

    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class findLostComponentTest : MonoBehaviour
    7. {
    8.     void Start()
    9.     {
    10.         List<Component> components = new List<Component>();
    11.  
    12.         GetComponents(components);
    13.  
    14.         foreach (Component script in components)
    15.             Debug.Log(script);
    16.     }
    17. }
    18.  
    but it just returns :

    ..........
    Null
    UnityEngine.Debug:Log(Object)
    findLostComponentTest:Start() (at Assets/findLostComponentTest.cs:15)
    ...........

    in place of the lost component.

    Not super helpful sure, but "something" is still there!

    My next question is...

    Do we have a function that can remove "all" components from a game object, regardless of type?
     
  5. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    So this is the new 'missing script' enhancement :D It's out of sight out of mind guys, I mean once they remove the warning message aswel that is..
     
  6. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    There a some scripts floating about that claim to handle this in code, like this but they actually all leak the component serialisation into the prefab, only removing the reference. I dunno if it's actually possible to fully destroy a component that's null in managed land programmatically, the inspector does it in native code.

    What you can do for now, until they fix this, is just open the file in a text editor and delete both the component from both the m_Component list of the game object and the component serialisation itself.
     
  7. Alex-Lian

    Alex-Lian

    Guest

    This should be resolved in f3.