[BUG] KeyNotFoundException: The given key was not present in the dictionary
I created binding for both the Valve and Index controller for my project and ran into an issue with steam seeming to try and bind to another project. (Restarting SteamVR and/or the PC then reopening the project from the Unity HUB seemed to work but now any time i open any project I get a key binding error.
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
Valve.VR.SteamVR_Input.GetBaseActionFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:470)
Valve.VR.SteamVR_Action.FindExistingActionForPartialPath (System.String path) (at Assets/SteamVR/Input/SteamVR_Action.cs:521)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].TryNeedsInitData () (at Assets/SteamVR/Input/SteamVR_Action.cs:134)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].InitAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action.cs:219)
Valve.VR.SteamVR_Action_Vector2.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Vector2.cs:179)
and
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
Valve.VR.SteamVR_Input.GetBaseActionFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:470)
Valve.VR.SteamVR_Action.FindExistingActionForPartialPath (System.String path) (at Assets/SteamVR/Input/SteamVR_Action.cs:521)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].TryNeedsInitData () (at Assets/SteamVR/Input/SteamVR_Action.cs:134)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].InitAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action.cs:219)
Valve.VR.SteamVR_Action_Boolean.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Boolean.cs:222)
Also while the binding is set up in the web dashboard on the left controller and mirrored to the right controller for some reason only the right controller works and the left controller can only be used to teleport?
This was made in Unity 2019.2.2
Another project Made in Unity 2018.3.9 gets:
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
Valve.VR.SteamVR_Input.GetBaseActionFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:470)
Valve.VR.SteamVR_Action.FindExistingActionForPartialPath (System.String path) (at Assets/SteamVR/Input/SteamVR_Action.cs:521)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].TryNeedsInitData () (at Assets/SteamVR/Input/SteamVR_Action.cs:134)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].InitAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action.cs:219)
Valve.VR.SteamVR_Action_Single.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Single.cs:176)
and
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
Valve.VR.SteamVR_Input.GetBaseActionFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:470)
Valve.VR.SteamVR_Input.GetActionDataFromPath[T] (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:396)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].Initialize (System.Boolean createNew, System.Boolean throwErrors) (at Assets/SteamVR/Input/SteamVR_Action.cs:172)
Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].InitAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action.cs:228)
Valve.VR.SteamVR_Action_Single.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Single.cs:176)
when nothing in it was changed.
What version of the SteamVR plugin are you using? Have you generated actions? Do your projects have the same name?
Sorry for the slow response Things have been busy and the issue went away for a bit. I am now back to this project and I am once again seeing a key not found issue.
I am in Unity 2018.3.9f1 with this project and I am using SteamVR 1.9.15 with the plugin 2.2.0 Where do I find the exact plugin version? I tried to update yesterday to 2.5.0 but I looked in the readme and it seems I am still using v2.2.0 which is what I was using when the project was working last month.
I tried deleting and restoring binding, rebooting, moving the project to a new folder etc. I built the project in 2019.2 but had issues with the post effects and was unable to get LWRP or HDRP to work with steam so i went back to 2018.3 Before the key issue started it all worked fine. I left the project alone one week end and came back to this issue. Then i spent most of December working on another project and forgot about this. The projects in question have similar names but not the same name.
Trying advanced tools in the SteamVR input settings I clicked create and made a file with a unique name, overwriting old actions and removing unused actions.
I still have the Key not found and also see:
Error loading action manifest into SteamVR: MismatchedActionManifest UnityEngine.Debug:LogError(Object) Valve.VR.SteamVR_Input:IdentifyActionsFile(Boolean) (at Assets/SteamVR/Input/SteamVR_Input.cs:1261) Valve.VR.SteamVR:CreateInstance() (at Assets/SteamVR/Scripts/SteamVR.cs:179) Valve.VR.SteamVR:Initialize(Boolean) (at Assets/SteamVR/Scripts/SteamVR.cs:98) Valve.VR.SteamVR_Behaviour:InitializeSteamVR(Boolean) (at Assets/SteamVR/Scripts/SteamVR_Behaviour.cs:116) Valve.VR.SteamVR_Behaviour:Awake() (at Assets/SteamVR/Scripts/SteamVR_Behaviour.cs:97)
Update: I ran an update to get plugin version v2.5 (sdk 1.8.19) and now have
Assertion failure. Value was Null Expected: Value was not Null
and
NullReferenceException: Object reference not set to an instance of an object UnityEngine.Rendering.PostProcessing.RuntimeUtilities.get_copyStdMaterial () (at Library/PackageCache/[email protected]/PostProcessing/Runtime/Utils/RuntimeUtilities.cs:269) UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at Library/PackageCache/[email protected]/PostProcessing/Runtime/PostProcessLayer.cs:605) UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at Library/PackageCache/[email protected]/PostProcessing/Runtime/PostProcessLayer.cs:440)
I don't see any issue with my post process and nothing on it was changed? more importantly the Key not found error persists and I now get a pop up for Steam VR 2.1 that is blocked by System Admin
After Updating to 2.5 and closing then reopening the project the error is gone but I still cant teleport an now no other interaction on the hand works. I am going back to an older version and they are broken now too!
I wiped out my default and costume binding and rebuilt both. now I am back to the same issue of Key not found?
KeyNotFoundException: The given key was not present in the dictionary. System.Collections.Generic.Dictionary
2[TKey,TValue].get_Item (TKey key) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0) Valve.VR.SteamVR_Input.GetBaseActionFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:470) Valve.VR.SteamVR_Input.GetActionDataFromPath[T] (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:396) Valve.VR.SteamVR_Action2[SourceMap,SourceElement].Initialize (System.Boolean createNew, System.Boolean throwErrors) (at Assets/SteamVR/Input/SteamVR_Action.cs:172) Valve.VR.SteamVR_Action`2[SourceMap,SourceElement].InitAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action.cs:228) Valve.VR.SteamVR_Action_Single.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Single.cs:176)
So... I went to play a steam game just to relax a little and then reloaded my project and while the error still pops up I can now perform every task again? I have no idea whats going on with this but for now it is working in-spite of the error.
Anyone have idea how to clear the error? Its intermittent issues are killing the project. I left for a few days, came back this morning and tried to run the scene to find that the Index Controller wont show up and the Vive controller can't teleport! (The controller button works and shows the arc but the teleport floor doesn't show up? and the only console error is this key not found issue.
Update: I checked the binding and the index had no current binding so I assigned one and it now shows the controller but the teleportation floor still doesn't work for either controller type.
The error seems to suggest that there is code asking for a controller input that doesn't exist in the binding but I can't find any such code or lacking binding.
Add to the issues SteamVR Fail "Oh no! SteamVR has encountered an unexpected problem. (-204)
The error is now happening for Vector2, Boolean, and single?
Valve.VR.SteamVR_Action_Vector2.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Vector2.cs:179)
Valve.VR.SteamVR_Action_Boolean.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Boolean.cs:222)
Valve.VR.SteamVR_Action_Single.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_Action_Single.cs:176)
All I changed was the port from 8998 to 27062 in line 358 of the SteamVR.cs ?
I looked at binding from a fresh scene with nothing in it but SteamVR 2.2 (also tested 2.5) I added the player and removed the default camera. I saved and generated binding and ran the project. I copied the binding from this project to get reset the default binding and the error on SteamVR_Action_Single is still present?
Do I need to change something such as My editor app key or something. Someone please help this has wasted days!
So I think it is this line of code causing issues
public SteamVR_Action_Single triggerAction = SteamVR_Input.GetAction<SteamVR_Action_Single>("Tools", "TriggerPull");
Any help would be appreciated.
@keithbradner I have responded to your questions and proactively added more to this issue but I have not heard back. Is this something that can be fixed? Can it be safely ignored?
To add to this issue when I work in multiple Unity projects and I open the Binding It is not opening different bindings for each project.
Example I have Project A, B, and C. I work in A then I move over to C and I update its binding. Then I go back to A and it has the same binding as C even though the two files have nothing to do with one another and I didn't change the Binding in A. I then went back to C and its bindings where fine.
I checked the Editor App Key listed in the inspector by opening SteamVR Input> Advanced Settings > SteamVR Settings. All three projects have different strings starting with application.generated.unity.<My current Project name>.exe So this error seems to be a bug.
So I had a project that had an editor app key on.generated.unity.twounityproject.exeoject.exe and today I opned it and its editor app key has changed to on.generated.unity.oneunityproject.exeoject.exe and no I get a key not found error! This has got to be a bug in the way that SteamVR is working with Unity hub and simultaneous project editing.
Is there a solution for this yet?
Still getting
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <567df3e0919241ba98db88bec4c6696f>:0)
Valve.VR.SteamVR_Input.GetActionSetFromPath[T] (System.String path, System.Boolean caseSensitive, System.Boolean returnsNulls) (at Assets/SteamVR/Input/SteamVR_Input.cs:970)
Valve.VR.SteamVR_Input.GetActionSetFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:992)
Valve.VR.SteamVR_Input.GetActionSetDataFromPath (System.String path, System.Boolean caseSensitive) (at Assets/SteamVR/Input/SteamVR_Input.cs:466)
Valve.VR.SteamVR_ActionSet.Initialize (System.Boolean createNew, System.Boolean throwErrors) (at Assets/SteamVR/Input/SteamVR_ActionSet.cs:178)
Valve.VR.SteamVR_ActionSet.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at Assets/SteamVR/Input/SteamVR_ActionSet.cs:366)
@Giantbean you're getting this in the latest beta? 2.7.1?
Can you post a full editor logfile?
2.2 to 2.6.1 and Log from project that started the issue 2018.3 using 2.2 attached. Editor.log
Gotcha, I'm seeing these errors now. Do you have the OpenVR Desktop package installed in the package manager?
Yep. V1.0.5
Do I need to change something in the SteamVR_Input.CS around line 917?
public static T GetActionSetFromPath<T>(string path, bool caseSensitive = false, bool returnsNulls = false) where T : SteamVR_ActionSet, new()
{
if (actionSets == null || actionSets[0] == null || string.IsNullOrEmpty(path))
{
if (returnsNulls)
return null;
return SteamVR_ActionSet.Create<T>(path);
}
if (caseSensitive)
{
if (actionSetsByPath.ContainsKey(path))
{
return actionSetsByPath[path].GetCopy<T>();
}
}
else
{
if (actionSetsByPathCache.ContainsKey(path))
{
SteamVR_ActionSet set = actionSetsByPathCache[path];
if (set == null)
return null;
else
return set.GetCopy<T>();
}
else if (actionSetsByPath.ContainsKey(path))
{
actionSetsByPathCache.Add(path, actionSetsByPath[path]);
return actionSetsByPath[path].GetCopy<T>();
}
else
{
string loweredPath = path.ToLower();
if (actionSetsByPathLowered.ContainsKey(loweredPath))
{
actionSetsByPathCache.Add(path, actionSetsByPathLowered[loweredPath]);
return actionSetsByPath[loweredPath].GetCopy<T>();
}
else
{
actionSetsByPathCache.Add(path, null);
}
}
}
I'm also having issues with baking lighting as it moves my files from the folder they where baked to and then try's to bake again putting me in a loop I have to cancel out of. This moving of files is strange as I can take a .png into an image editing software to update it and when i loud it back into the project from the file explorer I place it in the folder I want it in but when I go back to Unity and let Unity load the file it moves the image out of the folder and puts it up a layer in the folder structure. (This only happens in this project and I have no other errors in the console)