Navigation not enabled error. #208
Replies: 7 comments 3 replies
-
Thanks for the kind words! That error message should say As for why you're hitting that exception in the first place, one thing in particular stands out to me. In your // You'll need to make NavigationID public to use this exact code
Navigation.Focus(buttonList[0].UIBlock, controlID: InputManager.NavigationID); With that change, you shouldn't need to set // Enable navigation
inputManager.NavigationEnabled = true;
// You'll need to make NavigationID public to use this exact code
Navigation.Focus(buttonList[0].UIBlock, InputManager.NavigationID);
...
// Disable navigation
inputManager.NavigationEnabled = false; Mind trying those changes and reporting back if you're still seeing issues? As for how to tell the navigation system "nothing is focused" for a particular |
Beta Was this translation helpful? Give feedback.
-
Thanks for such fast help. I did get the error after the proposed changes. It really feels like I'm not telling the navigation system (internall) that it's done. The errors seem to be coming up on their own outside of my input script. I have DEFINITELY stopped my own calls to navigation with these changes, but this still happens: InvalidOperationException: Navigation not initialized. Focus must be called at least once with the same InternalVar_1 prior to any calls to Move. |
Beta Was this translation helpful? Give feedback.
-
OK, so yes. I just went through and made sure UpdateMouse and UpdateNavigation in my custom input manager (based on yours) is not running at all and returning if navigationEnabled = false. So in my script, it's fine. Is there a possiblity this is because of how I remove things ? I'm not sure. I can only say that is' pretty intermittent when it happens. I managed 11 level ups in a row before the problem cropped up in this last run. It actually still lets them menu come up and functions correctly, it's just logging thousands of errors as it will do this every frame. |
Beta Was this translation helpful? Give feedback.
-
Kind of wild that github won't let me attach a C# script lol. Here is where I enable the navigation, set up the buttons etc. As I said before, I feel I am not properly removing them. I had no success with my unbind code and I'm really not sure how I Should be clearing this list properly once a player has chosen an upgrade and we need to destroy the generated buttons. I'm destroying and making efforts to make sure the data is cleared. This caused Nova to stop barking at me at least :) `public void GenerateUpgradeMenu()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! `using Nova; /// /// Simple input manager example for the UI Controls sample. /// public class CustomInputManager : MonoBehaviour { /// /// Fired after mouse clicks. Can be used to determine when focus is lost. ///
#if !ENABLE_LEGACY_INPUT_MANAGER
#if ENABLE_LEGACY_INPUT_MANAGER
#if ENABLE_LEGACY_INPUT_MANAGER
#else
//Trimmed the bottom for the long block of keys etc for this post. I've had 25 level ups this morning without the bug so far. I feel that it's not necessarily gone, I've just had a run of good luck. I had an issue that forced me to reimport Nova the other day (unity licensing services went down). I had originally added to your Navigation script and another deeper script a isEnabled bool to stop this from happening. IT did work. Something odd about this bug is that whenever the upgrade menu comes up while it's spamming me with the errors, one would think it would stop upon a new upgrade menu, a new selection etc. but no, it will go on forever once it starts. This is your addon, and you know what's right. I feel like possibly it'd be good to have some kind of function to call to say go back to a clean state since the error does appear to be related to doing something on the next frame when the menu is now gone. ` |
Beta Was this translation helpful? Give feedback.
-
I just discovered that leveling up DOES stop the error. So a fresh menu, without the bug appearing on that roll will fix the error temporarily. Just stinks it keeps trying every frame and gets stuck in that state as it's a lot of errors until the next level up! |
Beta Was this translation helpful? Give feedback.
-
Hi guys. Put in the fix this morning and so far not an issue despite 30+ level ups. I will report back if something changes. I'd needed to put a check in another spot one time but will let you know if I encounter it. Wanted to say thank you for your support. Makes me feel right to buy a product and get help like this, feels like faith is rewarded. Keep up the good work. Loving Nova. |
Beta Was this translation helpful? Give feedback.
-
v.1.2.3 has just been published with the fix for this! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. Loving Nova and finding it fairly easy to make things, but using the code is a bit sloppy on my end. I am trying to pull up a menu that appears when a player gains a level. Since the choices are random, I do not need the menu to stick around. I instantiate some menu prefab rows and place them on a block with auto layout. This works pretty well.
But sometimes after choosing an upgrade, applying it and removing the menu I get the error
InvalidOperationException: Navigation not initialized. Focus must be called at least once with the same InternalVar_1 prior to any calls to Move.
Nova.Navigation.InternalMethod_2823 (Nova.Navigation+InternalType_738 InternalParameter_2457) (at Assets/Nova/Scripts/Public/DataTypes/Navigation.cs:732)
Nova.Navigation.InternalMethod_2688 () (at Assets/Nova/Scripts/Public/DataTypes/Navigation.cs:446)
Nova.InternalNamespace_0.InternalNamespace_11.InternalType_429.InternalMethod_3607 () (at Assets/Nova/Scripts/Internal/InternalScript_114.cs:60)
Here is how I'm calling the menu to be created:
`public void GenerateUpgradeMenu()
{
And this is how it's removed:
`public void HandleClickEvent(Gesture.OnClick evt, UpgradeButtonSettings target)
{
target.upgradeStats.ApplyUpgrade();
List objbuttonList = listView.gameObject.GetComponentsInChildren().ToList();
foreach (ItemView button in objbuttonList)
{
if (button != null)
{
button.gameObject.SetActive(false);
DestroyImmediate(button.gameObject);
}
}
upgradeList.Clear();
listView.Refresh();
weaponUpgradeRowDestination.Visible = false;
if (playerStatistics.playerXP > playerStatistics.xpToLevelUp)
{
playerStatistics.LevelUp();
}
else {
Root.RemoveGestureHandler<Gesture.OnClick, UpgradeButtonSettings>(HandleClickEvent);
inputManager.NavigationEnabled = false;
Navigation.isEnabled = false;
Time.timeScale = 1f;
The only solution I found was to destroy the buttons. But after the menu closes, navigation is stuck and thinks it's still on. I believe this is my fault due to how I'm handling things. I had no luck searching for this error so am looking to see if I could get some guidance on properly telling navigation it's no longer needed, and cleanly remove the buttons.
I did manage to make the error go away with Navigation.isEnabled checks by modifying the Navigation class, but I'd rather do this the RIGHT way. You can see various other things I've tried like refreshing the list. I have Bind for the data... but haven't bothered with unbind. Anything I can do to say "thank you please stop now" until Navigation is needed again?
EDIT: I just remembered this started when I made my own custom input for gamepads. This returns true:
bool canNavigate = navigationEnabled && KeyboardPresent;
bool navigating = Navigation.TryGetFocusedUIBlock(NavigationID, out UIBlock focused);
Is there a way to tell the navigation system that no ui blocks are focused at the moment without breaking something? I believe this would be the best way to tell my gamepad navigation to return and prevent this bug.
Beta Was this translation helpful? Give feedback.
All reactions