Hello, I am a bit lost and confused regarding the change of Cursors over hotspots, and I cannot seem to find the reason why it doesn't work for me.
I would like the cursor icon to change when hovering over any hotspot. Furthermore, I would like it to change to a specific "exit" cursor when hovering over the hotspot that makes the player exit the scene.
In the cursor manager I have the main cursor set up - that works. But I also have a Hotspot cursor set and an Interaction icon set for Exiting the Scene.
My Movement method is None, Input Mouse and keyboards, Interaction method is a Custom Script. Hotspot detection Mouse over. Display Hotspot icons are set to Never (the other options make them appear in the scene and do not change the cursor).
What am I doing wrong?
General Hotspot:
Exit the Scene Hotspot:
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The auto-changing of the cursor when over Hotspots (in particular, the icon associated with it), is based on the Interaction method. When using "Custom Script", this won't occur as AC will not make assumptions about the intended behaviour.
Your best bet is probably to switch your Cursor's rendering mode over to Unity UI, which allows the use of Animator parameters to control its appearance. You can use an Animator Transition, for example, that kicks in when the active cursor ID is "3" (i.e. Exit) to play a special animation - or have it play a regular "over Hotspot" animation otherwise.
If you opted to install the default interface, switching your Cursor rendering should provide a default Unity UI Cursor prefab that you can use as the basis for your needs.
I have been trying to change to the Unity UI cursor using Animator, but I cannot make it work. Is there a tutorial somewhere? I read the manual, but I struggle to make it work.
Do I set anything in the Cursor Manager besides the Unity UI rendering mode?
I managed to add the Animator component to the cursor prefab with all the parameters in the controller.
I created a simple animator scheme with two frame animations and transitions between them (using IsOverHotspot). On runtime, in the live view of the animator, I can see it transitioning properly, but the cursor does not change in the game.
I also tried to change the Cursor ID integer in the action list by Object-Animate just to see if I can control the animator, but it has no effect (I tried both Sprites unity complex and Mecanim, where there is the option to change a parameter, but not very sure this is correct since I'm using frame animation for the cursor).
The only time any cursor is visible whatsoever is when I set it as Global cursor in Cursor Manager. And I have been unable to move past that.
Please help.
Here is the Inspector of the Cursor prefab:

Here is the Animator Controller:

To clarify: after selecting the UnityUICursor prefab instance in the scene, the IsOverHotspot value can change, causing transitions to/from the sipka and Packa states?
Double-check that the animations themselves are set up correctly, but try also clearing the Unity UI Cursor component's "Cursor RawImage" field. If the Animator is also affecting this object's Image texture, it may be that the two are competing and the effects of the Animator are being overridden by the script.
Yes, it transitions properly, and the animations are shown to play in the Animator.
I cleared the Cursor Rawimage, and it finally shows a white square of the Cursor child rawimage, but none of the cursors I set up.
The Animator component is in the parent of the cursor, together with sprite renderer that was created automatically when I created the animations for the cursor.
Just in case, this is the inspector of the Cursor child:

What is the Animator affecting? The Cursor child, or the Sprite Renderer that was created automatically? If the latter, then it may be that the Cursor child is obscuring it - try disabling the Cursor object so that it's no longer visible.
When I disable the Cursor child, the white box disappears, but no cursor shows up anyway. But the live view of the Animator is still running properly.
Here is the inspector of the Parent of the cursor prefab; maybe I made some mistakes there?
And just in case this is the Cursor Manager:
Your Animator is on the root, and affecting a Sprite Renderer - not an Image component as needed when Unity UI is involved.
Remove the Sprite Renderer, locate the Cursor child object in the Hierarchy, attach an Image component to it, and amend your Animator to affect this Image's Sprite field - rather than the Sprite Renderer attached to the same object.
I'm sorry for being so dumb, but how do I amend the Animator to do that? There are only options to select the Controller and Avatar.
I kept the Animator in the root and deleted the sprite renderer from it.
In the Cursor child, I added an Image component (not raw) and kept it set on defaults; I didn't select anything there.
But I'm still getting the white square.
It's a case of working with the Controller asset that the Animator makes use of, as well as the animations within it.
This is involving Unity's animation workflow - not AC specifically. With the way your Unity UI Cursor component is configured, AC will only control the named parameters in your Animator component - so the cursor's appearance is driven purely through animation.
If you're unfamiliar with Unity's animation workflow, Unity's Learn pages and/or Youtube videos are the best starting point.
If you'd like to share full Inspectors of your updated prefab (and children), however, I'll try to see the exact reason you're getting the white square.
Thank you for your patience, here is the prefab's Hierarchy:
Inspector of the parent:


Inspector of the child:

A UI Image component with no Sprite will show up as a white square. Assigning a sprite in its Source Image field will change its appearance.
Ultimately, though, you'd want this field to be controlled through your Kurzor Animator.
Yes, that is exactly what I want to do and what I'm struggling with. The whole cursor should be controlled by the Animator, but I cannot figure out how to connect it.
Drop the prefab into the scene, select the Animator and open up the Animation window. With the red recording button enabled, make changes to the Cursor object that you wish it to have. They should then appear as keyframes within the Animation window.
This isn't part of AC's workflow, it's Unity's standard animation toolset. Tutorials on the Unity website / Youtube are the best resource for this topic.
Thank you, Chris, I have all of this set up, and I am familiar with basic Animation workflow - I would not be asking you for that. The problem is that despite doing what you just described I am still getting the white square. Is the problem maybe caused by me normally using Sprite Unity complex animations throughout the game, while this is a classic frame animation?
Here is the setup I've been having all along. Yes, the sprites are small but should be visible instead of the white square. I don't know why they wont show.
Ah, I just noticed that when I drag the sprites into the animation, a sprite renderer gets created in the parent object. You wrote that it conflicts with the Image component in the child and should be deleted. But then the animation calls error sprite missing. So how should this be done, please?
Don't drag the sprites into the UI Hierarchy - that will generate a Sprite Renderer component, which is meant for regular scene objects, not UI.
Your cursor sprites should be displayed within the Cursor object's Image component. That component's Source Image field is what should be animated with the sprite sequence.
Click the Record button, set the first frame, and set the Source Image to the animation's first sprite.
It finally works! I had no idea I could also animate this way. Chris, you're the best! Thank you so much! :-)
I have a question about the best practice for changing the Unity UI cursor over certain hotspots. I want the cursor to change into a specific "exit" animation over the hotspot that marks the exit from the scene only.
I figured the best way would be to change the CursorID. I set up a trigger over the hotspot that should detect the cursor and change the parameter in the cursor's animator. But the value does not change. I am not sure if I set it up correctly or if I'm doing this right. Can you please give me some advice?
This is the trigger and its action setup:

I figured out the problem is not really in the trigger but that the Object: Animate action does not change the parameter in the animator for some reason. It does not work even if I put it into OnStart cutscene. I thought this was pretty straightforward, so I'm a bit puzzled about what I am doing wrong here.
Two issues with this:
1) If you've assigned the CursorID parameter in the Unity UI Cursor component's Cursor ID int field, then AC will be taking control over its value - you won't be able to override it through Actions.
2) The Trigger won't be able to detect the cursor prefab, as it's not an object in the scene with a collider.
The CursorID is the right approach, though. Create a new Cursor in the Cursor Manager, specifically for exit Hotspots (may need separate left/right exits if you want to show these as separate icons), and note the ID. Set the Exit Hotspot's Use interaction to use this cursor, and you should then find the CursorID parameter changes to this ID value when hovering over it. What affect this has on your cursor is down to the Animator and the Unity UI Cursor component's configuration.