void Start()
    {
        controller = GetComponent<CharacterController>();
        menu = GetComponent<ExampleMenu>();

        // hide the cursor
        Cursor.visible = false;
    }
示例#2
0
    void Start()
    {
        controller = GetComponent <CharacterController>();
        menu       = GetComponent <ExampleMenu>();

        // hide the cursor
        Cursor.visible = false;
    }
示例#3
0
    /// <summary>
    /// Keep only one instance of this object.
    /// </summary>

    void Awake()
    {
        if (Application.isPlaying)
        {
            if (mInst == null)
            {
                mInst = this;
                DontDestroyOnLoad(gameObject);
            }
            else
            {
                Destroy(gameObject);
            }
        }
    }
示例#4
0
    /// <summary>
    /// Keep only one instance of this object.
    /// </summary>

    void Awake()
    {
        if (Application.isPlaying)
        {
            // Choose IPv6 or IPv4
            TcpProtocol.defaultListenerInterface = (addressFamily == IPType.IP_v_6) ? System.Net.IPAddress.IPv6Any : System.Net.IPAddress.Any;

            // TNet will automatically switch UDP to IPv6 if TCP uses it, but you can specify an explicit one if you like
            //UdpProtocol.defaultNetworkInterface = useIPv6 ? System.Net.IPAddress.IPv6Any : System.Net.IPAddress.Any;

            if (mInst == null)
            {
                mInst = this;
                DontDestroyOnLoad(gameObject);
            }
            else
            {
                Destroy(gameObject);
            }
        }
    }