Unity's new action-based input system for VR replaces the outdated device-based input by utilizing the Input System package, providing more predictable input across different controllers; to set it up, import the default input actions from the XR Interaction Toolkit package (version 0.10+), assign them as default sets to your left and right controllers in the Preset Manager with appropriate side identifiers, and add an Input Action Manager component to enable all actions within the action set.
Unity XR Toolkit: Configuring Action-Based Input Effectively
Added:hey there i hope you're doing well today we're going to be taking some time to look at the new action-based input for unity's xr toolkit where that's just a fancy phrase for we're going to be utilizing unity's new input system for our vr input and this is going to significantly differ from the device-based input that we've used up into this point if we want to look at that a little bit closer in engine here we right-click within our hierarchy we go down to xr you'll see that we have these xr rigs that are action based and then we'll go to our device based drop down here and we'll see that we have our rigs that we've been using up into this point that are all device based and this system is kind of being phased out i don't know exactly how long it's going to be available but as of right now when we're going to be getting input and tracking information that's all going to be coming from the input system to be more specific the new input system we will be taking a quick look at it so don't worry about that too much however it may not be clearly apparent how we can use these action-based rigs and which we will be going over in just a second but before we do let's actually look at some documentation where here we are on the unity xr input page and if you've ever looked up vr input you've probably come across this page at one point or another and you probably scrolled down to this input mappings table took one look at it and you were just like you know what maybe i'll do this another day though unity does take care of a lot of this for us as of right now we're still working on a more perfect solution to get predictable input across all of our different controllers and the new input system is going to help that be a little bit more clear but let's go down a little bit further where up into this point we've been using input features on devices where this line here may look fairly familiar where we're getting our input device and trying to get a feature in this case it's going to be our trigger and what our current value is and if you've watched any of my other videos on input managers and things like that you'll realize that this doesn't have a lot of functionality with it it just simply gives us the value without any up or down events or on value change or anything like that so there's actually a lot of work that's inherent with with this currently existing system now this does get the job done but obviously we can do a little bit better and this is where unity's new input system is going to take care of a lot of this for us and if we want a more official definition of this if we look at the xr interaction toolkit documentation we'll see that it gives us this action base versus device-based behaviors it says it is recommended that you use the action-based variant instead of the device-based variant to take advantage of the benefits that the input system package provides some features such as the xr device simulator are only supported when using actions where i haven't covered that yet but i will in a future video but that just basically rephrases what i already said where this new input system is going to do a lot of the heavy lifting for us and i'll link this page down in the description if you want a little bit more information on using actions and setting up your own custom behaviors because what we're going to be doing is just implementing the current default set that we have so let's go into unity so we can do that now that we're back in unity and we're over here in our hierarchy let's right click and let's go to xr and let's just hit room scale xr rig and it's through the floor and that bothers me so i'm going to reset that really quick and if we just expand the hierarchy here we'll see that on our left and right hand controllers we actually don't have any actions here and if you wanted to make your own action set and you wanted to reference it directly you could hit this check box and throw a little scriptable object in there that'll do the input for you but you may be thinking andrew i don't know how to do that i'm not familiar with this new input system i just want it to work and why would i need to go through and click all these things and set it up manually that's kind of a pain and i completely agree so let's see how we can actually make this a little bit easier so let's actually remove this xr rig let's go to our package manager go to the xr interaction toolkit you want to make sure you're at least using 0.10 and then you'll see here that we have our default input actions and we can hit import into project and you'll notice that it's going to give us this samples folder and it's going to give us all of these great default sets and our actions already set up for us so if we want to we can click in here and we'll see that we have these action maps for our headset as well as our left and our right hand where we're going to have these actions that are going to be outputting the position value for our headset the rotation and then for our actual input on our hands so we have the position in the rotation of the controller the input for selecting and activating and all that good stuff and the wonderful thing about this let's say let's go to our select here we'll notice that it's using a generic grip pressed on the xr controller if we wanted to say well maybe i want it on the vive controller when i press the primary button or something you can come in here you can add a binding go to the path we'll then go to xr controller and then in here we have more specific xr controllers where if it's available here we can just hit five one since i specifically said vive and then we could just use whichever input we wanted here if we wanted the trackpad pressed here and now anytime i want to select we can either use the grip pressed on a generic xr controller or specifically for revive we can do it when the trackpad is pressed so that's where the power of this really comes into play where we could be a little bit more deliberate with some of our inputs now we're going to delete this just in case there we go and now let's exit out of this and you may notice we also have these sort of default sets here well this will be a set of values that are going to automatically be used anytime we add a component or create a prefab that needs this sort of information and even though we have the default input actions in our project if we actually try and create a room scale rig again and we go to the controller we'll notice that it still hasn't been populated and this is because we actually need to set a default set for our controllers here so let's finally delete that again let's click on this guy and let's say add to action based controller default so we'll do that for the left controller for the right controller and i'll ignore the rest of this for right now since we're not going to be using it and what this does if we go to our project settings and our preset manager it's going to add these two little objects here for any time we're going to have an action based controller it's going to go look for these little objects here and populate our controllers with these values here alright and now that we got that out of the way we still need to do a few more things for this to work properly let's go to our preset manager and for these filters we actually need to type something in here if you notice that we have both this right in this left controller we need to type in either right or left so we know which object we want to apply these presets to so on our right controller we need to type right and then on our left controller we need to type left and with that let's finally go into our hierarchy and hopefully create our last xr rig so we'll go to our room scale xr rig we'll expand it and as you can see on our controllers here everything has already been set up for us and we're almost done we just need to do one more thing to make sure we're activating all of our actions you can either put this on its own game object or in the xr rig itself but we need to add a component which is going to be called input action manager and this is going to enable all of the actions within a particular action set so we'll set the size here to 1.
i'm going to hit the little dot here and we'll just have the xr ride default input actions right here so if we click that we'll see that it's populated and now when we start our project all of our actions should be enabled so let's go to our scene we will reset the transform on our xr rig and now let's hit play to make sure this works and as you can see here as i look around the scene and wave around my controller you can see that we're getting the accurate readings for our position and our rotational tracking and that about does it for me in this video hopefully you found it useful if you have any questions feel free to leave them below and i'll see you in the next one
Up Next

Unity XR Interaction Toolkit 3.0: Controller Tracking Tutorial
@SpatialXR
1.6K views•2024-12-27

IFS Therapy Demonstration: Complete Session with Unburdening
@IFSCA
95.9K views•2021-01-13

FastAPI vs Flask vs Django: Choosing the Right Python Web Framework
@TechWithTim
302.5K views•2024-05-26

Game of Thrones Opening Credits: A Cinematic Analysis
@gameofthrones
46.3M views•2011-04-18
Related Study Plans & Knowledge Roadmaps
Structured learning paths in General & Interdisciplinary Studies






































![HIZIN ANLAMI ! | F1 2016 PS4 [ İLK BAKIŞ]](https://i.ytimg.com/vi/q8Q-s2guB3M/maxresdefault.jpg)
![Oculus Quest [deutsch] Funktionen von Update 16 | Home Umgebungen | Oculus Link | Social Features](https://i.ytimg.com/vi/KWlQSmEgOqk/maxresdefault.jpg)




