Hi Chris, I wonder if you can help. I am using a Unity UI Cursor for my cursor. However, for UI prefabs menus my cursor will not change when hovering over them. Can you help me work out to make the cursor change over specific UI menus?
Please see pdf with further info and screenshots
https://drive.google.com/file/d/1_xvApiqxzb_9ULXvbFtzdV5JaYXsNhPs/view?usp=sharing
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Currently, only the RawImage will be affected when hovering over such elements. If you're controlling the display with animation, that'll override this texture.
I should, however, be able to add the ability for the "Cursor ID" parameter to respond to menu elements. I will look into this as part of the next update.
Thanks Chris!
It is. From the Changelog:
ok, I have updated to latest AC but my UNity UI cursor is still not changing. If you check the PDF link above, does my cursors animator have the correct variables and parameters for this to work?
Check the Animator controller's "UseIconID" parameter value. Is that updating when hovering over elements?
yes it is, goes to -1 on the UI menus
It should be -1 when normally over menus, but switch to the ID of the specified cursor (0 for Use) when over that element.
This is the behaviour I get when testing on my end. Try it on yours with the default Menu Manager's InGame menu.
so my UseIconID when just on the cursor mode is -1, and changes accordingly when hovering over hostpots correctly, and my CursorID changes the same as UseIconID also, however, menu I hover over the menu the MenuOverideID changes (but only on menu) but nothing else changes when over a menu
see video here:
https://drive.google.com/file/d/1tQfEHDfKNHHH14HMUCmUDmOs1-FMnS1C/view?usp=share_link
Forget UseIconID - that's me looking in the wrong place. CursorID should be the one that changes.
There may be a conflict with your other components, however.
Temporarily remove your Cursor Script component, so that AC's provided Unity UI Cursor is the only script component attached to it. Does that change the behaviour of the CursorID parameter?
Please see video here, when I turn off cursor script it only shows UseOnly action
https://drive.google.com/file/d/13Z8PtOLoAu4Ond-jkUK1N8-eoa7jJW0m/view?usp=share_link
You'd need to tell me if essentially it works with CursorScript off? And then what to do to ensure my animations / Cursor way works, thanks!
Ignoring the animations not running correctly, the CursorID is being correctly set to 0 when you now hover over the button without CursorScript.
This suggests CursorScript is overriding the value of CursorID, so you'll need to prevent this from happening by commenting out any code that calls Animator.SetInteger for "CursorID".
ok so I have commented out this line:
And now the cursor works as it should elsewhere, but not on the menus? it is just normal cursor, what do I need to do now to make it change to a specific cursor on menus?
The commented out line is from this section of code
Was the cursor working elsewhere but the menus not the original issue?
The Unity UI Cursor script should set CursorID correctly if you prevent your own script from overriding it, but this is how you can set it manually:
Was the cursor working elsewhere but the menus not the original issue?
Yes
So Chris, what should I do next, sorry?
Replace:
with:
I get this error
Assets/Sleepytime Village/Scripts/CursorScript.cs(93,23): error CS0103: The name 'cursorIDIntParameter' does not exist in the current context