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

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-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.high-definition/Runtime/Utilities/SceneObjectIDMap.cs

Is there something I can do to prevent this warning?

2 Likes

same issue here...

1 Like

same for me , using 2019.1f4

1 Like

same here, is there any solution?

1 Like

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.

Thanks! I managed to find and destroy this hidden gameobject.

Selection.activeGameObject = GameObject.Find("SceneIDMap");
DestroyImmediate(Selection.activeGameObject);

how do u use your script?

I made a button inside a custom inspector.

[CustomEditor(typeof(MyScript))]
    public class MyScriptEditor : Editor
    {
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            if (GUILayout.Button("Find and Kill SceneIDMap"))
            {
                Selection.activeGameObject = GameObject.Find("SceneIDMap");
                DestroyImmediate(Selection.activeGameObject);
            }
        }
    }
2 Likes

ive fixed it by deleting the samplescene files that get installed when using hdrp

1 Like

Which file names specifically? I’m having this same issue.

1 Like

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.

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.

--- !u!1 &998857091
GameObject:
  m_ObjectHideFlags: 19
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  serializedVersion: 6
  m_Component:
  - component: {fileID: 998857093}
  - component: {fileID: 998857092}
  m_Layer: 0
  m_Name: SceneIDMap
  m_TagString: Untagged
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_StaticEditorFlags: 0
  m_IsActive: 1
--- !u!114 &998857092
MonoBehaviour:
  m_ObjectHideFlags: 19
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 998857091}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 1931278225}
  m_Name:
  m_EditorClassIdentifier:
  m_Entries: []
--- !u!4 &998857093
Transform:
  m_ObjectHideFlags: 19
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 998857091}
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
  m_LocalPosition: {x: 0, y: 0, z: 0}
  m_LocalScale: {x: 1, y: 1, z: 1}
  m_Children: []
  m_Father: {fileID: 0}
  m_RootOrder: 14
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
3 Likes

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 Likes

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

2 Likes

There's a file in "Library/PackageCache/com.unity.render-pipelines.high-definition@7.0.1/Runtime/Utilities/SceneObjectIDMap.cs"

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

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

[ExecuteInEditMode]
public class ShowHidden : MonoBehaviour
{
    [SerializeField] private bool run;

    void Update()
    {
     if(run)  {
         var objects = SceneManager.GetActiveScene().GetRootGameObjects();
         var hideFlags = HideFlags.DontSaveInBuild | HideFlags.HideInHierarchy | HideFlags.HideInInspector;

         foreach (var item in objects)
         {        
             if(item.gameObject.hideFlags.Equals(hideFlags) ) {
                Debug.Log($"Hidden object is {item.name}");
                item.gameObject.hideFlags = HideFlags.None;
             }
         }
         run = false;
     }
    }
}
2 Likes

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 Likes

This also exists in 7.x in unity 2019.3

4 Likes

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)

This does work.

  • Change MyScript to Transform or RectTransform
  • Change SceneIDMap to the GameObject that is causing problems
  • Go into the editor and find any Transform within the inspector and press button