Runtime get data from script component with missing script

My situation is very complex, but long story short I have a script component with no attached script, but attached data. There is no way around this situation, I CANNOT restore the script, and it is iMPOSSIBLE to change my strategy (this is a Unity bug to do with asset bundling). Unless you have a solution that involves hacking how the assets are imported so that script is attached properly, (instead of, for instance, a change to my underlying strategy), please take my word for this.

The bottom line is, I need to access data from this script component, as it DOES still have variable data, the script is just missing. My idea is to gather up the script’s data, and then add a new instance of the script, and finally put in all of the original data. The problem is that, even when using GameObject.GetAllComponents() the components with the missing scripts are being returned as null! Therefore it is IMPOSSIBLE to access the data! It’s very frustrating, because I can see within the editor that the component has successfully retained its data from the import, but Unity is not giving me any method of accessing this data! I even tried decompiling the Unity dlls to see if I could find any method of getting access to the components form there, but I found nothing that stood out…

Does anyone know how I can access the data from a script component which has a missing script?

EDIT: I am sorry, I just realized how vague this was. LEt me clear up a few things:

  1. The assets I refer to are asset bundles (a relative to packages, but these are importable at runtime)
  2. The asset bundles are user-made worlds made from an older version of Unity, I do not have access to the source.
  3. The script switch-out needs to be done at runtime when the player loads one of the custom made worlds.
  4. I know exactly what script to replace the current script with, but I currently have no way of returning the script, as, according to my code, the components in question are null (even though they have data)

Hi Flynn,
I have the same problem as you

Did you find a solution ?

I have one :

  1. Make a script named
  2. Integrate it in the build of the
  3. In each of your asset bundle for
    streamed scene, before building,
    just add a script named “denounceMissingScript.cs” automatically (via script)
    on each GameObject containing a
    script. This “denounceMissingScript.cs” script is used to get and store
    the name of scripts supposed to be in the bundle.
  4. As you know, a bundle (true for scenes and prefab) keep reference on the name of scripts and its public value.
  5. So when your bundle is loaded,
    it will found in the application
    “denounceMissingScript.cs” and this
    script also restored will be
    exploitable to get back the name of
    the missing script

Another things, with bundle of prefab you can get back without “denounceMissingScript” the name of missing scripts by getting the components of type Monobehaviour present in the loaded AssetBundle via loadAll. Just find the name of your script via o.GetType()

    foreach (UnityEngine.Object o in m_objects)
        Debug.Log( + "|" + o.GetType() + "|" + m_objects.Count);

Edit : Or perharps this can help

@PommPoirAbricot Hey. Could you give some more exp?