private void UpdateMenu (Menu menu)
		{
			Vector2 invertedMouse = playerInput.GetInvertedMouse ();
			UpdateMenuPosition (menu, invertedMouse);
			
			menu.HandleTransition ();
			
			if (settingsManager)
			{
				if (settingsManager.inputMethod == InputMethod.KeyboardOrController && menu.IsEnabled () &&
				    ((stateHandler.gameState == GameState.Paused && menu.pauseWhenEnabled) || (stateHandler.gameState == GameState.DialogOptions && menu.appearType == AppearType.DuringConversation)))
				{
					playerInput.selected_option = menu.ControlSelected (playerInput.selected_option);
				}
			}
			else
			{
				Debug.LogWarning ("A settings manager is not present.");
			}
			
			if (menu.appearType == AppearType.Manual)
			{
				if (menu.IsVisible () && !menu.isLocked && menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
				{
					playerInput.mouseOverMenu = true;
				}
			}
			
			else if (menu.appearType == AppearType.DuringGameplay)
			{
				if (stateHandler.gameState == GameState.Normal && !menu.isLocked && menu.IsOff ())
				{
					menu.TurnOn (true);
					
					if (menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
					{
						playerInput.mouseOverMenu = true;
					}
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.TurnOff (true);
				}
				else if (stateHandler.gameState != GameState.Normal && menu.IsOn () && actionListManager.AreActionListsRunning ())
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.MouseOver)
			{
				if (stateHandler.gameState == GameState.Normal && !menu.isLocked && menu.GetRect ().Contains (invertedMouse))
				{
					if (menu.IsOff ())
					{
						menu.TurnOn (true);
					}
					
					if (!menu.ignoreMouseClicks)
					{
						playerInput.mouseOverMenu = true;
					}
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.ForceOff ();
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.OnContainer)
			{
				if (playerInput.activeContainer != null && !menu.isLocked && (stateHandler.gameState == GameState.Normal || (stateHandler.gameState == AC.GameState.Paused && menu.pauseWhenEnabled)))
				{
					if (menu.IsVisible () && menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
					{
						playerInput.mouseOverMenu = true;
					}
					menu.TurnOn (true);
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.DuringConversation)
			{
				if (playerInput.activeConversation != null && stateHandler.gameState == GameState.DialogOptions)
				{
					menu.TurnOn (true);
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.ForceOff ();
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.OnInputKey)
			{
				if (menu.IsEnabled () && !menu.isLocked && menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks)
				{
					playerInput.mouseOverMenu = true;
				}
				
				try
				{
					if (Input.GetButtonDown (menu.toggleKey))
					{
						if (!menu.IsEnabled ())
						{
							if (stateHandler.gameState == GameState.Paused)
							{
								CrossFade (menu);
							}
							else
							{
								menu.TurnOn (true);
							}
						}
						else
						{
							menu.TurnOff (true);
						}
					}
				}
				catch
				{
					if (settingsManager.inputMethod != InputMethod.TouchScreen)
					{
						Debug.LogWarning ("No '" + menu.toggleKey + "' button exists - please define one in the Input Manager.");
					}
				}
			}
			
			else if (menu.appearType == AppearType.OnHotspot)
			{
				if (settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive && !menu.isLocked && runtimeInventory.selectedItem == null)
				{
					Hotspot hotspot = playerInteraction.GetActiveHotspot ();
					if (hotspot != null)
					{
						menu.HideInteractions ();
						
						if (hotspot.HasContextUse ())
						{
							menu.MatchUseInteraction (hotspot.GetFirstUseButton ());
						}
						
						if (hotspot.HasContextLook ())
						{
							menu.MatchLookInteraction (hotspot.lookButton);
						}
						
						menu.Recalculate ();
					}
				}
				
				if (hotspotLabel != "" && !menu.isLocked && (stateHandler.gameState == GameState.Normal || stateHandler.gameState == GameState.DialogOptions))
				{
					menu.TurnOn (true);
				}
				else if (stateHandler.gameState == GameState.Paused)
				{
					menu.ForceOff ();
				}
				else
				{
					menu.TurnOff (true);
				}
			}
			
			else if (menu.appearType == AppearType.OnInteraction)
			{
				if (settingsManager.CanClickOffInteractionMenu ())
				{
					if (menu.IsEnabled () && (stateHandler.gameState == GameState.Normal || menu.pauseWhenEnabled))
					{
						playerInput.interactionMenuIsOn = true;
						
						if (playerInput.mouseState == MouseState.SingleClick && !menu.GetRect ().Contains (invertedMouse))
						{
							playerInput.mouseState = MouseState.Normal;
							playerInput.interactionMenuIsOn = false;
							menu.ForceOff ();
						}
					}
					else if (stateHandler.gameState == GameState.Paused)
					{
						playerInput.interactionMenuIsOn = false;
						menu.ForceOff ();
					}
					else if (playerInteraction.GetActiveHotspot () == null)
					{
						playerInput.interactionMenuIsOn = false;
						menu.TurnOff (true);
					}
				}
				else
				{
					if (menu.IsEnabled () && (stateHandler.gameState == GameState.Normal || menu.pauseWhenEnabled))
					{
						if (menu.GetRect ().Contains (invertedMouse) && !menu.ignoreMouseClicks && (playerInteraction.GetActiveHotspot () != null || runtimeInventory.selectedItem != null))
						{
							playerInput.interactionMenuIsOn = true;
						}
						else if (settingsManager.SelectInteractionMethod () == SelectInteractions.CyclingMenuAndClickingHotspot && playerInteraction.GetActiveHotspot () != null)
						{
							playerInput.interactionMenuIsOn = true;
						}
						else if (settingsManager.SelectInteractionMethod () == SelectInteractions.CyclingMenuAndClickingHotspot && (runtimeInventory.selectedItem != null && runtimeInventory.selectedItem == runtimeInventory.hoverItem))
						{
							playerInput.interactionMenuIsOn = true;
						}
						else if (playerInteraction.GetActiveHotspot () == null || settingsManager.inputMethod == InputMethod.TouchScreen)
						{
							menu.TurnOff (true);
						}
						else if (runtimeInventory.selectedItem == null && playerInteraction.GetActiveHotspot () != null && runtimeInventory.hoverItem != null)
						{
							menu.TurnOff (true);
						}
						else if (runtimeInventory.selectedItem != null && runtimeInventory.selectedItem != runtimeInventory.hoverItem)
						{
							menu.TurnOff (true);
						}
					}
					else if (stateHandler.gameState == GameState.Paused)
					{
						menu.ForceOff ();
					}
					else if (playerInteraction.GetActiveHotspot () == null)
					{
						menu.TurnOff (true);
					}
				}
			}
			
			else if (menu.appearType == AppearType.WhenSpeechPlays)
			{
				if (stateHandler.gameState != GameState.Paused)
				{
					if (dialog.isMessageAlive && stateHandler.gameState != GameState.DialogOptions &&
					    (menu.speechMenuType == SpeechMenuType.All ||
					 (menu.speechMenuType == SpeechMenuType.CharactersOnly && dialog.GetSpeakingCharacter () != null) ||
					 (menu.speechMenuType == SpeechMenuType.NarrationOnly && dialog.GetSpeakingCharacter () == null)))
					{
						if (options.optionsData == null || (options.optionsData != null && options.optionsData.showSubtitles) || (speechManager && speechManager.forceSubtitles && !dialog.foundAudio)) 
						{
							menu.TurnOn (true);
						}
						else
						{
							menu.TurnOff (true);	
						}
					}
					else
					{
						menu.TurnOff (true);
					}
				}
				else
				{
					menu.ForceOff ();
				}
			}
		}
		private void CheckClick (Menu _menu, MenuElement _element, int _slot, MouseState _mouseState)
		{
			playerInput.mouseState = MouseState.Normal;
			
			if (_mouseState == MouseState.LetGo)
			{
				if (settingsManager.inputMethod == InputMethod.TouchScreen && !settingsManager.offsetTouchCursor && runtimeInventory.selectedItem == null && !(_element is MenuInventoryBox) && !(_element is MenuCrafting))
				{
					_mouseState = MouseState.SingleClick;
				}
				else
				{
					_mouseState = MouseState.Normal;
					return;
				}
			}
			
			if (_mouseState != MouseState.Normal)
			{
				if (_element.clickSound != null && sceneSettings != null)
				{
					sceneSettings.PlayDefaultSound (_element.clickSound, false);
				}
				
				if (_element is MenuDialogList)
				{
					MenuDialogList dialogList = (MenuDialogList) _element;
					dialogList.RunOption (_slot);
				}
				
				else if (_element is MenuSavesList)
				{
					MenuSavesList savesList = (MenuSavesList) _element;
					
					if (savesList.ProcessClick (_slot))
					{
						if (savesList.saveListType == AC_SaveListType.Save)
						{
							_menu.TurnOff (true);
						}
						else if (savesList.saveListType == AC_SaveListType.Load)
						{
							_menu.TurnOff (false);
						}
					}
				}
				
				else if (_element is MenuButton)
				{
					MenuButton button = (MenuButton) _element;
					button.ShowClick ();
					
					if (button.buttonClickType == AC_ButtonClickType.TurnOffMenu)
					{
						_menu.TurnOff (button.doFade);
					}
					else if (button.buttonClickType == AC_ButtonClickType.Crossfade)
					{
						Menu menuToSwitchTo = GetMenuWithName (button.switchMenuTitle);
						
						if (menuToSwitchTo != null)
						{
							CrossFade (menuToSwitchTo);
						}
						else
						{
							Debug.LogWarning ("Cannot find any menu of name '" + button.switchMenuTitle + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.OffsetInventoryOrDialogue)
					{
						MenuElement elementToShift = GetElementWithName (_menu.title, button.inventoryBoxTitle);
						
						if (elementToShift != null)
						{
							elementToShift.Shift (button.shiftInventory, button.shiftAmount);
							elementToShift.RecalculateSize ();
						}
						else
						{
							Debug.LogWarning ("Cannot find '" + button.inventoryBoxTitle + "' inside '" + _menu.title + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.OffsetJournal)
					{
						MenuJournal journalToShift = (MenuJournal) GetElementWithName (_menu.title, button.inventoryBoxTitle);
						
						if (journalToShift != null)
						{
							journalToShift.Shift (button.shiftInventory, button.loopJournal);
							journalToShift.RecalculateSize ();
						}
						else
						{
							Debug.LogWarning ("Cannot find '" + button.inventoryBoxTitle + "' inside '" + _menu.title + "'");
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.RunActionList)
					{
						if (button.actionList)
						{
							AdvGame.RunActionListAsset (button.actionList);
						}
					}
					else if (button.buttonClickType == AC_ButtonClickType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
					else if (button.buttonClickType == AC_ButtonClickType.SimulateInput)
					{
						playerInput.SimulateInput (button.simulateInput, button.inputAxis, button.simulateValue);
					}
				}
				
				else if (_element is MenuSlider)
				{
					MenuSlider slider = (MenuSlider) _element;
					if (settingsManager.inputMethod == InputMethod.KeyboardOrController)
					{
						slider.Change ();
					}
					else
					{
						slider.Change (playerInput.GetMousePosition ().x - _menu.GetRect ().x);
					}
					if (slider.sliderType == AC_SliderType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
				}
				
				else if (_element is MenuCycle)
				{
					MenuCycle cycle = (MenuCycle) _element;
					cycle.Cycle ();
					
					if (cycle.cycleType == AC_CycleType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
				}
				
				else if (_element is MenuToggle)
				{
					MenuToggle toggle = (MenuToggle) _element;
					toggle.Toggle ();
					
					if (toggle.toggleType == AC_ToggleType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
				}
				
				else if (_element is MenuInventoryBox)
				{
					MenuInventoryBox inventoryBox = (MenuInventoryBox) _element;
					if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.CustomScript)
					{
						MenuSystem.OnElementClick (_menu, _element, _slot, (int) _mouseState);
					}
					else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Default || inventoryBox.inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected)
					{
						if (settingsManager.inventoryInteractions == InventoryInteractions.Multiple && settingsManager.SelectInteractionMethod () == SelectInteractions.CyclingCursorAndClickingHotspot)
						{
							if (_mouseState == MouseState.SingleClick)
							{
								playerInteraction.ClickInvItemToInteract ();
							}
						}
						else if (settingsManager.inventoryInteractions == InventoryInteractions.Multiple && playerInput.interactionMenuIsOn && settingsManager.SelectInteractionMethod () == SelectInteractions.CyclingMenuAndClickingHotspot && runtimeInventory.selectedItem == runtimeInventory.hoverItem)
						{
							SetInteractionMenus (false);
							playerInteraction.ClickInvItemToInteract ();
						}
						else if (settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && settingsManager.inventoryInteractions == InventoryInteractions.Single)
						{
							inventoryBox.HandleDefaultClick (_mouseState, _slot, AC_InteractionMethod.ContextSensitive);
						}
						else
						{
							inventoryBox.HandleDefaultClick (_mouseState, _slot, settingsManager.interactionMethod);
						}
						_menu.Recalculate ();
					}
					else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Container)
					{
						inventoryBox.ClickContainer (_mouseState, _slot, playerInput.activeContainer);
						_menu.Recalculate ();
					}
					else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.HostpotBased)
					{
						if (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
						{
							if (runtimeInventory.selectedItem != null)
							{
								runtimeInventory.Combine (inventoryBox.items [_slot]);
							}
							else if (playerInteraction.GetActiveHotspot ())
							{
								InvItem _item = inventoryBox.items [_slot];
								if (_item != null)
								{
									runtimeInventory.SelectItem (_item);
									_menu.TurnOff (false);
									playerInteraction.ClickButton (InteractionType.Inventory, -2, _item.id);
									playerCursor.ResetSelectedCursor ();
								}
							}
							else
							{
								Debug.LogWarning ("Cannot handle inventory click since there is no active Hotspot.");
							}
						}
						else
						{
							Debug.LogWarning ("This type of InventoryBox only works with the Choose Hotspot Then Interaction method of interaction.");
						}
					}
				}
				
				else if (_element is MenuCrafting)
				{
					MenuCrafting recipe = (MenuCrafting) _element;
					
					if (recipe.craftingType == CraftingElementType.Ingredients)
					{
						recipe.HandleDefaultClick (_mouseState, _slot);
					}
					else if (recipe.craftingType == CraftingElementType.Output)
					{
						recipe.ClickOutput (_menu, _mouseState);
					}
					
					_menu.Recalculate ();
				}
				
				else if (_element is MenuInteraction)
				{
					MenuInteraction interaction = (MenuInteraction) _element;
					
					if (settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
					{
						Debug.LogWarning ("This element is not compatible with the Context-Sensitive interaction method.");
					}
					else if (settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
					{
						playerCursor.SetCursorFromID (interaction.iconID);
					}
					else if (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
					{
						if (runtimeInventory.selectedItem != null)
						{
							_menu.ForceOff ();
							runtimeInventory.RunInteraction (false, interaction.iconID);
						}
						else if (playerInteraction.GetActiveHotspot ())
						{
							_menu.ForceOff ();
							playerInteraction.ClickButton (InteractionType.Use, interaction.iconID, -1);
						}
					}
				}
				
				else if (_element is MenuInput)
				{
					SelectInputBox ((MenuInput) _element);
				}
				
				else if (_element is MenuDrag)
				{
					if (_mouseState == MouseState.SingleClick)
					{
						MenuDrag drag = (MenuDrag) _element;
						drag.StartDrag (_menu);
						playerInput.activeDragElement = drag;
					}
				}
				
				PlayerMenus.ResetInventoryBoxes ();
			}
		}