Forum rules - please read before posting.

Some cursor questions

edited March 2020 in Technical Q&A

AC Ver: 1.70.4
Unity Ver: 2019.2.4f1

Hey,

So, I decided to delve into cursors a bit tonight!

For the most part I've managed to change things up to how I want (goodbye AC default circle blob, you will be missed) but I've a few questions;

1) Hardware / software - any pref as to which one should be used for best practice? I know hardware has a size limitation, but, can then use Unity UI so just curious what the general consensus is.

2) Selecting inventory items - currently when the player selects an item in my inventory the cursor disappears and I'm guessing is replaced by the item graphic.

Here's my wonderful assistant Tim Schafer demonstrating what I mean;

Let's say instead of the cursor disappearing / being replaced I'd like it to stick around and appear to _grab _the item image and both it and the item image move around. Are we talking some custom scripting to get that done?

3) OnClick animation- when the player holds down/clicks the left mouse button I'd like the visual of the cursor to change. Does AC offer any support for this or would I have to move to something like Unity UI to do that?

Thanks!

Comments

  • Alas, poor default circle blob.

    1) I personally prefer using a Unity UI cursor, as it allows for parameter-based animation. Software cursor can have a tendency to draw the system cursor as well after alt-tabbing back and forth, so I'd choose Unity UI -> Hardware -> Software.

    2) You can assign dedicated inventory cursor graphics - so you could incorporate the cursor + the item into a single icon.

    Alternatively, you could create a Menu that shows the selected inventory item in an InventoryBox, and follows the cursor while an inventory item is selected.

    Or, yes, you could do it through scripting. The Unity UI cursor wiki script could be used just to update a RawImage component when an item is selected:

    private void OnEnable ()
    {
        EventManager.OnInventorySelect += OnInventorySelect;
        EventManager.OnInventoryDeselect += OnInventoryDeselect;
    }
    
    private void OnDisable ()
    {
        EventManager.OnInventorySelect -= OnInventorySelect;
        EventManager.OnInventoryDeselect -= OnInventoryDeselect;
    }
    
    private void OnInventorySelect (InvItem invItem)
    {
        rawImageToControl.texture = invItem.tex;
    }
    
    private void OnInventoryDeselect (InvItem invItem)
    {
        rawImageToControl.texture = null;
    }
    

    3) Animation is possible through use of the Unity UI wiki script.

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.