public void MaskObject(GameObject gameObj)
 {
     _maskedObjects.Add(gameObj);
     if (_gameObjectToNode.ContainsKey(gameObj))
     {
         _sphereTree.RemoveNode(_gameObjectToNode[gameObj]);
         _gameObjectToNode.Remove(gameObj);
     }
     if (_gameObjectToTransformData.ContainsKey(gameObj))
     {
         _gameObjectToTransformData.Remove(gameObj);
     }
 }
        /// <summary>
        /// Removes any terminal nodes from the tree that have null object references.
        /// </summary>
        private void RemoveNullObjectNodes()
        {
            // Loop through each dictionaty entry
            var newObjectToNodeDictionary = new Dictionary <GameObject, SphereTreeNode <GameObject> >();

            foreach (var pair in _gameObjectToNode)
            {
                // If the key is null, remove the node, otherwise store this node in the new dictionary
                if (pair.Key == null)
                {
                    _sphereTree.RemoveNode(pair.Value);
                }
                else
                {
                    newObjectToNodeDictionary.Add(pair.Key, pair.Value);
                }
            }

            // Adjust the dictionary reference to point to the new one which doesn't contain any null object nodes.
            _gameObjectToNode = newObjectToNodeDictionary;
        }