Search Feedback

27
votes

Joystick

Input

-

-

Unity should have a build in function to know what joystick was
disconnected in runtime and a function to use joystick vibration

Comments (4)

  1. Ae35ad0a054f617b0fc12d69542807e6?d=mm

    AustinK

    Nov 14, 2014 20:42

    Late to the party but I figured I'd share this work around for now...

    So right now we have a list of controllers, and that's it. So, what I'm thinking we can do is just have something that at game start (not application start since the player should be allowed to plug and unplug at the main menu) stores the controller count (Input.GetJoystickNames().Length), and every update if that count changes then we've either had a connect or disconnect of a controller. Either way, you can send an event out or just handle this directly in whatever class you have doing the check.

    I would just lock the game, keep waiting for the count to change back to the original count at game start, then go ahead and resume the game... BUT resume the game after you've gone through and made sure a different controller type was connected (since mappings can change from one controller to another), and if it is a different one, assign a new input reader to your player that deals with the correct mapping scheme for that controller type.

    Hopefully this makes sense...

  2. 6f3f378688bd24c02ba80ee1b55b3b74?d=mm

    Bezzy

    Sep 26, 2013 11:09

    Connected AND disconnected events, which pass through an id for the device (so that you can check for the same controller being plugged back in after a disconnect).

    This is required behaviour for XBox/PS3 TRC/TCRs so it seems strange it's not available cross platform? Maybe it's because Mac/Linux drivers for XBox controllers are third party, so it's hard to do it in a universal cross platform way?

  3. 4284d904076301e5370f9b687b77344c?d=mm

    Citizen #38464

    Jan 30, 2013 21:09

    i gave 2 votes XD

  4. 4284d904076301e5370f9b687b77344c?d=mm

    Citizen #38464

    Jan 30, 2013 21:06

    wow thiis is anything that can be realy cool ! i realy need it for many of my game ideas!

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(9031)

2D

(221)

Ads

(40)

AI & Navigation

(67)

Analytics

(92)

Animation

(304)

Asset Store

(222)

Assets

(489)

Audio

(157)

Cloud Build

(94)

Collaborate

(31)

Docs & Tutorials

(197)

Editor

(2084)

Everyplay

(13)

Game Performance Reporting

(12)

General

(810)

Graphics

(761)

GUI

(363)

Input

(145)

Licensing

(73)

Networking

(158)

Physics

(341)

Platforms

(402)

Profiling & Optimization

(69)

Runtime

(161)

Scripting

(1014)

Terrain

(152)

WebGL

(131)