These are the file contents for a Unity scene
--- !u!1 &341095427
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 143402, guid: e58d4c3907fdc484faf3ab7001288374, type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 341095443}
m_Layer: 8
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
The serialized Id for this object is on the first line (341095427). My script is an editor invoked from a Unity menu. I am iterating through all of the GameObjects in the currently active scene. Is there a way to get the above Id for a GameObject? Unfortunately GetInstanceID() returns a different value.