Forum rules - please read before posting.

Show Menu Object inventory found

Hello everyone, i'd like to show a menu just after grab an object with a label name of the object and the icon who correspond. For use language correctly,i need to have the same variable of inventory object settings (name and main graphic).

Somebody have an idea for do this please ? 

image


Comments

  • i found a solution !!! This is :
    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;
    using AC;
    public class DisplayMenuObjectFound : MonoBehaviour {
    public InventoryManager inventoryManager;
    public Text label;
    public RawImage iconObject;


    public void UpdateMenu (int itemsNumber) {

    label.text = inventoryManager.items [itemsNumber].altLabel;
    iconObject.texture = inventoryManager.items [itemsNumber].tex;

    }
    }
  • better way : 

    public void UpdateMenu (int itemsNumber) {

    if (AC.KickStarter.settingsManager.defaultLanguage == 1 ) {
    label.text = inventoryManager.items [itemsNumber].GetLabel(1);
    }
    if (AC.KickStarter.settingsManager.defaultLanguage == 2) {
    label.text = inventoryManager.items [itemsNumber].GetLabel(2);
    }
    iconObject.texture = inventoryManager.items [itemsNumber].tex;

    }
  • Thanks for posting!  You could also place this code inside an Action so that you can call it as part of an ActionList.
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.