Hi,
For my previous game using UNITY 2019.4.14f1 and AC V1.66.8 i had a script that would close or open certain menus on player move. However, in bringing this script into my new game using UNITY 2020.3.19f1 and AC V1.74.2 it now gives me an error.
Here is script:
using UnityEngine;
using System.Collections;
using AC;
public class CloseInventory : MonoBehaviour
{
void Awake()
{
DontDestroyOnLoad(this.gameObject);
}
void Start()
{
}
private void Update()
{
if (KickStarter.player.IsMovingAlongPath())
{
PlayerMenus.GetMenuWithName("RealWorldInventory").TurnOff();
PlayerMenus.GetElementWithName ("InGame", "IconPhone").TurnOn();
}
}
}
and here is error:
Assets/Sleepytime Village/Scripts/CloseInventory.cs(24,59): error CS1061: 'MenuElement' does not contain a definition for 'TurnOn' and no accessible extension method 'TurnOn' accepting a first argument of type 'MenuElement' could be found (are you missing a using directive or an assembly reference?)
Can you help?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
If you want to make an element visible, you can set its IsVisible property:
Will IsVisible be counted as MenuOff though in a variable check? ie if I then click a button to turn that MenuOn, will it recognise that it is off and thus turn it on?
IsVisible relates to the Element inside a Menu - not the Menu itself. Changing an Element's visibility has no effect on the "on" state of the Menu it's a part of.
ok thanks.
Amd this scripting should work find too?
PlayerMenus.GetMenuWithName("RealWorldInventory").TurnOff();
It should.
Thanks Chris