HOW TO CUSTOMIZE YOUR MOUSE CURSOR - UNITY TUTORIAL

  Рет қаралды 116,726

Blackthornprod

Blackthornprod

Күн бұрын

Пікірлер: 207
@Blackthornprod
@Blackthornprod 6 жыл бұрын
Hope my voice sounds okay :) ! If it seems a little strange it's because I had cold at the time of recording :) !
@chinyonglim7624
@chinyonglim7624 6 жыл бұрын
Noa~thank so much~!!! The video is ok~ Please take care of your health~ :)
@Blackthornprod
@Blackthornprod 6 жыл бұрын
I'm already feeling a lot better :) ! The cold is almost gone !
@bunggo9914
@bunggo9914 6 жыл бұрын
nah your voice is fine...
@ThomasEngebretsen90
@ThomasEngebretsen90 6 жыл бұрын
Voice sounds fine :) Although, I've noticed in quite a few of your videos that it sounds like you record your voice a bit too hot. In other words, it sounds like it's clipping every now and then. Other than that, your content is amazing! Short, straight to the point and educational. Love your tutorials! :)
@Blackthornprod
@Blackthornprod 6 жыл бұрын
Thanks Thomas ! Yep I see what you mean for the clipping. The reason it sounds that way is actually because I cut the video in certain parts so there aren't too many pauses (and so the video is shorter). But I'll definitely be improving the way I cut up the audio so it sounds less choppy :) cheers !
@darth3437
@darth3437 6 жыл бұрын
For the Ori and the blind forest effect, you can actually just use 1 particle system and change "Simulation Space" from local to world space and it should work as intended without the performance hit of instantiating new particle systems! Hope this helps anyone who wants to do that!
@llamapunk89
@llamapunk89 4 жыл бұрын
I've been scouring the internet for a few days now, trying to figure out how to change the actual cursor itself dynamically, but couldn't find anything close to what I was trying to do. The whole "get a sprite to follow your cursor and hide your cursor" is simple, elegant, and exactly what I've been looking for!
@razzledazzle6539
@razzledazzle6539 6 жыл бұрын
I was so annoyed that none of the cursors were diagonal
@bigmancozmo
@bigmancozmo 3 жыл бұрын
lol
@Bifinley
@Bifinley 3 жыл бұрын
ikr
@ConsequenceCode
@ConsequenceCode 3 жыл бұрын
Yeah lol
@DistractedCoder
@DistractedCoder 6 жыл бұрын
Hopefully people will see this. It would be better to use a looping particle system for the trail. That way you game is not constantly spawning the trail and it would free up a bit of processing.
@MrFarkasOfficial
@MrFarkasOfficial 3 жыл бұрын
This guy never fails to teach me something new
@nightwolffba
@nightwolffba 5 жыл бұрын
Thanks man, I was trying to update the cursor directly but your solution is much more versatile. I went one step further and added the sprites onto a canvas and used that as my cursor. Thanks again and good luck with the videos, sales for whispers and your next projects!
@direpixel4947
@direpixel4947 4 жыл бұрын
For those of you looking to put this on top of everything, create a Canvas set to Screen Space - Overlay and make sure the sort order is higher than your other Overlay canvas'. Then create an Image on that canvas that will store your Cursor. Anchor it to the top left with a pivot point of (0, 1) and set the position to 0,0. Lastly, uncheck Raycast Target on the image. Add the cursor script to set mouse position and it will line up exactly.
@GokdenizCetin
@GokdenizCetin 4 жыл бұрын
Thanks but there is double cursor when I alt-tabbed the game
@JeloOW
@JeloOW 4 жыл бұрын
@@GokdenizCetin 1 month late so you probably figured it out but it can be helpful for new people put Cursor.visible = false; in the Update method
@YuriNoirProductions
@YuriNoirProductions 6 жыл бұрын
Small tip on the cursor trqail...just create a script that follows the mouseposition in worldspace. now create a particle system that spawn particles over distance! now your have particle system that spawns particles relative to the amount of your movement
@dio8440
@dio8440 5 жыл бұрын
Cursor rendering under the UI/GUI elements fix -----> Change your *Canvas* Render Mode to (Screen Space - Camera) Hope this helps.
@manget8553
@manget8553 3 жыл бұрын
Thx a lot
@tristancowen5636
@tristancowen5636 6 жыл бұрын
Hi Blackthornprod!!! I LOVE YOUR VIDS :) :) :). Ever since i started wathcing them, i felt you were really the guy who could teach me coding. Keep up the good work.
@blazer5724
@blazer5724 4 жыл бұрын
If you're following this tutorial I would highly recommend putting Cursor.visible = false; into Update method since people can alt-tab from your game and then the cursor will be visible.
@kitsuneandcake
@kitsuneandcake 2 жыл бұрын
Yeah, that's definitely a good idea!
@adamknight4563
@adamknight4563 5 жыл бұрын
I have a minor problem with this: my mouse is now underneath my Canvas UI... how do I put it in front of my other UI on the Canvas?
@Toopa88
@Toopa88 5 жыл бұрын
Set the sorting layer to UI and increase the Order in Layer if needed.
@k0shmarNevaBroke
@k0shmarNevaBroke 4 жыл бұрын
@@Toopa88 have the same issue, that didnt do anything
@TopBagon
@TopBagon 4 жыл бұрын
@@k0shmarNevaBroke just increase the order in layer option of the sprite that you're using as a mouse
@noellekkar903
@noellekkar903 4 жыл бұрын
Go in 3d and change the z axis , maybe....
@fastpicker89
@fastpicker89 4 жыл бұрын
Same issue, and I'm finding this is a much larger issue. Can't seem to find any simple solution to this anywhere in the forums or Anwers.
@dbweb.creative
@dbweb.creative 4 ай бұрын
how do you deal with lag between hardware cursor and sprite on canvas? the lag looks bad when mouse is moved and cursor feels sluggish.
@MaliciousTachyons
@MaliciousTachyons 6 жыл бұрын
Dude...I dunno how often you hear this, but I LOVE your tutorial videos. thank you!
@Kisuji_
@Kisuji_ 3 жыл бұрын
your videos are the best for my game project!
@matssommervold
@matssommervold 5 жыл бұрын
Nice vid, but my cursor appears under all the UI elements that are on the canvas. I tried making the cursor a rectTransform and put it under the canvas, but I can't figure out how to convert the coordinates from world point to whatever the canvas is using.
@JoshuaReyes
@JoshuaReyes 6 жыл бұрын
You are awesome, I have wanted to do this forever! Keep up the great work! The quick format is so helpful.
@duanefgrabner7068
@duanefgrabner7068 5 жыл бұрын
Nice tutorial! There is no need to create a destroyer script for effects since the particle effect has a method built in to destroy itself. There is a stop action option toward the bottom of the first panel of particle effect settings from which you can choose destroy.
@mirela9974
@mirela9974 6 жыл бұрын
Hi Blackthornprod! I have a big question. Could I use this method in a 3d game? Because it doesn't work for me. Please help
@godot-boy7694
@godot-boy7694 4 жыл бұрын
I was looking for such video, Thank You
@NotElayn
@NotElayn 5 жыл бұрын
Using This Script My Cursor Is In fact moving. The Only Problem Is That It Is In The Bottom Left of The Screen. It does coorespond to the movement of the mouse, but it doesn't move far as it only goes around a little bit, not leaving the far left bottom corner. Please help
@nythrokgames4442
@nythrokgames4442 4 жыл бұрын
Dayem bro, I hope I'm not late, I had the same problem, BUT I FOUND THE RESOLUTION! Basically the thing Camera.main.ScreenToWorldPoint() is an idiotism, delete it, so it will look like this: Vector2 cursorPos = Input.mousePosition; At least it's working like this for me, I hope it will work for you too!
@KaganParlatan
@KaganParlatan 3 жыл бұрын
@@nythrokgames4442 You great!
@tizizzails6817
@tizizzails6817 3 жыл бұрын
@@nythrokgames4442 I had the same issue, you fixed it!
@TechLevelGames
@TechLevelGames 2 жыл бұрын
Cool tutorial! Thanks!
@jovanveselinovic5966
@jovanveselinovic5966 4 жыл бұрын
i have camera following player with cinemachine and i make cursor with this script but when player move cursor is shaking how to fix that
@citricmelon
@citricmelon 4 жыл бұрын
parent your cursor to the camera
@davidmeinname
@davidmeinname 3 жыл бұрын
How to render the cursor it in front of the UI?
@AlexanderZotov
@AlexanderZotov 6 жыл бұрын
Great one!
@Blackthornprod
@Blackthornprod 6 жыл бұрын
Thanks Alexandre :) !
@drakomatic
@drakomatic 5 жыл бұрын
for pixel art i reccomend 15 x 15 and changing the sprite settings to bilinear to no filter(pixel perfect)
@babitadeboer6338
@babitadeboer6338 3 жыл бұрын
Amazing! I couldn't get my custom cursor to show. Some weird raggedy lines appeared instead and that's because I did not change Texture Type to "Cursor". This saved me hours of searching like a blind chicken. Thanks, man!
@giuseppegiarratana478
@giuseppegiarratana478 4 жыл бұрын
Thank you! This is the video I was looking for
@rms4448
@rms4448 3 жыл бұрын
Thanks for the tut bro 💪
@UndeadEarth1
@UndeadEarth1 4 жыл бұрын
Thank you for the well thought out tutorial and info.
@vaqakamadview
@vaqakamadview 6 жыл бұрын
Great video, but i have a cursor hotspot issue, it does not allign with the tip of my sprite cursor, how can I change it.
@Blackthornprod
@Blackthornprod 6 жыл бұрын
That's probably due to the placement of your sprite cursor's pivot point (in other words the little blue circle) ! Just tweak that a little in the sprite editor and things should work well :) ! Hope this helps !
@vaqakamadview
@vaqakamadview 6 жыл бұрын
Yep, that did it, thanx!
@theemeraldfalcon9184
@theemeraldfalcon9184 5 жыл бұрын
@@vaqakamadview I tried this but it doesn't work. my sprite still doesn't line up properly
@abdoudjam6846
@abdoudjam6846 6 жыл бұрын
Great ! you are covering a lot of stuff that really indie gamedevs should know ! THANKs a lot brother ;) !
@JHLandAML
@JHLandAML 5 жыл бұрын
for method 2 set the image to not a raycast target or unity thinks you click on the mouse. (this took me a while to work)
@grassfiregames3571
@grassfiregames3571 5 жыл бұрын
You are a great youtuber!,
@hexercodes540
@hexercodes540 6 жыл бұрын
Awesome video bro! Like your character! :D
@bibekgamebox1083
@bibekgamebox1083 4 жыл бұрын
Great Video Noa...You're also funny with your voice
@brauliojorgealmeida
@brauliojorgealmeida 3 жыл бұрын
Thanks! It helped me :)
@AngelCnderDreamer
@AngelCnderDreamer 5 жыл бұрын
This was amazing! Thank you for this! I been waiting for this for ever about the cursor. This was very well explained, and easy to understand. c: P.s I subscribed!
@khaledmoh96
@khaledmoh96 4 жыл бұрын
bro you are awesome
@yassgaming22
@yassgaming22 4 жыл бұрын
How to make the cursor bigger like in your screen shake tutorial?
@1206Vince
@1206Vince 6 жыл бұрын
Hey Noa, my cursor is behind the GUI, how do I put the cursor above the UI? the canvas is in Screen Space - Overlay
@dio8440
@dio8440 5 жыл бұрын
Just change the sprite layer and done.
@BlackAngel81
@BlackAngel81 5 жыл бұрын
hello vince did you find fixed the cursor to be in front of the GUI? and how you fixed it ? thanks
@btarg1
@btarg1 6 жыл бұрын
Oh my god you sound enthusiastic
@niko587
@niko587 3 жыл бұрын
with a thicc black outline
@_za740
@_za740 4 жыл бұрын
how would one go about doing this with the new unity input system :)
@alexeybolotov3797
@alexeybolotov3797 3 жыл бұрын
For particles - it's better to use Emission - Rate over Distance, and you can use only one particle system, assign it as a child to Cursor and not spawn new particle system each time you need it. But if you still need to spawn Particle Systems - it's better to use ParticleSystem.Stop() action instead of Destroy, and in Particle System -> Main settings -> Stop Action select Destroy. In this way it will stop generation particles, and after all particles will be done - it will destroy whole game object.
@MarellaSbrenz
@MarellaSbrenz 5 жыл бұрын
Doesn't work for me =\ and I don't know why. My sprite just lays on the canvas.
@sentinelmusic107
@sentinelmusic107 4 жыл бұрын
I get the error message "NullReferenceException: Object reference not set to an instance of an object" with the line Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); I don't know why I'm getting this error.
@megasaIexandros
@megasaIexandros 4 жыл бұрын
did you fix it? cuz im getting the same error
@sentinelmusic107
@sentinelmusic107 4 жыл бұрын
@@megasaIexandros It's been a while since I watched this video, I'm not even sure what part gave me this error.
@xThuby
@xThuby 2 жыл бұрын
This is pretty old now. But it seems like your camera is not tagged as MainCamera.
@alexcosmos9895
@alexcosmos9895 Жыл бұрын
Отлично. Теперь запиши видео - как это будет выглядеть на фоне Overlay Canvas :)
@bunggo9914
@bunggo9914 6 жыл бұрын
wow, it looks cool!
@Yunghamster12
@Yunghamster12 3 жыл бұрын
tried doing this by myself and it was going wayyy faster than my actual cursor so glad i found this
@TheNamesJT
@TheNamesJT 5 жыл бұрын
Thanks mate this helped a lot :)
@Programisius644
@Programisius644 6 жыл бұрын
But using a sprite for cursor will cause a problem, the cursor will not be visible when mouse is over an UI sprite.
@Blackthornprod
@Blackthornprod 6 жыл бұрын
True enough ! You'll have to make your cursor a UI image instead ! Should of definitely shown how to do so in the video, and certainly will in a future tutorial ! Thanks for pointing that out :)
@Programisius644
@Programisius644 6 жыл бұрын
Solved it by making a UI image and and adding a Rect Transform, script is almost same as the one in the video except Rect Transform instead of Transform. Here the final product of cursor :D prnt.sc/kbbmv7 Keep up the good work, loving your videos.
@khanakarnsakaew4244
@khanakarnsakaew4244 6 жыл бұрын
Hey can you show me how to do that exactly please? I've tried but still couldn't figure it out. Thanks :)
@emc1905
@emc1905 6 жыл бұрын
I also need help figuring this out :)
@DexDrakon
@DexDrakon 5 жыл бұрын
I'm still having the same problem. I'm trying use rectTransform.transform.position but no use
@spicyvegetable3705
@spicyvegetable3705 5 жыл бұрын
I hate you cuz i love you so im addicted to your videos
@GreenPetl
@GreenPetl 2 жыл бұрын
I swear cursor are cursed for me lol. Windows, Unity none of them want to change my cursor, no matter what i do. *Sigh* Although despite my failure your video is awsome! Clear instruction and upbeat tone make a huge difference! immagonna smash my finger on that 'LIKE' button and slowly meander 'The Cursed One* over to caress the subscribe. There immediatley hunching down and retreating into the dark void that is the WEB.
@lottomatto
@lottomatto 5 жыл бұрын
What can I do to prevent the cursor from being under buttons?
@Frost-ml4vj
@Frost-ml4vj 5 жыл бұрын
Instead of making the Cursor a gameObject, make it a UI image, and change 'transform' to 'rect transform' in the script. Should work
@GokdenizCetin
@GokdenizCetin 4 жыл бұрын
+1
@supersaiyan9616
@supersaiyan9616 6 жыл бұрын
Please make tutorials on art in 3d
@Blackthornprod
@Blackthornprod 6 жыл бұрын
3D art/modeling will definitely be covered on the channel in the future :) ! Stay Tuned !
@animationsbelike
@animationsbelike Жыл бұрын
thank you so much :D
@chinyonglim7624
@chinyonglim7624 6 жыл бұрын
Hmm~ upload 9 min ago~ video length 9min14sec~ people are giving like at 5min ago~XD Btw great video again~
@AzizTheGazele552
@AzizTheGazele552 5 жыл бұрын
Help, "visible" which you put after "Cursor." doesn't exist for me. I don't know how to make my white cursor disapear because of that :/
@AzizTheGazele552
@AzizTheGazele552 5 жыл бұрын
Nevermind, I went on docs.unity3d.com/ScriptReference/Cursor-visible.html and copy and pasted their code. I don't rlly know what was the problem, but im glad i found a solution!
@simoncodrington
@simoncodrington 6 жыл бұрын
When in doubt, add more 3D particle effects! 🎆🎇 Cheers for the video man :)
@RaasiqShaikh98
@RaasiqShaikh98 2 жыл бұрын
Hey so does this not work in unity 2021? I'm new to coding and would love some help with that
@imdrogon
@imdrogon 2 жыл бұрын
Thanks, helped for my game called civilization sandbox (sry if spelt wrong, I'm suomi.) and I want a universe sandbox like cursor.
@zakwanmasud2406
@zakwanmasud2406 5 жыл бұрын
Facing problem.the problem is that the sprite cursor doesn't get above the UI(canvas)..please help
@iamzen_1077
@iamzen_1077 5 жыл бұрын
Having the same problem with the UI Canvas making it so the cursor won't appear. Tried to make the cursor a UI Image as a child of the canvas but still didn't work... :/
@tapendrashahi2097
@tapendrashahi2097 6 жыл бұрын
Hey, noa. Thank you so much for the hard work you put up on making these tutorials.I am really learning so much. It would be awesome if you taught about the touch phases and such kinds of stuff to use in mobile game development. Like moving a character or player with swipe of finger. I am getting stuck while making a game cause i dont get how the touch functions work in unity. And also many peoples here would also probably want that kind of tutorials.
@jezamae-amorpagaduan7112
@jezamae-amorpagaduan7112 6 жыл бұрын
This didn't work for me... Can you help? I get an error saying "Type 'UnityEngine.Camera' does not contain a definition for 'ScreentoWorldPoint' and no extension method 'ScreentoWoldPoint' of type 'UnityEngine.Camera' could be found. Are you missing an assembly reference? (CS1061)" Not sure what to do, and I can't seem to find any solutions. Here's my code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class mouseCursor : MonoBehaviour { void Start(){ Cursor.visible = false; } void Update () { Vector2 cursorPos = Camera.main.ScreentoWorldPoint(Input.mousePosition);' transform.position = cursorPos; } }
@supersaiyan9616
@supersaiyan9616 6 жыл бұрын
Thanks 😇 you so much for your great response . But please make the steps you followed to improve your art work in 2d and 3d.
@SamaX1010
@SamaX1010 5 жыл бұрын
Can you cake cursors that are animated / do animations when a button is clicked
@Skyvastern
@Skyvastern 5 жыл бұрын
Yes for that, you need to have a reference to the Animator component of the Cursor's gameObject in the script which contains the function which will be called when the button is clicked. Then just set the condition, whatever you have chosen be it a trigger or bool.
@SamaX1010
@SamaX1010 5 жыл бұрын
@@Skyvasternalright thanks for letting me know
@lottomatto
@lottomatto 6 жыл бұрын
I like this video, but I have a problem. When I start the game in editor, the Console shows: NullReferenceException : Object reference not set to an instance of an object. I hope you can help me.
@sasookay514
@sasookay514 6 жыл бұрын
set the camera tag to "MainCamera'
@lottomatto
@lottomatto 6 жыл бұрын
@@sasookay514 . I did it . When I start the Game in Editor, the game starts without problems. But now the Sprite don't follow the Mouse Position!
@71Arlekino
@71Arlekino 6 жыл бұрын
@@lottomatto I have same problem((
@lottomatto
@lottomatto 6 жыл бұрын
Oh ! Maybe I have the answer. Set the Camera from Perspective to Ortographik. Hope it helps.
@Kaikaku
@Kaikaku 6 жыл бұрын
I'm new to your channel. This is a nicely packed and very usefull episode. Thanks :)
@Blackthornprod
@Blackthornprod 6 жыл бұрын
Welcome to the family :) ! And thanks for the feedback !
@eriknastesjo843
@eriknastesjo843 4 жыл бұрын
Would be cool to know how to do this in perspective mode!
@konyameram1
@konyameram1 2 жыл бұрын
Fun fact, I was siiting in an exercise session and my volume was maxed out (didn't realize it until it was too late). People got scared ^^
@firesnail1477
@firesnail1477 5 жыл бұрын
Oh no! I tried the whole "cursor changes sprite when the mouse is clicked", but whenever I click the mouse, the sprite just disappears. Please help!
@evanrechsteiner518
@evanrechsteiner518 5 жыл бұрын
Hey Noah! How would one go about disabling the mouse completely while still maintaining button functionality from the Input built into Unity?
@raphaelkrait7655
@raphaelkrait7655 5 жыл бұрын
Omg this is so good thankk youuu
@armandopenatamayo691
@armandopenatamayo691 Жыл бұрын
Awesome video like alway ...but don't mess with Don't Starve 😬😅
@Delvarn
@Delvarn 4 жыл бұрын
How do I create a variable to manage cursor speed in game?
@carsonh7222
@carsonh7222 2 жыл бұрын
I've done this script exactly as shown, but whenever I start the game, the cursor does not show at all. I used the method where the cursor is a sprite overlay instead of the actual cursor. The position is following the mouse, and the image is visible when the script is disabled, the cursor graphic just disappears when following the cursor. Does anyone have a fix?
@captainorigami7518
@captainorigami7518 2 жыл бұрын
Im having this issue too, did you find a solution?
@carsonh7222
@carsonh7222 2 жыл бұрын
@@captainorigami7518 Yes I did actually, I just deleted my script and made a new one, then deleted the game object and made a new one for that, too. I think I just messed up something in settings (since I checked tons of boxes while trying to find a solution). It will work, though!
@captainorigami7518
@captainorigami7518 2 жыл бұрын
@@carsonh7222I found out my issue as well, my camera and layers were all stacked in the wrong order and my mouse was behind my background the whole time!
@taayakin1108
@taayakin1108 2 жыл бұрын
@@captainorigami7518 THANK YOU!!! oh man what a rookie mistake, but i've been trying to figure out what i was doin' for like 15 mins and it was sorting layers...i might've spent way more time w/o your comment !!!
@captainorigami7518
@captainorigami7518 2 жыл бұрын
@@taayakin1108 no problemo, anytime my fren
@JasonMorelandDigitalrecline
@JasonMorelandDigitalrecline 3 жыл бұрын
Anyone know what the games were other than ori? I like to look of the game at. 39 secs
@fastpicker89
@fastpicker89 4 жыл бұрын
I get this error: Assets\Scripts\Cursor.cs(9,16): error CS0117: 'Cursor' does not contain a definition for 'visible'
@lorenzocerato6081
@lorenzocerato6081 4 жыл бұрын
Make sure that your .cs file isn't named "Cursor", this will affect the execution of the code! All you have to do is just rename the file and the text after "public class" (in the 5th line if I'm not mistaken)
@zemangofur3986
@zemangofur3986 4 жыл бұрын
my texture is glitched out what can i do about that?
@atitjeu
@atitjeu 6 жыл бұрын
i'm programmer but i like to see your teach of 2part(unity,art) thx a lot
@Blackthornprod
@Blackthornprod 6 жыл бұрын
More art/unity tutorials are coming up :) !
@theemeraldfalcon9184
@theemeraldfalcon9184 5 жыл бұрын
where do you open playersettings?
@rj-nj3uk
@rj-nj3uk 6 жыл бұрын
why don't you do a video on level design?
@MikeKing710
@MikeKing710 6 жыл бұрын
Wow! It's now 3k subscribers)))
@bobbywinston1880
@bobbywinston1880 6 жыл бұрын
Hey which is better for animations in unity animate or photoshop
@Blackthornprod
@Blackthornprod 6 жыл бұрын
Hey Bobby :) ! Well Adobe Ps is awesome for traditional frame by frame animation, I'm afraid I've never had a go with Animate CC so I can't tell you much on that point. You could also try Spine which is great for 2D bone based animation (Unity's simple animation features is also great)
@IamNeighborlee
@IamNeighborlee 4 жыл бұрын
Doesn't work, I changed to a cursor I got from unity store, and placed it where yours is, but in game I still get these weird multicolored lines , that make up a weirdly transparent ISh tiny square. What might be going on ?
@sentinelmusic107
@sentinelmusic107 4 жыл бұрын
In the Inspector, set the texture's Texture Type to "Cursor" instead of "Sprite(2D and UI)".
@_g_r_m_
@_g_r_m_ 3 жыл бұрын
Not working for me, i had to make a few changes in order to make it work, her's my script if someone needs it: public class MouseCursor : MonoBehaviour { void OnGUI() { Cursor.visible = false; } void Update() { transform.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y); } }
@makosato1256
@makosato1256 3 жыл бұрын
Thank you so much
@priyajvora1824
@priyajvora1824 6 жыл бұрын
Another great one, thanks. Could you do a Photoshop art tutorial next?
@Blackthornprod
@Blackthornprod 6 жыл бұрын
I will be doing a "How to paint a 2D game character in Ps" soon, so stay tuned :) !
@priyajvora1824
@priyajvora1824 6 жыл бұрын
Awesome!
@imaginomania2
@imaginomania2 5 жыл бұрын
Hi Blackthorn, I have some issues with the code while i click. I use the right and middle button. I don't seem to be able and find the reason why that happens. As you can see i added an if statement cause i was taking an error that was asking me to check if my SpriteRenderer is attached or not. And as it seems as soon as i press any of the mouse buttons the SpriteRenderer becomes null. If you guys can see where i made a mistake or have an idea why it happens please let me know. using System.Collections; using System.Collections.Generic; using UnityEngine; public class MouseController : MonoBehaviour { Vector3 lastFramePosition; private SpriteRenderer rend; public Sprite clubArrowDown; public Sprite clubArrow; public GameObject clickEffect; // Start is called before the first frame update void Start() { //Set the clasic windows cursor invisible Cursor.visible = false; rend = GetComponent(); } // Update is called once per frame void Update() { Vector3 currFramePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); //Change the appearence of mouse cursor Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); transform.position = cursorPos; if (rend != null) { // It reverts to the original cursor instead of changing the sprite of my cursor if (Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)) { rend.sprite = clubArrowDown; // Setting up particle system for my cursor Instasiate(clickEffect, transform.position, Quaternion.identity); } else if (Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(2)) { rend.sprite = clubArrow; } } else { Debug.Log("The SpriteRenderer can not be found"); } //Handle move/drag cammera if(Input.GetMouseButton(1) || Input.GetMouseButton(2))//Right and middle mouse button { Vector3 diff = lastFramePosition - currFramePosition; Camera.main.transform.Translate(diff); } lastFramePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); } } Thanks in advance for looking into my script.
@nailotsot
@nailotsot 3 жыл бұрын
@Sushid00 well, at least you tried
@xaiga29
@xaiga29 4 жыл бұрын
The information is incomplete, the cursor is underneath all elements and that renders it unusable.
@TheWestonini
@TheWestonini 4 жыл бұрын
Change the "Order in Layer" on the cursor object's Sprite Renderer component to something high so that it always displays on top of everything else.
@xaiga29
@xaiga29 4 жыл бұрын
@@TheWestonini I did that and it didn't work. I found a better way to do it anyway. public class CustomCursor : MonoBehaviour { [SerializeField] Texture2D crosshair; void Start() { Cursor.SetCursor(crosshair, new Vector2(256, 256), CursorMode.Auto); } } My cursor icon is 512*512 px, and the hotspot is half of that, or Vector2(256, 256), so the center of the pointer is the center of my cursor image. Just make sure you cursor icon/image is set to cursor instead of UI in the inspector.
@sasookay514
@sasookay514 6 жыл бұрын
Am I the only one where things are not working wonderfully? I'm at @3:49 just trying to get the sprite to follow my mouse in a 3D environment, but when I play the scene, it only captures the first set of coordinates and then it doesn't change? The Image is stuck hovering in mid air. Anyone?
@matssommervold
@matssommervold 5 жыл бұрын
Did you make sure that you are updating the position in Update() ?
@hungrygrimalkin5610
@hungrygrimalkin5610 3 жыл бұрын
You need to change shit entirely son. First change the image back to cursor then make an empty game object and attach your script, no need for sprite renderers. Here is the script using System.Collections; using System.Collections.Generic; using UnityEngine; public class Cursorscript : MonoBehaviour { [SerializeField] Texture2D cursorName; // Start is called before the first frame update void Start() { Cursor.SetCursor(cursorName, Vector2.zero, CursorMode.Auto); } // Update is called once per frame void Update() { } } save and attach your cursor picture to the script slot you made for Texture2D. No need for thanks GTFO!
@VeiusIuvenis
@VeiusIuvenis 5 жыл бұрын
Could this sprite cursor work on UI? I created a cursor following these steps, but it failed when I moved the cursor onto the UI element. So sad.
@iamThePaleowarist
@iamThePaleowarist 4 жыл бұрын
turn off the "Raycast target" thing in the image
@sonistata8390
@sonistata8390 4 жыл бұрын
@@iamThePaleowarist Thank you I was trying to fix this issue.
@adriking5383
@adriking5383 4 жыл бұрын
my pixelart cursor is blurry how do i fix this?
@zacharywalker-liang7319
@zacharywalker-liang7319 4 жыл бұрын
when importing pixel art sprite , make sure you set your sprite to the correct pixels per unit , filter mode: point no filter, compression: None
@mfatihbilhaq4977
@mfatihbilhaq4977 6 жыл бұрын
Thx
@VideosDeGatwinOficia
@VideosDeGatwinOficia 6 жыл бұрын
awesome
@zaart1334
@zaart1334 6 жыл бұрын
Nice video, Thx btw, can you tutorial about How to Build Unity Project to Android (apk) and set up the android sdk? Thx for your awesome video
@GaviTSRA
@GaviTSRA 4 жыл бұрын
Brackeys said you should NEVER use camara.main cause it does something like this(sry if something is wrong) : .... FindObjectWithTag("MainCamara")......
@wolfkaiser5228
@wolfkaiser5228 3 жыл бұрын
Cursor.visible does not work now ): Edit: it works
I Made A Difficult Game About Climbing
15:04
Pontypants
Рет қаралды 2,2 МЛН
Animated Cursors in Unity!
16:59
Code Monkey
Рет қаралды 26 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 145 МЛН
7 DEVS Make a GAME without COMMUNICATING! (we never saw this coming)
20:12
Mouse Cursor History (and why I made my own)
15:09
Posy
Рет қаралды 2,7 МЛН
CREATING 2D LIGHTS - UNITY TUTORIAL
7:37
Blackthornprod
Рет қаралды 98 М.
How I learned Unity without following tutorials (Developing 1)
18:11
Game Maker's Toolkit
Рет қаралды 2 МЛН
How to make Minimap in Unity | Beginner Friendly
14:11
The Game Guy
Рет қаралды 6 М.
3 DEVS Make a Horror Game in 3 GAME ENGINES!
15:35
Blackthornprod
Рет қаралды 506 М.
Custom 2D Cursors in Unity
16:34
Nitroxin
Рет қаралды 8 М.
1 Year of Learning Game Development In 6 Minutes
6:01
Giedzilla
Рет қаралды 2,5 МЛН
3 DEVS Make a Real-time strategy game in UNITY, UNREAL & GODOT!
15:37
Blackthornprod
Рет қаралды 185 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,2 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 145 МЛН