HOW TO CUSTOMIZE YOUR MOUSE CURSOR - UNITY TUTORIAL

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024

ความคิดเห็น • 206

  • @Blackthornprod
    @Blackthornprod  6 ปีที่แล้ว +74

    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 ปีที่แล้ว +1

      Noa~thank so much~!!!
      The video is ok~
      Please take care of your health~ :)

    • @Blackthornprod
      @Blackthornprod  6 ปีที่แล้ว +3

      I'm already feeling a lot better :) ! The cold is almost gone !

    • @bunggo9914
      @bunggo9914 6 ปีที่แล้ว +1

      nah your voice is fine...

    • @ThomasEngebretsen90
      @ThomasEngebretsen90 6 ปีที่แล้ว +1

      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 ปีที่แล้ว +3

      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 ปีที่แล้ว +72

    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!

  • @razzledazzle6539
    @razzledazzle6539 5 ปีที่แล้ว +80

    I was so annoyed that none of the cursors were diagonal

  • @DistractedCoder
    @DistractedCoder 6 ปีที่แล้ว +21

    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.

  • @nightwolffba
    @nightwolffba 5 ปีที่แล้ว +2

    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!

  • @llamapunk89
    @llamapunk89 3 ปีที่แล้ว +1

    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!

  • @MrFarkasOfficial
    @MrFarkasOfficial 3 ปีที่แล้ว +3

    This guy never fails to teach me something new

  • @tristancowen5636
    @tristancowen5636 6 ปีที่แล้ว +4

    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.

  • @YuriNoirProductions
    @YuriNoirProductions 6 ปีที่แล้ว +4

    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

  • @direpixel4947
    @direpixel4947 4 ปีที่แล้ว +3

    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 3 ปีที่แล้ว +2

      @@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

  • @adamknight4563
    @adamknight4563 5 ปีที่แล้ว +22

    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 4 ปีที่แล้ว

      Set the sorting layer to UI and increase the Order in Layer if needed.

    • @k0shmarNevaBroke
      @k0shmarNevaBroke 4 ปีที่แล้ว +1

      @@Toopa88 have the same issue, that didnt do anything

    • @TopBagon
      @TopBagon 4 ปีที่แล้ว +1

      @@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 3 ปีที่แล้ว +1

      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.

  • @JoshuaReyes
    @JoshuaReyes 6 ปีที่แล้ว +1

    You are awesome, I have wanted to do this forever! Keep up the great work! The quick format is so helpful.

  • @MaliciousTachyons
    @MaliciousTachyons 5 ปีที่แล้ว

    Dude...I dunno how often you hear this, but I LOVE your tutorial videos. thank you!

  • @dio8440
    @dio8440 5 ปีที่แล้ว +7

    Cursor rendering under the UI/GUI elements fix -----> Change your *Canvas* Render Mode to (Screen Space - Camera)
    Hope this helps.

  • @duanefgrabner7068
    @duanefgrabner7068 5 ปีที่แล้ว +1

    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.

  • @AlexanderZotov
    @AlexanderZotov 6 ปีที่แล้ว +4

    Great one!

  • @AngelCnderDreamer
    @AngelCnderDreamer 5 ปีที่แล้ว +1

    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!

  • @blazer5724
    @blazer5724 4 ปีที่แล้ว +3

    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!

  • @Kisuji_
    @Kisuji_ 3 ปีที่แล้ว

    your videos are the best for my game project!

  • @mirela9974
    @mirela9974 6 ปีที่แล้ว +5

    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

  • @tapendrashahi2097
    @tapendrashahi2097 6 ปีที่แล้ว +2

    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.

  • @davidmeinname
    @davidmeinname 3 ปีที่แล้ว +2

    How to render the cursor it in front of the UI?

  • @godot-boy7694
    @godot-boy7694 4 ปีที่แล้ว

    I was looking for such video, Thank You

  • @NotElayn
    @NotElayn 5 ปีที่แล้ว +7

    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 3 ปีที่แล้ว +6

      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!

  • @giuseppegiarratana478
    @giuseppegiarratana478 4 ปีที่แล้ว

    Thank you! This is the video I was looking for

  • @alexcosmos9895
    @alexcosmos9895 ปีที่แล้ว +1

    Отлично. Теперь запиши видео - как это будет выглядеть на фоне Overlay Canvas :)

  • @abdoudjam6846
    @abdoudjam6846 6 ปีที่แล้ว

    Great ! you are covering a lot of stuff that really indie gamedevs should know ! THANKs a lot brother ;) !

  • @hexercodes540
    @hexercodes540 6 ปีที่แล้ว

    Awesome video bro! Like your character! :D

  • @UndeadEarth1
    @UndeadEarth1 4 ปีที่แล้ว

    Thank you for the well thought out tutorial and info.

  • @drakomatic
    @drakomatic 5 ปีที่แล้ว +1

    for pixel art i reccomend 15 x 15 and changing the sprite settings to bilinear to no filter(pixel perfect)

  • @matssommervold
    @matssommervold 5 ปีที่แล้ว +2

    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.

  • @sentinelmusic107
    @sentinelmusic107 4 ปีที่แล้ว +2

    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 3 ปีที่แล้ว

      did you fix it? cuz im getting the same error

    • @sentinelmusic107
      @sentinelmusic107 3 ปีที่แล้ว +1

      @@megasaIexandros It's been a while since I watched this video, I'm not even sure what part gave me this error.

    • @xThuby
      @xThuby ปีที่แล้ว

      This is pretty old now. But it seems like your camera is not tagged as MainCamera.

  • @bunggo9914
    @bunggo9914 6 ปีที่แล้ว +2

    wow, it looks cool!

  • @TechLevelGames
    @TechLevelGames 2 ปีที่แล้ว

    Cool tutorial! Thanks!

  • @jovanveselinovic5966
    @jovanveselinovic5966 4 ปีที่แล้ว +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 ปีที่แล้ว +2

      parent your cursor to the camera

  • @rms4448
    @rms4448 3 ปีที่แล้ว

    Thanks for the tut bro 💪

  • @vaqakamadview
    @vaqakamadview 6 ปีที่แล้ว +7

    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 ปีที่แล้ว +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 ปีที่แล้ว +5

      Yep, that did it, thanx!

    • @theemeraldfalcon9184
      @theemeraldfalcon9184 5 ปีที่แล้ว +1

      @@vaqakamadview I tried this but it doesn't work. my sprite still doesn't line up properly

  • @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!

  • @Programisius644
    @Programisius644 6 ปีที่แล้ว +5

    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 ปีที่แล้ว +4

      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 ปีที่แล้ว +5

      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 5 ปีที่แล้ว +1

      Hey can you show me how to do that exactly please? I've tried but still couldn't figure it out. Thanks :)

    • @emc1905
      @emc1905 5 ปีที่แล้ว

      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

  • @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 !

  • @TheNamesJT
    @TheNamesJT 5 ปีที่แล้ว

    Thanks mate this helped a lot :)

  • @bibekgamebox1083
    @bibekgamebox1083 4 ปีที่แล้ว

    Great Video Noa...You're also funny with your voice

  • @brauliojorgealmeida
    @brauliojorgealmeida 3 ปีที่แล้ว

    Thanks! It helped me :)

  • @JHLandAML
    @JHLandAML 5 ปีที่แล้ว +1

    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)

  • @supersaiyan9616
    @supersaiyan9616 6 ปีที่แล้ว +7

    Please make tutorials on art in 3d

    • @Blackthornprod
      @Blackthornprod  6 ปีที่แล้ว +2

      3D art/modeling will definitely be covered on the channel in the future :) ! Stay Tuned !

  • @animationsbelike
    @animationsbelike ปีที่แล้ว

    thank you so much :D

  • @simoncodrington
    @simoncodrington 6 ปีที่แล้ว

    When in doubt, add more 3D particle effects! 🎆🎇
    Cheers for the video man :)

  • @grassfiregames3571
    @grassfiregames3571 5 ปีที่แล้ว

    You are a great youtuber!,

  • @niko587
    @niko587 2 ปีที่แล้ว

    with a thicc black
    outline

  • @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.

  • @1206Vince
    @1206Vince 6 ปีที่แล้ว +3

    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

  • @raphaelkrait7655
    @raphaelkrait7655 5 ปีที่แล้ว

    Omg this is so good thankk youuu

  • @lottomatto
    @lottomatto 5 ปีที่แล้ว +2

    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

  • @khaledmoh96
    @khaledmoh96 4 ปีที่แล้ว

    bro you are awesome

  • @MarellaSbrenz
    @MarellaSbrenz 5 ปีที่แล้ว +1

    Doesn't work for me =\ and I don't know why. My sprite just lays on the canvas.

  • @dbweb.creative
    @dbweb.creative หลายเดือนก่อน

    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.

  • @alexeybolotov3797
    @alexeybolotov3797 2 ปีที่แล้ว

    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.

  • @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.

  • @_g_r_m_
    @_g_r_m_ 3 ปีที่แล้ว +1

    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);
    }
    }

  • @AzizTheGazele552
    @AzizTheGazele552 5 ปีที่แล้ว +1

    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!

  • @carsonh7222
    @carsonh7222 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +1

      @@taayakin1108 no problemo, anytime my fren

  • @spicyvegetable3705
    @spicyvegetable3705 5 ปีที่แล้ว

    I hate you cuz i love you so im addicted to your videos

  • @lottomatto
    @lottomatto 5 ปีที่แล้ว +1

    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 5 ปีที่แล้ว +1

      set the camera tag to "MainCamera'

    • @lottomatto
      @lottomatto 5 ปีที่แล้ว +1

      @@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 5 ปีที่แล้ว

      @@lottomatto I have same problem((

    • @lottomatto
      @lottomatto 5 ปีที่แล้ว +2

      Oh ! Maybe I have the answer. Set the Camera from Perspective to Ortographik.
      Hope it helps.

  • @atitjeu
    @atitjeu 6 ปีที่แล้ว +1

    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 :) !

  • @chinyonglim7624
    @chinyonglim7624 6 ปีที่แล้ว +1

    Hmm~
    upload 9 min ago~
    video length 9min14sec~
    people are giving like at 5min ago~XD
    Btw great video again~

  • @_za740
    @_za740 4 ปีที่แล้ว +1

    how would one go about doing this with the new unity input system :)

  • @yassgaming22
    @yassgaming22 4 ปีที่แล้ว +1

    How to make the cursor bigger like in your screen shake tutorial?

  • @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 ^^

  • @armandopenatamayo691
    @armandopenatamayo691 ปีที่แล้ว

    Awesome video like alway ...but don't mess with Don't Starve 😬😅

  • @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?

  • @RaasiqShaikh98
    @RaasiqShaikh98 2 ปีที่แล้ว

    Hey so does this not work in unity 2021?
    I'm new to coding and would love some help with that

  • @fastpicker89
    @fastpicker89 3 ปีที่แล้ว

    I get this error:
    Assets\Scripts\Cursor.cs(9,16): error CS0117: 'Cursor' does not contain a definition for 'visible'

    • @lorenzocerato6081
      @lorenzocerato6081 3 ปีที่แล้ว

      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)

  • @btarg1
    @btarg1 5 ปีที่แล้ว

    Oh my god you sound enthusiastic

  • @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!

  • @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.

  • @SamaX1010
    @SamaX1010 5 ปีที่แล้ว +1

    Can you cake cursors that are animated / do animations when a button is clicked

    • @Skyvastern
      @Skyvastern 5 ปีที่แล้ว +1

      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 ปีที่แล้ว +2

      @@Skyvasternalright thanks for letting me know

  • @eriknastesjo843
    @eriknastesjo843 4 ปีที่แล้ว

    Would be cool to know how to do this in perspective mode!

  • @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;
    }
    }

  • @xaiga29
    @xaiga29 4 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

      @@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.

  • @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... :/

  • @firesnail1477
    @firesnail1477 4 ปีที่แล้ว

    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!

  • @mfatihbilhaq4977
    @mfatihbilhaq4977 6 ปีที่แล้ว +1

    Thx

  • @Yunghamster12
    @Yunghamster12 2 ปีที่แล้ว

    tried doing this by myself and it was going wayyy faster than my actual cursor so glad i found this

  • @MikeKing710
    @MikeKing710 6 ปีที่แล้ว

    Wow! It's now 3k subscribers)))

  • @JasonMorelandDigitalrecline
    @JasonMorelandDigitalrecline 3 ปีที่แล้ว

    Anyone know what the games were other than ori? I like to look of the game at. 39 secs

  • @Delvarn
    @Delvarn 4 ปีที่แล้ว

    How do I create a variable to manage cursor speed in game?

  • @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)

  • @zemangofur3986
    @zemangofur3986 4 ปีที่แล้ว

    my texture is glitched out what can i do about that?

  • @theemeraldfalcon9184
    @theemeraldfalcon9184 5 ปีที่แล้ว

    where do you open playersettings?

  • @VideosDeGatwinOficia
    @VideosDeGatwinOficia 6 ปีที่แล้ว

    awesome

  • @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)".

  • @rj-nj3uk
    @rj-nj3uk 6 ปีที่แล้ว

    why don't you do a video on level design?

  • @manolov4074
    @manolov4074 3 ปีที่แล้ว

    Doesn't work in 3d ...

  • @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

  • @sup-dp4bh
    @sup-dp4bh 3 ปีที่แล้ว

    0:55
    hell nao

  • @sasookay514
    @sasookay514 5 ปีที่แล้ว

    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 3 ปีที่แล้ว

      turn off the "Raycast target" thing in the image

    • @sonistata8390
      @sonistata8390 3 ปีที่แล้ว

      @@iamThePaleowarist Thank you I was trying to fix this issue.

  • @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

  • @Ethan-ss8lb
    @Ethan-ss8lb 5 ปีที่แล้ว

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class mouseCursor : MonoBehaviour
    {
    private SpriteRenderer rend;
    public Sprite handCursor;
    public Sprite normalCursor;
    void Start()
    {
    Cursor.visible = false;
    rend = GetComponent();
    }
    void Update()
    {
    Vector2 cursorPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    transform.position = cursorPos;
    if(Input.GetMouseButtonDown(0))
    {
    rend.sprite = handCursor;
    } else if(Input.GetMouseButtonUp(0))
    {
    rend.sprite = normalCursor;
    }
    }
    }