You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Resize with MenuSizeChangerFunction() function in Update();
// create UI Panel in Unity Editor with size 2200, 1100, call it "menuInventoryPanel".
// creat script for this UI Panel called "inventoryMenuScript" and copy this code there.
// create Button in Unity Editor, in "On Click()" editor add new element and atache "menuInventoryPanel" and choose "inventoryMenuScript > InventoryInteraction0" as function.
using UnityEngine;
using UnityEngine.UI;
public class inventoryMenuScript : MonoBehaviour
{
public Vector2 desiredMenuSize;
public float lerpTimer = 0f;
public bool lerpTimerChecker = false;
public bool inventoryMenuSizeChanger = false;
public bool inventoryMenuResizingInProgress = false;
void Start ()
{
this.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
this.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
this.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
this.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f);
this.GetComponent<RectTransform>().sizeDelta = new Vector2(1760f, 880f);
}
void Update()
{
if (inventoryMenuResizingInProgress) // if true then resize this element