So I have a script in my scenes which you helped me create that closes inventory when cursor is in top 2 thirds of the screen (MouseOverClose). I also have a cutscene where a script sets off the inventory to open and if holding two items, they combine and cursor lock is enabled using Player Constrain. Due to the fact that this might happen when cursor is in the top two thirds of the screen, I disable the MouseOverClose script by using a call event action and unchecking the bool enabled of the CloseInventoryOnOver dropdown option. And then, using the same call event but ticking the bool enabled and un locking the cursor lock at the end of the cutscene when done. All works fine apart from the script has no effect once the cutscene has finished. Can you help?
Here is the code for the script (works perfectly):
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();
}
}
}
}
See vid:
https://www.dropbox.com/s/0iyen14o2xj2gak/CursorScript.mov?dl=0
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Your second Object: Call event Action, that re-enables the script, is not connected to the main chain of Actions.
What a numpty