SteamVR
Nobi-Knobi 2019 年 12 月 12 日 上午 3:01
SteamVR & Unity: Input Action is null after Scene Reload.
I'm having big trouble to find out what's wrong with my Input system.

Everything works fine until the Unity Scene gets reloaded. All scripts that check on SteamVR_Action_Boolean in update throw massive amounts of errors, saying that:
NullReferenceException: Object reference not set to an instance of an object
The Player is destroyed on load (and that is of course what I want).

I assign the desired Boolean Action in the inspector like this:
public SteamVR_Action_Boolean buttonToActivate = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("GrabGrip");

and use it in Update() like this:
if (button[SteamVR_Input_Sources.Any].stateDown)
DoSomething();

I also tried to dirty fix it with this line in update:
if (buttonToActivate == null)
buttonToActivate = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("default", "GrabGrip");

I also tried to enable and disable all options in the VR-Player like:
- Don't destroy on load
- Initialize SteamVR on awake
- Action set activation on load

I also rebuilded the complete actions .json.

I don't know what to do anymore and I'm wasting hours upon hours, not being able to reload a scene.
I hope some expert can help, I'd really appreciate it! <3
最後修改者:Nobi-Knobi; 2019 年 12 月 12 日 上午 3:15
< >
目前顯示第 1-1 則留言,共 1
Nobi-Knobi 2019 年 12 月 12 日 上午 6:15 
I found the root of the problem!

After 9 hours of debugging and reinstalling whole SteamVR with everything that comes with it, I realized while building the new Player Prefab that at the point I remove the "GrabGripAction" on one of the Hand scripst, this error starts to happen again!
I don't quite understand why, because this should only be the action this hand is using - so my understanding.

I turned it off, because I one day spent an equal massive amount of time to change the fact, that Thrwoables are pickable via the trigger AND the grip buttons (which breaks my Gameplay).
I have the same problem now again, and I'm still not understanding why it seems to be hardcoded into the interaction system, because it breaks apparently any gameplay which is not some kind of prototype.
But well, thats a question for another Thread.

So, if you have problems with null pointers in Interactions:
Make sure all Actions in the Hand scripts are assigned and not None!
< >
目前顯示第 1-1 則留言,共 1
每頁顯示: 1530 50

張貼日期: 2019 年 12 月 12 日 上午 3:01
回覆: 1