Forum rules - please read before posting.

Hardware Cursor: Click offset (from top left) not possible?

Hi,

I have different ' Click offset (from top left)' X/Y values, set for all of my cursors, which works perfectly when Cursor rendering is set to Software.
At first, I figured the "Hardware" rendering mode by default disables/ignores these Click offset values, so I abandoned that setting.

Recently, I tried using this script to enable a Unity UI prefab based cursor, as I'm trying to use Unity UI prefabs as much as possible for greater control:
https://adventure-creator.fandom.com/wiki/Unity_UI-based_cursor

However, I can't seem to find the right approach to simulate ACs cursor offset values in a Hardware-cursor (mandatory for above script), Unity UI cursor prefab.
Do I need to play around with the prefab's Rect Transform values?
And how would that work for multiple cursors with different offsets?

Apologies if this is a Unity-only question. I just want to make sure I'm not overlooking the correct AC approach to achieve this.
If anyone has general advice how best to draw/resize cursor icons, so their click offset will always be the same.. even better. :)

unity version: 2019.4.17f1
AC version: 1.73.0

Kind regards,
Paul

Comments

  • Hardware cursor rendering doesn't ignore click offset values - they're passed as the "hotspot" parameter in Unity's Cursor.SetCursor function.

    They will not be referenced by the wiki script, though the script could feasibly be tweaked to do so. The script works by hooking into the OnSetHardwareCursor event, which passes the offset as a parameter.

    The quick-and-dirty approach, though, would be to keep all click-points in the same relative position in each graphic. For example, each cursor graphic's click-point was in the centre of it's texture. This would just need to involve padding your textures with empty space so as to move the click-point into the centre of the image.

  • Brilliant, that helps. Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.