コード例 #1
0
    private void Awake()
    {
        if (Instance == null)
        {
            string contName = "";
            for (int i = 0; i < Input.GetJoystickNames().Length; i++)
            {
                if (Input.GetJoystickNames()[i] != "")
                {
                    contName = Input.GetJoystickNames()[i];
                    break;
                }
            }

            //Debug.Log("接続しているコントローラーは " + contName + " です。");
            stick.Init();
            button.Init();
            buttonDown.Init();
            IsPS4Controller = !(contName == "Controller (XBOX 360 For Windows)");
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }