@@ -452,42 +452,35 @@ private void HandleInputDevicesConnected(InputDevice device)
452
452
}
453
453
profiles = null ;
454
454
// TODO: Find a better way to get device profile
455
- if ( device . manufacturer == "Oculus" )
455
+ string profileName = "generic" ;
456
+ bool addedFeatures = false ;
457
+ float tempFloat = 0 ;
458
+ Vector2 tempVec2 = Vector2 . zero ;
459
+ if ( device . TryGetFeatureValue ( CommonUsages . trigger , out tempFloat ) )
456
460
{
457
- profiles = new string [ ] { "oculus-touch-v2" } ;
461
+ profileName += "-trigger" ;
462
+ addedFeatures = true ;
458
463
}
459
- else
464
+ if ( device . TryGetFeatureValue ( CommonUsages . grip , out tempFloat ) )
460
465
{
461
- string profileName = "generic" ;
462
- bool addedFeatures = false ;
463
- float tempFloat = 0 ;
464
- Vector2 tempVec2 = Vector2 . zero ;
465
- if ( device . TryGetFeatureValue ( CommonUsages . trigger , out tempFloat ) )
466
- {
467
- profileName += "-trigger" ;
468
- addedFeatures = true ;
469
- }
470
- if ( device . TryGetFeatureValue ( CommonUsages . grip , out tempFloat ) )
471
- {
472
- profileName += "-squeeze" ;
473
- addedFeatures = true ;
474
- }
475
- if ( device . TryGetFeatureValue ( CommonUsages . secondary2DAxis , out tempVec2 ) )
476
- {
477
- profileName += "-touchpad" ;
478
- addedFeatures = true ;
479
- }
480
- if ( device . TryGetFeatureValue ( CommonUsages . primary2DAxis , out tempVec2 ) )
481
- {
482
- profileName += "-thumbstick" ;
483
- addedFeatures = true ;
484
- }
485
- if ( ! addedFeatures )
486
- {
487
- profileName += "-button" ;
488
- }
489
- profiles = new string [ ] { profileName } ;
466
+ profileName += "-squeeze" ;
467
+ addedFeatures = true ;
490
468
}
469
+ if ( device . TryGetFeatureValue ( CommonUsages . secondary2DAxis , out tempVec2 ) )
470
+ {
471
+ profileName += "-touchpad" ;
472
+ addedFeatures = true ;
473
+ }
474
+ if ( device . TryGetFeatureValue ( CommonUsages . primary2DAxis , out tempVec2 ) )
475
+ {
476
+ profileName += "-thumbstick" ;
477
+ addedFeatures = true ;
478
+ }
479
+ if ( ! addedFeatures )
480
+ {
481
+ profileName += "-button" ;
482
+ }
483
+ profiles = new string [ ] { profileName } ;
491
484
TryUpdateButtons ( ) ;
492
485
SetControllerActive ( true ) ;
493
486
}
0 commit comments