Problem:
A method referenced by one of my buttons randomly comes up as “Missing”:
Details:
The referenced method is not static, although that shouldn’t be an issue in 5. Here’s the referenced script:
using UnityEngine;
using System.Collections;
public class MenuManager : MonoBehaviour
{
// …
//Referenced method
public void ShowMenu(Menu menu)
{
if(menu.IsPopup == false)
{
//Closes the current menu
if(CurrentMenu != null)
{
CurrentMenu.IsOpen = false;
CurrentMenu.IsActive = false;
}
//Sets new menu (target of function) to CurrentMenu, and opens current menu
CurrentMenu = menu;
CurrentMenu.IsOpen = true;
CurrentMenu.IsActive = true;
}
else
{
if(CurrentMenu != null)
{
CurrentMenu.IsOpen = false;
CurrentMenu.IsActive = true;
}
CurrentMenu = menu;
CurrentMenu.IsOpen = true;
CurrentMenu.IsActive = true;
}
}
}
The object that OnClick is referencing has the component script on it, and the method in the component shows up in the OnClick drop-down menu in editor:
Attempted Solutions:
I’ll replace the missing reference by reselecting it from the drop-down menu. Then I save and close Unity, reopen it a few times or work on other scripts, and the method shows up as Missing again. I’ve tried recreating the button wholesale, renaming the script, moving the script to a difference object in the Hierarchy and referencing it there-- all to no avail.
Desperately seeking help. Thanks for looking.