void Awake()
 {
     netManager = GetComponent <NATTraversal.NetworkManager>();
 }
        protected void Init()
        {
            if (m_Initialized)
            {
                return;
            }
            m_Initialized    = true;
            m_NetworkManager = target as NATTraversal.NetworkManager;

            m_ShowNetworkLabel       = new GUIContent("Network Info", "Network host names and ports");
            m_ShowSpawnLabel         = new GUIContent("Spawn Info", "Registered spawnable objects");
            m_OfflineSceneLabel      = new GUIContent("Offline Scene", "The scene loaded when the network goes offline (disconnected from server)");
            m_OnlineSceneLabel       = new GUIContent("Online Scene", "The scene loaded when the network comes online (connected to server)");
            m_DontDestroyOnLoadLabel = new GUIContent("Dont Destroy On Load", "Persist the network manager across scene changes.");
            m_RunInBackgroundLabel   = new GUIContent("Run in Background", "This ensures that the application runs when it does not have focus. This is required when testing multiple instances on a single machine, but not recommended for shipping on mobile platforms.");
            m_ScriptCRCCheckLabel    = new GUIContent("Script CRC Check", "Enables a CRC check between server and client that ensures the NetworkBehaviour scripts match. This may not be appropriate in some cases, such a when the client and server are different Unity projects.");

            m_MaxConnectionsLabel    = new GUIContent("Max Connections", "Maximum number of network connections");
            m_MinUpdateTimeoutLabel  = new GUIContent("Min Update Timeout", "Minimum time network thread waits for events");
            m_ConnectTimeoutLabel    = new GUIContent("Connect Timeout", "Time to wait for timeout on connecting");
            m_DisconnectTimeoutLabel = new GUIContent("Disconnect Timeout", "Time to wait for detecting disconnect");
            m_PingTimeoutLabel       = new GUIContent("Ping Timeout", "Time to wait for ping messages");

            m_ThreadAwakeTimeoutLabel             = new GUIContent("Thread Awake Timeout", "The minimum time period when system will check if there are any messages for send (or receive).");
            m_ReactorModelLabel                   = new GUIContent("Reactor Model", "Defines reactor model for the network library");
            m_ReactorMaximumReceivedMessagesLabel = new GUIContent("Reactor Max Recv Messages", "Defines maximum amount of messages in the receive queue");
            m_ReactorMaximumSentMessagesLabel     = new GUIContent("Reactor Max Sent Messages", "Defines maximum message count in sent queue");

            m_MaxBufferedPacketsLabel   = new GUIContent("Max Buffered Packets", "The maximum number of packets that can be buffered by a NetworkConnection for each channel. This corresponds to the 'ChannelOption.MaxPendingBuffers' channel option.");
            m_AllowFragmentationLabel   = new GUIContent("Packet Fragmentation", "This allow NetworkConnection instances to fragment packets that are larger than the maxPacketSize, up to a maximum of 64K. This can cause delays in sending large packets, but is usually preferable to send failures.");
            m_UseWebSocketsLabel        = new GUIContent("Use WebSockets", "This makes the server listen for connections using WebSockets. This allows WebGL clients to connect to the server.");
            m_UseSimulatorLabel         = new GUIContent("Use Network Simulator", "This simulates network latency and packet loss on clients. Useful for testing under internet-like conditions");
            m_LatencyLabel              = new GUIContent("Simulated Average Latency", "The amount of delay in milliseconds to add to network packets");
            m_PacketLossPercentageLabel = new GUIContent("Simulated Packet Loss", "The percentage of packets that should be dropped");
            m_MatchHostLabel            = new GUIContent("MatchMaker Host URI", "The URI for the MatchMaker.");
            m_MatchPortLabel            = new GUIContent("MatchMaker Port", "The port for the MatchMaker.");
            m_MatchNameLabel            = new GUIContent("Match Name", "The name that will be used when creating a match in MatchMaker.");
            m_MatchSizeLabel            = new GUIContent("Maximum Match Size", "The maximum size for the match. This value is compared to the maximum size specified in the service configuration at multiplayer.unity3d.com and the lower of the two is enforced. It must be greater than 1. This is typically used to override the match size for various game modes.");

            // top-level properties
            m_DontDestroyOnLoadProperty = serializedObject.FindProperty("m_DontDestroyOnLoad");
            m_RunInBackgroundProperty   = serializedObject.FindProperty("m_RunInBackground");
            m_ScriptCRCCheckProperty    = serializedObject.FindProperty("m_ScriptCRCCheck");
            m_LogLevelProperty          = serializedObject.FindProperty("m_LogLevel");

            // network foldout properties
            m_NetworkAddressProperty     = serializedObject.FindProperty("m_NetworkAddress");
            m_NetworkPortProperty        = serializedObject.FindProperty("m_NetworkPort");
            m_ServerBindToIPProperty     = serializedObject.FindProperty("m_ServerBindToIP");
            m_ServerBindAddressProperty  = serializedObject.FindProperty("m_ServerBindAddress");
            m_MaxDelayProperty           = serializedObject.FindProperty("m_MaxDelay");
            m_MaxBufferedPacketsProperty = serializedObject.FindProperty("m_MaxBufferedPackets");
            m_AllowFragmentationProperty = serializedObject.FindProperty("m_AllowFragmentation");
            m_MatchHostProperty          = serializedObject.FindProperty("m_MatchHost");
            m_MatchPortProperty          = serializedObject.FindProperty("m_MatchPort");
            m_MatchNameProperty          = serializedObject.FindProperty("matchName");
            m_MatchSizeProperty          = serializedObject.FindProperty("matchSize");

            // spawn foldout properties
            m_PlayerPrefabProperty      = serializedObject.FindProperty("m_PlayerPrefab");
            m_AutoCreatePlayerProperty  = serializedObject.FindProperty("m_AutoCreatePlayer");
            m_PlayerSpawnMethodProperty = serializedObject.FindProperty("m_PlayerSpawnMethod");
            m_SpawnListProperty         = serializedObject.FindProperty("m_SpawnPrefabs");

            m_SpawnList = new ReorderableList(serializedObject, m_SpawnListProperty);
            m_SpawnList.drawHeaderCallback    = DrawHeader;
            m_SpawnList.drawElementCallback   = DrawChild;
            m_SpawnList.onReorderCallback     = Changed;
            m_SpawnList.onAddDropdownCallback = AddButton;
            m_SpawnList.onRemoveCallback      = RemoveButton;
            m_SpawnList.onChangedCallback     = Changed;
            m_SpawnList.onReorderCallback     = Changed;
            m_SpawnList.onAddCallback         = Changed;
            m_SpawnList.elementHeight         = 16; // this uses a 16x16 icon. other sizes make it stretch.

            // network configuration
            m_CustomConfigProperty              = serializedObject.FindProperty("m_CustomConfig");
            m_ChannelListProperty               = serializedObject.FindProperty("m_Channels");
            m_ChannelList                       = new ReorderableList(serializedObject, m_ChannelListProperty);
            m_ChannelList.drawHeaderCallback    = ChannelDrawHeader;
            m_ChannelList.drawElementCallback   = ChannelDrawChild;
            m_ChannelList.onReorderCallback     = ChannelChanged;
            m_ChannelList.onAddDropdownCallback = ChannelAddButton;
            m_ChannelList.onRemoveCallback      = ChannelRemoveButton;
            m_ChannelList.onChangedCallback     = ChannelChanged;
            m_ChannelList.onReorderCallback     = ChannelChanged;
            m_ChannelList.onAddCallback         = ChannelChanged;

            // Network Simulator
            m_UseWebSocketsProperty        = serializedObject.FindProperty("m_UseWebSockets");
            m_UseSimulatorProperty         = serializedObject.FindProperty("m_UseSimulator");
            m_SimulatedLatencyProperty     = serializedObject.FindProperty("m_SimulatedLatency");
            m_PacketLossPercentageProperty = serializedObject.FindProperty("m_PacketLossPercentage");
        }