Page 1 of 1

Unity Mouse Cursors

Posted: 14 Mar 2018, 14:14
by antsonthetree
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

Re: Unity Mouse Cursors

Posted: 14 Mar 2018, 19:10
by sfernandez
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:
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

Posted: 14 Mar 2018, 19:19
by jsantos
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.