Forum rules - please read before posting.

Inventory item

I was looking if is posible to make something like pick up an object an in the inventory bar make an small animation like a simple scale +1 to know what object you select.

Comments

  • You can do this either by injecting code into a custom event, or with parameters.  You can see a recent discussion on this topic here.
  • Ok i get the idea but wich event can scale an inventory item in place?
  • As @Snebjorn mentioned in the other thread, OnInventoryAdd.  An event doesn't do anything by itself - it allows you to run your own code at certain times - in this case, when a new inventory item is added.
  • Ok maybe i dont get the idea i use the same script that the other topic. Work for a text inscription of what you pick up.

    I try something there like item.cursorIcon.GetSprite.transform.localScale += new Vector3(0.1F, 0, 0); but oviusly is not the way to scale the inventory item you pick up.
    I want it like this: minute 3:55
  • That script was a demonstration of how something along these lines can be done - you still need to amend it to suit your own purposes.

    You could do that by creating a Unity UI Menu just for that purpose, and animate a child RectTransform with a regular Animator controller.  This could be run with a regular Object: Animate Action, but before it you would need to use a custom Action that simply updates the graphic in your UI Image with the desired inventory sprite, eg:

    GameObject.Find ("MyImageObject").GetComponent <UnityEngine.UI.Image>().sprite = newInventorySprite;

    If you're having difficulty with custom events, I would recommend doing it on one test inventory item without it - just a regular series of Actions that go with the normal "Inventory: Add or remove".  You can look into using custom events / parameters afterwards.
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.