In my game, I have an "observation" mode that is toggled by pressing a key or an icon in the UI. When in this mode, I want the cursor to turn into an eye and when it passes over an "observable" object, I want the cursor to change to an highlighted version of the eye.
I change the cursor over an object using "scene object" components but I don't know how to change the default cursor at runtime from my standard arrow to an "eye" and then turn it back to an arrow when the player opts out of the observation mode. I've tried:
CursorChange c = new CursorChange();
ORK.CursorSettings.defaultCursor = c;
...but I wasn't able to set the texture of the CursorChange type to a Texture2D from Unity. What should I do?
Should I set the cursor using Unity's standard methods instead? Is there a better way to proceed in order for ORK to manage my cursor states in the case I want to add a new state that doesn't exist?
If you're using a reference asset source (which is the default in a newly created instance), you can set it like this:
ORK.CursorSettings.defaultCursor.settings.EditorAsset = texture;
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
ORK.CursorSettings.defaultCursor.texture.settings.EditorAsset = texture
.texture was missing!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
ORK.CursorSettings.defaultCursor.texture.settings.EditorAsset = texture
has changed. In order to update it, I need to addORK.CursorSettings.ShowCursor(CursorType.Default);
It might be related to the change with scene objects where, in 2.30.0, ORK now checks every frame...Anyway, I was able to make it work, but I thought you would like to know...
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Let's recap the situation: I want to implement an "examine" mode where, when the player presses Left Shift, the cursor turns from an arrow to an eye. If the player releases the Left Shift, then the cursor returns to the arrow. If, when in "examine" mode (eye cursor), the cursor hovers over an "examinable" item, the cursor texture should turn to an highlighted state as long as the cursor is over the item. It indicates that the player can now press the left mouse button to have info on the object.
If I don't add the ShowCursor() line and only use ORK.CursorSettings.defaultCursor.texture.settings.EditorAsset = texture, what happens is that when I press the shift key while the cursor is NOT over an examinable item, it doesn't turn into the eye. If I keep the shift key pressed and move the cursor (that is an arrow but should be an eye) over an examinable object, then it correctly turns into an highlighted eye cursor. Then, when I place my cursor away from the horse, it correctly turns into the non-highlighted eye. However, when I release the shift key, it doesn't turn back to the arrow texture.
All of this is solved when I add the ShowCursor() line. However, before I upgraded, it wasn't needed.
Hope it helps!
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!