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

The referenced script on this Behaviour (Game Object 'SceneIDMap') is missing!

Discussion in 'Graphics Experimental Previews' started by dgoyette, May 28, 2019.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    I get this warning every time I enter play mode in a certain scene:

    The referenced script on this Behaviour (Game Object 'SceneIDMap') is missing!

    I can't find an object in my scene named SceneIDMap, so I assume it's hidden somehow. Clicking on the warning doesn't select the object either.

    I see that this game object "SceneIDMap" is described in SceneObjectIDMap.cs here:
    https://github.com/Unity-Technologi...inition/Runtime/Utilities/SceneObjectIDMap.cs

    Is there something I can do to prevent this warning?
     
    chaoliu2333 and junctionboss like this.
  2. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    50
    same issue here...
     
    junctionboss likes this.
  3. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    same for me , using 2019.1f4
     
    junctionboss likes this.
  4. douglima

    douglima

    Joined:
    Apr 26, 2017
    Posts:
    10
    same here, is there any solution?
     
    junctionboss likes this.
  5. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    I think I must have mentioned this in another thread on this issue, but for me the solution was to manually edit the Scene file, and remove the gameobject named "SceneIDMap", along with a couple of other child gameobjects of it. I haven't seen this in a while, so my guess is that some version of HDRP might have been creating these hidden game objects, which remained in a couple of my scenes.
     
  6. douglima

    douglima

    Joined:
    Apr 26, 2017
    Posts:
    10
    Thanks! I managed to find and destroy this hidden gameobject.

    Code (CSharp):
    1. Selection.activeGameObject = GameObject.Find("SceneIDMap");
    2. DestroyImmediate(Selection.activeGameObject);
     
  7. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    how do u use your script?
     
  8. douglima

    douglima

    Joined:
    Apr 26, 2017
    Posts:
    10
    I made a button inside a custom inspector.

    Code (CSharp):
    1. [CustomEditor(typeof(MyScript))]
    2.     public class MyScriptEditor : Editor
    3.     {
    4.         public override void OnInspectorGUI()
    5.         {
    6.             DrawDefaultInspector();
    7.  
    8.             if (GUILayout.Button("Find and Kill SceneIDMap"))
    9.             {
    10.                 Selection.activeGameObject = GameObject.Find("SceneIDMap");
    11.                 DestroyImmediate(Selection.activeGameObject);
    12.             }
    13.         }
    14.     }
     
    MrJohnWeez and Mister-D like this.
  9. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    ive fixed it by deleting the samplescene files that get installed when using hdrp
     
    junctionboss likes this.
  10. Devourerofmemes

    Devourerofmemes

    Joined:
    Oct 30, 2013
    Posts:
    4
    Which file names specifically? I'm having this same issue.
     
    junctionboss likes this.
  11. Mister-D

    Mister-D

    Joined:
    Dec 6, 2011
    Posts:
    1,694
    when setting up hdrp it created a folder called scenes(it contained a samplescene file). but none of my assets where in that folder so i deleted it and the warning was gone.
     
  12. Devourerofmemes

    Devourerofmemes

    Joined:
    Oct 30, 2013
    Posts:
    4
    Thanks Mister-D, I still had the object in my scene even after deleting the scenes folder from hdrp. However opening up my scene file in a text editor and cutting out the text below removed it.

    Code (CSharp):
    1. --- !u!1 &998857091
    2. GameObject:
    3.   m_ObjectHideFlags: 19
    4.   m_CorrespondingSourceObject: {fileID: 0}
    5.   m_PrefabInstance: {fileID: 0}
    6.   m_PrefabAsset: {fileID: 0}
    7.   serializedVersion: 6
    8.   m_Component:
    9.   - component: {fileID: 998857093}
    10.   - component: {fileID: 998857092}
    11.   m_Layer: 0
    12.   m_Name: SceneIDMap
    13.   m_TagString: Untagged
    14.   m_Icon: {fileID: 0}
    15.   m_NavMeshLayer: 0
    16.   m_StaticEditorFlags: 0
    17.   m_IsActive: 1
    18. --- !u!114 &998857092
    19. MonoBehaviour:
    20.   m_ObjectHideFlags: 19
    21.   m_CorrespondingSourceObject: {fileID: 0}
    22.   m_PrefabInstance: {fileID: 0}
    23.   m_PrefabAsset: {fileID: 0}
    24.   m_GameObject: {fileID: 998857091}
    25.   m_Enabled: 1
    26.   m_EditorHideFlags: 0
    27.   m_Script: {fileID: 1931278225}
    28.   m_Name:
    29.   m_EditorClassIdentifier:
    30.   m_Entries: []
    31. --- !u!4 &998857093
    32. Transform:
    33.   m_ObjectHideFlags: 19
    34.   m_CorrespondingSourceObject: {fileID: 0}
    35.   m_PrefabInstance: {fileID: 0}
    36.   m_PrefabAsset: {fileID: 0}
    37.   m_GameObject: {fileID: 998857091}
    38.   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
    39.   m_LocalPosition: {x: 0, y: 0, z: 0}
    40.   m_LocalScale: {x: 1, y: 1, z: 1}
    41.   m_Children: []
    42.   m_Father: {fileID: 0}
    43.   m_RootOrder: 14
    44.   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
    45.  
     
  13. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    Just add this class:

    using UnityEditor;
    using UnityEngine;

    public class RemoveSceneIDMap : MonoBehaviour
    {
    [MenuItem("Tools/SceneIDMap Fixer")]
    public static void KillSceneIdMap()
    {
    var obj = GameObject.Find("SceneIDMap");
    if (obj != null)
    {
    DestroyImmediate(obj);
    Debug.Log("Cleared a SceneIDMap instance");
    }
    }
    }

    It will add a menu item under Tools. Just click to fix. Also, if you have more than one of those objects, just run it more than once, until it stops saying it cleared an instance.
     
  14. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    50
    double click the error in playmode, that will select the object, go back to edit mode and hit delete. save the scene. that worked for me
     
    Wrakyz and id0 like this.
  15. decimate_3d

    decimate_3d

    Joined:
    Sep 24, 2011
    Posts:
    15
    There's a file in "Library/PackageCache/com.unity.render-pipelines.high-definition@7.0.1/Runtime/Utilities/SceneObjectIDMap.cs"
     
  16. leonidasos

    leonidasos

    Joined:
    Oct 26, 2014
    Posts:
    2
    or search some objects with specific flags (see HidenFlags) on scene to unhide them and do whatever you want. Just add a script to empty game object and click run

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5.  
    6. [ExecuteInEditMode]
    7. public class ShowHidden : MonoBehaviour
    8. {
    9.     [SerializeField] private bool run;
    10.  
    11.     void Update()
    12.     {
    13.      if(run)  {
    14.          var objects = SceneManager.GetActiveScene().GetRootGameObjects();
    15.          var hideFlags = HideFlags.DontSaveInBuild | HideFlags.HideInHierarchy | HideFlags.HideInInspector;
    16.  
    17.          foreach (var item in objects)
    18.          {        
    19.              if(item.gameObject.hideFlags.Equals(hideFlags) ) {
    20.                 Debug.Log($"Hidden object is {item.name}");
    21.                 item.gameObject.hideFlags = HideFlags.None;
    22.              }
    23.          }
    24.          run = false;
    25.      }
    26.     }
    27. }
     
    oliran and customphase like this.
  17. Symo7

    Symo7

    Joined:
    Mar 2, 2014
    Posts:
    23
    To necro this a bit, 8.0.1 of HDRP has a menu option Edit -> Render Pipeline -> Fix Warning 'referenced script (Game Object 'SceneIDMap') is missing' in loaded scenes. This sorted it for me (Unity 2020.1.0b2.3333)
     
  18. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    97
    This also exists in 7.x in unity 2019.3
     
  19. gdespaux2010

    gdespaux2010

    Joined:
    Feb 16, 2017
    Posts:
    34
    Unfortunately this doesn't exist in the URP package, which seems a more likely place to need it. I converted from HDRP to URP and started getting this warning, so that tool would have been really useful. I ended up fixing it by carefully editing the scene itself in a text editor as described above.

    I assume you'd be able to get the same result by narrowing down the file that gives you that tool in HDRP, and manually adding it to your project (If you're using URP as I am)
     
  20. MrJohnWeez

    MrJohnWeez

    Joined:
    Aug 31, 2013
    Posts:
    11
    This does work.
    1. Change MyScript to Transform or RectTransform
    2. Change SceneIDMap to the GameObject that is causing problems
    3. Go into the editor and find any Transform within the inspector and press button
     
  21. GameDeveloper1111

    GameDeveloper1111

    Joined:
    Jul 24, 2020
    Posts:
    100
    For those using HDRP, there's an official one button fix for this issue:

    sceneidmap.png

    Source:
    https://docs.unity3d.com/Packages/c...1/manual/Upgrading-from-2019.2-to-2019.3.html

    Edit:

    In 2020.2:

    upload_2021-1-19_21-54-18.png
     
    Last edited: Jan 20, 2021
    avataris-io, Sokolovkyi, cp- and 3 others like this.
  22. Wrakyz

    Wrakyz

    Joined:
    Jan 29, 2019
    Posts:
    12
    (The best and easiest solution)... Thanks a lot
     
    LordBinz and ZoeDreams like this.
  23. GameDeveloper1111

    GameDeveloper1111

    Joined:
    Jul 24, 2020
    Posts:
    100
    This worked for me for URP. Thank you.

    About other solutions: The GameObject was hidden so I couldn't double click to it from the console. And there was no menu option to solve this like with HDRP.
     
  24. DKV_BY

    DKV_BY

    Joined:
    Sep 13, 2020
    Posts:
    1
    Thank you friend!!!! It helped me! So pissed off this message. Now everything is fine, thanks again !!!