/// <summary>
        /// Look up the internal GameObject for an object by object id and
        /// return the C# object state for it.
        ///
        /// The routine does not create the object state for an object id
        /// that is valid but unrecognized to us (i.e. that we have not yet
        /// seen even though it exists engine-side).
        /// </summary>
        /// <param name="ObjectId">Supplies the object id to look up.</param>
        /// <returns>The corresponding C# object state, else null.</returns>
        public GameObject GetGameObject(uint ObjectId)
        {
            GameObject GameObj;

            if (ObjectId == CLRScriptBase.OBJECT_INVALID)
            {
                return(null);
            }

            if (!GameObjectTable.TryGetValue(ObjectId, out GameObj))
            {
                return(null);
            }

            //
            // Even though we have a record of the object in our lookup table,
            // the engine may have already removed its representation of the
            // object.  In that case, pretend that the object state doesn't
            // exist for purposes of by-object-id lookups.
            //

            if (!GameObj.Exists)
            {
                return(null);
            }

            return(GameObj);
        }
        /// <summary>
        /// Resolve an object ID to a GameObject without checking for deleted
        /// objects that need garbage collection.  This function should only
        /// be used by the PowerShell diagnostics infrastructure.
        /// </summary>
        /// <param name="ObjectId">Supplies the object id to look up.</param>
        /// <returns>The object in question, else null.</returns>
        internal GameObject GetGameObjectUnsafe(uint ObjectId)
        {
            GameObject GameObj;

            if (ObjectId == CLRScriptBase.OBJECT_INVALID)
            {
                return(null);
            }

            if (!GameObjectTable.TryGetValue(ObjectId, out GameObj))
            {
                return(null);
            }

            return(GameObj);
        }