Forum begins after the advertisement:


[Part 9] Stacking to unstacking

Home Forums Video Game Tutorial Series Creating a Farming RPG in Unity [Part 9] Stacking to unstacking

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16995
    Jhan Khendrick Perez
    Level 5
    Participant
    Helpful?
    Up
    0
    ::

    Hello will their be a guide on how to unstack them?

    #17021
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    1
    ::

    We will probably do this in a future part.

    If you would like to implement it now here’s the basic logic:

    1. What you will need is an additional variable to store the selected slot, and have it saved in InventoryManager when the OnPointerClick is triggered in the InventorySlot. (If the slot has something)
    2. Then on the same OnPointerClick function is triggered in the InventorySlot and it is empty, you can write a function such that it transfers the selected slot entirely as a stack on left click, and only 1 on right click.

    To implement this you’ll need to:

    1. Add the selection tracking variables to InventoryManager
    2. Create a UI element for the selected slot highlight
    3. Update the InventorySlot click handling
    4. Add cursor following in Update()

    Hope this helps.

    has upvoted this post.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: