Search Unity

Feedback Unable to change script of a MonoBehaviour in debug inspector in Unity 2022.2

Discussion in 'Editor & General Support' started by FVS, Dec 14, 2022.

  1. FVS

    FVS

    Joined:
    Aug 10, 2015
    Posts:
    58
    So, I've been changing the script of a MonoBehaviour by using debug mode of the inspector and dragging the new script to the Script field. It worked and was super useful. But now in Unity 2022.2.0, I've just discovered that the Script field is disabled even in debug inspector.

    Do you guys plan to bring the feature back at some point? Or do you recommend an alternative way to change the script of a MonoBehaviour?

    Thank you,
     
    mangorock and Sarai like this.
  2. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    I just noticed this too!
     
  3. FVS

    FVS

    Joined:
    Aug 10, 2015
    Posts:
    58
    Did you come up with any work around?
     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,910
    What's wrong with just removing and adding the correct component?
     
  5. FVS

    FVS

    Joined:
    Aug 10, 2015
    Posts:
    58
    Sure you can, but it would take a lot more work (to refill the value and reconnect the reference to the script).
     
  6. Sarai

    Sarai

    Joined:
    Jul 20, 2014
    Posts:
    30
    Downgrade Unity hehe
     
  7. FVS

    FVS

    Joined:
    Aug 10, 2015
    Posts:
    58
    Any official update on this?
     
  8. Grhyll

    Grhyll

    Joined:
    Oct 15, 2012
    Posts:
    119
    Just realized this as well :/
    You can always modify manually the script guid in the serialized asset if you use text serialization.
    Get the guid of the former script you used and the guid of the new one, and swap them where needed in a text editor. (You can find the guid either in the meta files, or from a script - for example, in order to get the guid of the currently selected script: AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(Selection.activeObject.GetInstanceID())) )
     
  9. FVS

    FVS

    Joined:
    Aug 10, 2015
    Posts:
    58
    Thanks. Still hope the drag-and-drop will be back sometime.
     
  10. Grhyll

    Grhyll

    Joined:
    Oct 15, 2012
    Posts:
    119
    Yup that would be more convenient!
     
    FVS likes this.
  11. Rafael_CS

    Rafael_CS

    Joined:
    Sep 16, 2013
    Posts:
    162
    UP, we need replace script reference back, its very useful to replace inherited mono behaviours without break references