Hi Chris,
So you wonderfully helped me close the inventory bar when the cursor went above a certain height on screen using this code:
using AC;
using UnityEngine;
public class CloseInventoryOnOver : MonoBehaviour
{
public AC.ActionListAsset actionListToRun;
private void Update ()
{
Vector2 mousePosition = Input.mousePosition;
if (PlayerMenus.GetMenuWithName ("SleepytimeVillageInventory").IsOn () || (PlayerMenus.GetMenuWithName ("RealWorldInventory").IsOn ()) )
{
if (mousePosition.y > 0.20f * Screen.height)
{
PlayerMenus.GetMenuWithName ("SleepytimeVillageInventory").TurnOff ();
PlayerMenus.GetMenuWithName ("RealWorldInventory").TurnOff ();
actionListToRun.Interact();
}
}
}
}
How do I change this code so that the inventory closes at position to the left, r, above and below?
See screenshot, thanks!
https://www.dropbox.com/s/z52cca97su8c3p7/InventoryClose2.png?dl=0
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
As in, when outside of the white box?
You can make multiple checks of the same kind:
However, you can also make use of the PlayerMenu's MouseOverMenu property: