GUI Animation?

Dragonflame

New member
Hi there, is it possible to trigger an animation-event in the GUI? For example: When I finish crafting something, I would like to show a little animation that you succeeded. Is this possible?
 
Have a look at the CraftingMenu demo script. You can inspire yourself from it to create your own crafting menu. For now you may want to add an animation when succesfully crafting but later you may want more custom things so I think it's worth making your own crafting menu.

The Craft function return a CraftResult. So you could check if the craft was a success and trigger your animation from there.
Here I changed the CraftSelectedQuantity function of the CraftingMenu script to give you an idea of how it could be done:

C#:
/// <summary>
/// Wait for the player to select a quantity.
/// </summary>
/// <returns>The task.</returns>
private void CraftSelectedQuantity()
{
    var quantity = m_QuantityPickerPanel.QuantityPicker.Quantity;
    if (quantity >= 1) {
        var craftResult = m_CraftingProcessor.Craft(m_SelectedRecipe, m_ClientInventory, quantity);
        if (craftResult.Success) {
            m_SuccessAnimationGameObject.SetActive(true);
        }
    }
    m_RecipePanel.SetQuantity(1);
    m_RecipePanel.Refresh();
}

The m_SuccessAnimationGameObject could be a gameobject that plays an animation on enable and disables itself when the animation is done.
 
Top