Example #1
0
        /// <summary>
        /// Shutdowns and unloads ENet's library
        /// </summary>
        /// <param name="delete">Specifies whether the ENet dynamic library should be removed or not from disk.</param>
        /// <remarks>
        /// Any interaction with ENet managed wrapper instances like <see cref="ENetHost"/> should be avoided
        /// after calling this method. <br/>
        /// Parameter <paramref name="delete"/> is only considered when the library is loaded from the resources.
        /// </remarks>
        public static void Shutdown(bool delete = true)
        {
            if (!Started)
            {
                return;
            }
            Started = false;

            LibENet.Unload();
            if (delete)
            {
                LibENet.TryDelete();
            }

            s_Allocator?.Dispose();
            s_Allocator = null;
        }