- antsonthetree
- Posts: 44
- Joined:
Unity Mouse Cursors
Hello,
I am trying to change the mouse cursor in Unity using this code:
Cursor = Cursors.ScrollAll;
It works fine in Blend, but it does not seem to have any effect in Unity.
Is this supported or is this a defect?
Thanks
Jake
I am trying to change the mouse cursor in Unity using this code:
Cursor = Cursors.ScrollAll;
It works fine in Blend, but it does not seem to have any effect in Unity.
Is this supported or is this a defect?
Thanks
Jake
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Unity Mouse Cursors
Each FrameworkElement exposes a Cursor property that can be set to specify one of the available cursors in Cursor enum.
We provide a callback method that will be called everytime a control demands to change the cursor. In the callback you can use Unity API to set the cursor using your cursor textures:
We provide a callback method that will be called everytime a control demands to change the cursor. In the callback you can use Unity API to set the cursor using your cursor textures:
Code: Select all
Noesis.GUI.SetUpdateCursorCallback((cursor) =>
{
UnityEngine.CursorMode cursorMode = CursorMode.Auto;
UnityEngine.Vector2 hotSpot = Vector2.zero;
switch (cursor)
{
case Noesis.Cursor.Arrow:
UnityEngine.Cursor.SetCursor(cursorArrowTexture, hotSpot, cursorMode);
break;
case Noesis.Cursor.Hand:
UnityEngine.Cursor.SetCursor(cursorHandTexture, hotSpot, cursorMode);
break;
...
}
});
Re: Unity Mouse Cursors
I don't know if we should offer a better integration for this. Like having a list of textures in NoesisSettings that we automatically use. That way our users don't need to add extra code for this part.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 73 guests