You missed a thing when converting your old second and third example to the new input system: You continue to use Input.mousePosition which is part of the old input system and only works because in your project you still have both the new and old input system enabled. The new way is Mouse.current.position.ReadValue() or using the control mapping asset and creating a Vector2 binding for /position which you can then also read out inside an update using ReadValue(). Also instead of using isPressed you can also use wasPressedThisFrame and wasReleasedThisFrame for the start and end of the pickup
@OneWheelStudio2 жыл бұрын
You are totally right! Big brain fart! Thanks. Also, I looked for something like isPressedThisFrame and missed it. Much appreciated.
@ap0stle2 жыл бұрын
I am currently trying to raycast using the new input system using input action to receive mouse position, but it returns the mouse position on global screen, when old input system mouse position returns the mouse position in the game window. I've been suffering a lot before I realized that my raycasts don't work because the mouse position from the new input system just is incorrect As you mentioned it, maybe you know how I can fix it?
@jakovincenttumane2252 жыл бұрын
4 min into the video and now my input system works perfect thanks bro
@umapessoa60512 жыл бұрын
Awesome as always, keep up with the great work.
@thesilentwisp2 жыл бұрын
Really well explained thank you. Not sure if you can address this but I had a hard time giving the player a way to change mouse sensitivity with the new input system using the cinemachine camera.
@OneWheelStudio2 жыл бұрын
Thanks! Glad it was useful. As for the mouse you could multiply the input by a float. Make it less than one to slow the mouse. More than one to speed it up. I haven’t done it but that would be my first attempt.
@thesilentwisp2 жыл бұрын
@@OneWheelStudio I've looked and could not for the life of me figure it out. If you happen to be unsure of what to make for your next video, that might be an idea since literally no one on KZbin covers reading mouse vector 2 input with the new input system in a cinemachine freelook camera.
@OneWheelStudio2 жыл бұрын
The free-look camera? That is a bit tougher but not much. You can open up the "Cinemachine Input Provider" script and add the value that I was describing above. I'm going to be away all day today, but you're welcome to jump on the OWS discord and I bet we can get something working. You may be right that this could be a good quick follow-up video.
@yuunaito2120Ай бұрын
Thanks for your video. Love your explanation. But i wanna ask, what about selecting multiple object ? I've tried using for loop, but it didn't works. Silly me, im a beginner at programming field
@OneWheelStudioАй бұрын
Multiple objects at once? Like dragging a selection box? Look up “rts selection” there’s some decent stuff out there 🙂 If you mean using raycast and selecting one after another then you could add the objects to a list as you select them? Maybe use a hot key like shift to could single or multiple selection.
@yuunaito2120Ай бұрын
@@OneWheelStudio umm, i guess what i am looking for is like a game where we need to find all hidden objects in one room And when we select all of them, the scene changed (to next stage). I know how to change the scene, but to make player select multiple objects one-by-one is my obstacle right now Oh list class ? Never thought of it.. I think i should try it
@RobLang2 жыл бұрын
This is a great run through, thank you. One small thing - I found that your face cam had trouble focusing on your face when gesticulating. For me, a locked focus would be great!
@OneWheelStudio2 жыл бұрын
Yep I’m with you. I’ve been struggling with the focus and learning a bunch in the process. Still a bit scared of locking the focus but I’ve changed some other settings which will hopefully let it stick to my face better. We’ll see. Glad the video is helpful!
@hansa58672 жыл бұрын
The videos recommended in the beginning lack video links, I think, I didn't have them at least. So if you want to implement those, do so :)
@OneWheelStudio2 жыл бұрын
There are links to the videos mentioned at 0:24 in the description as well as cards in the top right of the video. Happy to add others if I missed on.
@orchard8002 жыл бұрын
Brilliant video. Just one question though; why enable sa.player in onenable()? And why enable it after subscribing to it, not before? If it wasn't enabled, would you be able to subscribe to it?
@OneWheelStudio2 жыл бұрын
The order of enabling and subscribing doesn't matter - I don't know the exact inner workings of the Input Action Asset, but calling Enable doesn't turn the object on or off, it just tells it to listen to inputs and send out corresponding events. As for why we subscribe in OnEnable (and unsubscribe in OnDisable), this ensures that the functions are subscribed even if the object is turned on/off.
@JacksonThom Жыл бұрын
This is a great tutorial, but what is it about Cinemachine that can be set, to get it to follow the mouse pointer? I have been struggling with this for, soooo long! Thanks!
@OneWheelStudio Жыл бұрын
I'm not sure I would use Cinemachine for that. What you could do is raycast from the camera through the mouse and get a point on the ground. You could then have the camera "LookAt" the point on the ground. Do a quick google search for "unity raycast camera to mouse" and you should find plenty of results. Then look up "unity transform lookat"
@lee1davis12 жыл бұрын
Well you be doing a video on custom key binding manager with the new input system?
@OneWheelStudio2 жыл бұрын
Done! ;) See if this video gets you moving in the right direction: kzbin.info/www/bejne/inWTg2iuZd5_Zrs
@leyone68282 жыл бұрын
Hi, I am wondering if you have a tutorial of the project you demonstrated at 0:09, how objects are generated following the cursor but restricted in a certain grid (not sure if I say it correctly)
@OneWheelStudio2 жыл бұрын
I don't have a video on that in particular, but the basic idea is to get the location (via raycast) which returns a Vector3. You can then round each of the components to an integer. Once they are rounded you can create a new vector3 with the rounded values and use THAT for the positioning.
@leyone68282 жыл бұрын
@@OneWheelStudio Thank you so much for the detailed explanation!
@monkeymonkey696966 ай бұрын
Thanks
@Seiku2 жыл бұрын
Just a curious question, I'm still trying to grasp scripting and whatnot. I was learning and trying to implement a custom 2D collision script with raycasts and/or boxcasts on a sprite to detect ground collisions etc. Is this something that could be used for that, for a custom player collision, instead of updating every frame with the raycast?
@OneWheelStudio2 жыл бұрын
Yep. Raycasting is a great way to detect ground collisions. Sebastian Lague has a great (but not simple) series on creating a 2D platformer using ray casting. Playlist: kzbin.info/aero/PLFt_AvWsXl0f0hqURlhyIoAabKPgRsqjz
@harryrithman19772 жыл бұрын
Apparently unity does not come with input system I had get off asset store which one do you have
@OneWheelStudio2 жыл бұрын
Yes, Unity still defaults to the "old" input system and the "new" system has to be imported with the package manager. This video used version 1.0.2 with Unity 2019.4.
@harryrithman19772 жыл бұрын
@@OneWheelStudio no I mean when I downloaded unity there was no input system in package manager I had get one from asset store