This video it is exactly what I was looking for, and it makes me feel not that bad for not know how to reactivate a cursor. Keep like this and be safe :D
@FLIZTERYT3 жыл бұрын
IKR!
@relarin95211 күн бұрын
Super appreciate you, Spent hours trying to figure out why I couldn't click buttons but not this makes a lot of sense.
@zachguillet93154 жыл бұрын
Thank you so much I spent the whole day working on this and you explained it in 6 minutes and 24 seconds
4 жыл бұрын
where did you attack the script
@zachguillet93154 жыл бұрын
@ I put it on a empty object
@funnymoondog1xx4864 жыл бұрын
This is very great and simple. I like how you put it into detail and give it some perspective for viewers to connect to. This is perfect for pretty much any genre of game
@MROCTAGON-uw7ry7 ай бұрын
this is soooooo use full I've needed this for so long!
@pancakebananasplash Жыл бұрын
This one was driving me crazy. Thank you.
@RichardFleming Жыл бұрын
Glad it helped
@Nathan-cx6et3 жыл бұрын
Man, i love you Too much I started programming not long ago, and i was in despair You deserve so much Sorry for english, I'm Brazilian
@RichardFleming3 жыл бұрын
Your English is 100% better than my Portuguese. Glad I could help.
@Nathan-cx6et3 жыл бұрын
@@RichardFleming thanks kkk
@3d_nahla2892 жыл бұрын
thanks man , but what if I have two scene , first one need lock cursor and the second beed cursor!!! how can I un lock it ???
@phantomapprentice67493 жыл бұрын
Thank you , its amazing how I found no mention of this elsewhere.
@kijjamburodney30862 жыл бұрын
Thank you so much for this. It is definitely a lifesaver for future FPS games i want to make.
@raydartt3 жыл бұрын
I have been working for a year on my game and was ready to give up (not really). When I added an inventory window I couldn't point to anything. I have been looking for days for an answer and finally I have the solution. I added the code to my inventory window scripts so when i open my inventory window the cursor appears and then disappears when I close the window. Perfect. Thanks Grass Cat.
@RichardFleming3 жыл бұрын
Excellent, glad to hear I could help you get unstuck :)
@AbhimanyuVenu10 ай бұрын
i dont have main menu script? should i just create a new script and add it to my buttons?
@emilian_spielt3002 жыл бұрын
Omg dude i fkn love u so much!!!! i tried 2 million other things but nothing worked. you deserv an prize
@Passenger-vf8pp Жыл бұрын
This video saves my day!
@Passenger-vf8pp Жыл бұрын
Thank you so much for sharing this tip!
@cobrakaiguy60472 жыл бұрын
thank you so much i was looking for that exactly thing hours and i finally founded you , its all worked wihtout any problem on my first try THANK YOU SO MUCHHH you got a new like user and subscriber
@snokewatch20482 жыл бұрын
Thanks so much!! I have tried to find this for years!
@tiggs_44293 жыл бұрын
THANK U SOOOOOOOOOOOOOOOOOOOOOOOOO MUCH! IVE BEED LOOKING FOR SOMETHING FOR OVER TWO MONTHS!
@FC12CGaming4 жыл бұрын
can you link the script because my one has a error
@matus54222 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MainMenuUI : MonoBehaviour { // Start is called before the first frame update void Start() { UnlockMouse(); } // Update is called once per frame void Update() { } void UnlockMouse() { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } }
@Tyl8rr Жыл бұрын
It says that "Cursor" does not contain a defenition for lock state :/
@amaxunny79733 жыл бұрын
My mouse is flickering why?
@discocat94312 жыл бұрын
WinUI.gameObject.SetActive(true); Cursor.visible = true; Cursor.lockState = CursorLockMode.None; I type these and when my UI gets enabled I can see my cursor but it doesn't unlock. I made another separated script from the player and there it gets unlocked. Weird. Also the cursor blinks
@dark_teddy2 жыл бұрын
God, thank you so much man, I've been trying to figure this out for so long.
@Wa5153 жыл бұрын
Thank you, but after my cursor becomes visible, the buttons are not pressed :(
@RichardFleming3 жыл бұрын
Unfortunately this could be from a whole host of other issues. The most common mistake I've seen where the buttons stop responding is that the Event System GameObject no longer exists, so you might want to double check for that.
@Wa5153 жыл бұрын
@@RichardFleming thank you, I've already fixed this
@inquisitive240 Жыл бұрын
TOOK ME SO LONG TO FINALLY FIND THISSSSS THANK YOU edit: Wait I'm trying to make a pause menu so what do I do to lock and unlock because I tried doing void LockMouse() { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } void UnlockMouse() { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } and calling it from different states but when I unpause it doesn't seem to work
@pumpkinisland122 жыл бұрын
It doesn’t work for me, it still just disappears when i click on a button and does nothing
@Sewshy23 жыл бұрын
thank you sooooooooooo much now u just earnt a new subscriber
@RichardFleming3 жыл бұрын
Glad I could help :)
@KAcs4_pictures3 жыл бұрын
Oooh my inventory button problem solution :o Thank you!
@mayonnaiseguy69420 Жыл бұрын
This is 10000000% EXACTLY what i was looking for. Thanks man, you are a life saver ❤
@chami_212 Жыл бұрын
Thank u very much i was locked 2 hours on this bug
@RichardFleming Жыл бұрын
Glad I could help
@mycomputer27573 жыл бұрын
Can link the script?it's giving me errors
@maqsreal3 жыл бұрын
me too
@matus54222 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MainMenuUI : MonoBehaviour { // Start is called before the first frame update void Start() { UnlockMouse(); } // Update is called once per frame void Update() { } void UnlockMouse() { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; } }
@jozatheman2 жыл бұрын
God bless you man, helped allot
@1___________________1-n6i3 жыл бұрын
whats weird is that my cursor was unlocked from before. one day when i start unity it got locked
@RichardFleming3 жыл бұрын
Odd indeed. If I were to take a guess, it sounds like you added in a component that was locking the cursor. There is no way to tell if a component, or a prefab containing said component, locks the cursor without looking at the code.
@1___________________1-n6i3 жыл бұрын
@@RichardFleming well, this fixed it anyways. so thanks!
@seodev6064 жыл бұрын
Thank You So Much It Works
@kingbanimation75832 жыл бұрын
thanks man you are a life saver
@TheGrassKing Жыл бұрын
Grass
@alanrenier27862 жыл бұрын
Thanks, solved my problem !!!
@computaristgamer7 ай бұрын
Bro man you you you don't know how much this thing help me man you are my bro man thankyou thankyou you save my ass
@vallexti3 жыл бұрын
This works really awesome! Thanks alot!
@RichardFleming3 жыл бұрын
Glad it helped!
@pirakathiesvfx6188 Жыл бұрын
Thank You So Much Its Work🙂
@fachri174 жыл бұрын
it didnt work for me, it always says"Cursor does not contain bla bla bla. or the name does not exist in the current context. pls help me
@lonr_gsmo45834 жыл бұрын
Same here
@funnymoondog1xx4864 жыл бұрын
Check out your spelling. Maybe you have a lowercase instead of a capital letter or vise versa
@thedevelopingbird22913 жыл бұрын
Thanks! Needed this
@RichardFleming3 жыл бұрын
Your welcome, glade it helped you out.
@Pointless-Content Жыл бұрын
THANK YOU SO MUCH!!!! I JUST SUBBED!
@FLIZTERYT3 жыл бұрын
POG!
@shanickcuello71234 жыл бұрын
Solution at 4:44
@RichardFleming4 жыл бұрын
True, but I do feel the context adds a bit for new developers :)