Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Seeking solution for Referenced Script (Unknown) on Behaviour (Game Object '<null>')

Discussion in 'Scripting' started by thesupersoup, Jan 17, 2021.

  1. thesupersoup

    thesupersoup

    Joined:
    Nov 27, 2017
    Posts:
    70
    If this bug has an actual impact on the build, I have yet to find it, but nonetheless I'd like to get to the bottom of it and eliminate it if possible.

    In the standalone build for the game, I get slammed with the following in the Player.log when loading particular scenes:

    The referenced script (Unknown) on this Behaviour is missing!
    (Filename: Line: 198)

    The referenced script on this Behaviour (Game Object '<null>') is missing!
    (Filename: Line: 334)

    A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 44 bytes but expected 68544 bytes)
    Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    (Filename: Line: 2375)


    It repeats several dozen times, with different expected bytes from the scripted object each time. I don't know where to start because the script and GameObject errors don't give me any actionable intel.

    Any suggestions?
     
  2. TheOtherUserName

    TheOtherUserName

    Joined:
    May 30, 2020
    Posts:
    136
    do all these errors occur from the same script? Or does the console literally say 'Filename' before the line?
     
  3. thesupersoup

    thesupersoup

    Joined:
    Nov 27, 2017
    Posts:
    70
    Literally says Filename, I have no idea if they're the same script or not. So at least one if not more "Unknown" scripts involved.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    If you move a script outside of Unity or if you remove a script that was referenced in a scene or project you can get this error.

    At runtime, click on the error message and it should highlight the GameObject involved. That can help you track down which prefab or scene it came from and reason about what the script is. Unfortunately Unity is not helpful in terms of giving you the classname.
     
  5. thesupersoup

    thesupersoup

    Joined:
    Nov 27, 2017
    Posts:
    70
    The error doesn't appear in Editor, only in build. Also notice the GameObject reference is "null."
     
  6. thesupersoup

    thesupersoup

    Joined:
    Nov 27, 2017
    Posts:
    70
    Bump, still hoping for a lead
     
    Menion-Leah and Polyfemos like this.
  7. Menion-Leah

    Menion-Leah

    Joined:
    Nov 5, 2014
    Posts:
    189
    Same here!
    Tried with any possible editor script to detect missing scripts/dependencies, checked every #if...
    No luck.

    Doesn't seem to affect the (Android) build either, though.

    Unity 2019.4.21f1