Hey Chris, a while ago I wrote the following script. This is what I used it for:
Essentially, the script below is used to (1) update the variables to display the correct data from each profile, and (2) to control whether the info text menu is supposed to be turned on or off.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AC;
public class ProfileSetup : MonoBehaviour
{
AC.Menu myMenu;
private void OnEnable() { EventManager.OnMouseOverMenu += OnMouseOverMenu; }
private void OnDisable() { EventManager.OnMouseOverMenu -= OnMouseOverMenu; }
private void OnMouseOverMenu(AC.Menu _menu, AC.MenuElement _element, int _slot)
{
AC.Menu myMenu = AC.PlayerMenus.GetMenuWithName("ProfileChoice time");
if (_element != null && _menu.title == "ProfileChoice")
{
if (_menu.title == "ProfileChoice" && _element.title == "Profile 1")
{
AC.GlobalVariables.SetStringValue(51, KickStarter.options.GetProfileIDName(1));
string location = AC.Options.GetProfileVariable(1, 52).PopUpValue;
AC.GlobalVariables.SetStringValue(53, location);
myMenu.TurnOn();
}
if (_menu.title == "ProfileChoice" && _element.title == "Profile 2")
{
AC.GlobalVariables.SetStringValue(51, KickStarter.options.GetProfileIDName(2));
string location = AC.Options.GetProfileVariable(2, 52).PopUpValue;
AC.GlobalVariables.SetStringValue(53, location);
myMenu.TurnOn();
}
if (_menu.title == "ProfileChoice" && _element.title == "Profile 3")
{
AC.GlobalVariables.SetStringValue(51, KickStarter.options.GetProfileIDName(3));
string location = AC.Options.GetProfileVariable(3, 52).PopUpValue;
AC.GlobalVariables.SetStringValue(53, location);
myMenu.TurnOn();
}
}
else
{
myMenu.TurnOff();
Debug.Log("element is null");
}
}
}
This used to work perfectly, but now the menu never fades out when the you move the cursor away. The AC 1.79 patch notes include this fix:
Fixed: OnMouseOverMenu custom event sometimes being called when de-selecting an element
Which was the exact behaviour that I was using to make this work! Was this intended? And if so, is there a workaround? I thought about checking IsPointInside(invertedMouse), but this only seems to be available when you get a whole menu, not a specific element within it. I also checked if there was a custom event like OnElementDeselect (since the patch notes said my script was working BECAUSE the event was being called when deselecting an element), but no such custom event appears to exist.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Apologies - a change made without considering all side-effects.
I'll look into it further, and may revert back in the next release. In the meantime, open PlayerMenus and replace line 2189:
with: