public void UpdateGameObjectReferences() { // Iterate through the entire scene graph and check each GameObjectReference // If the Target is null or its root is not the Game node, remove the Reference to it IList <DomNode> removeList = new List <DomNode>(); MasterContext.CollectInvalidGameObjectReference(removeList); foreach (IGameDocument subDoc in m_gameDocumentRegistry.SubDocuments) { GameContext subContext = subDoc.Cast <GameContext>(); subContext.CollectInvalidGameObjectReference(removeList); } foreach (DomNode domNode in removeList) { domNode.RemoveFromParent(); } }