Input System Actions Asset Disappears After Hitting Play

Hello!

I have an issue with the latest version of Unity Input Manager v1.0.2, using Unity 2020.3.2f1.

This happens in any project I enable it in even the demo Simple Multiplayer project.

  • You set up a player prefab with the Player Input component
  • Assign it an action set
  • Click play
  • Hit a button on the other controller, the Player Input Manager joins that player.
  • The player prefab then shows the action set as “Type Mismatch”.
  • Stop playing and the Action Set then says “None”.
  • Hit play again and it’s just removed completely.

It’s getting really tedious having to keep re-assigning the file in the inspector every time I want to test something to do with the co-op in my game.

Is there something I am missing?

Thanks,
Dan

1 Like

It looks like something is updating your prefab. What I would do to try to figure out is: first, save everything after put the reference in, but before hitting play. Also remove the prefab from the scene. And most importantly, check, that any code references this prefab directly and if anything is changing it from code.

If I take the player prefab out of my scene it works as intended - not sure why this is the case? I suppose it means I will have to handle spawning my player differently. I wanted “drop in drop out” co-op, where there is always a player 1 in the scene and a second player can just drop in, but it doesnt seem to support that.

EDIT: Just to clarify - the problem with not having the player in the scene is that when the level starts the player has to press a button to spawn in, ideally I would want player 1 to always be active - I just tried instantiating 1 player at runtime in my game manager but the same issue occurs, as soon as I stop playing, the input action asset removes itself from my prefab, so if I hit play again it breaks!

It’s also worth noting that the video above shows this happening in the example local multiplayer scene that is provided with the Input System Package so it’s not a problem with something specific to my project.

Well, I just opened up a new project in my latest 2020.3.5f1, installed the new input system, installed the simple multiplayer sample, opened the sample scene in it and hit play. It is working properly, the reference to the input action asset is in the prefab and it doesn’t get wiped out by anything. So something must happen in your project.

Not sure if you saw my edit, it works if there isn’t already a player prefab in the scene - the problem is that without a player prefab in the scene, when a player starts the game, they will have to click once to spawn in - this seems counter intuitive. When you start a game you expect player to be spawned in and you take immediate control.

I’ve got another video here showing the issue, with the player prefab in the scene:

Well, you shouldn’t put the prefab in the scene just like that. You have the PlayerInputManager. That has a couple of methods to “join” the player manually. Switch the Join Behavior to Join the Player Manually and call the JoinPlayer method yourself on the PlayerInputManager.

This is the route I ended up taking, I’m quite new to game dev so my implementation may be quite sloppy but I’m glad I managed to figure it out on my own.

1 Like

For anyone coming across this thread in the future I will be making a tutorial on how exactly I got it working soon, but in the mean time here is the current implementation in action:

For anyone coming across this in the future, I have started a series of videos going through how I tackled this.

I know that this is a LONG time after the initial problem but this appears to have been a bug with that specific version of the Input System. Upgrading to 1.2.0 solved my issue

1 Like

Thanks! Can confirm, was having this issue with Input System 1.0.1, updated to the latest Unity 2021 LTS which has Input System 1.4.3 where the issue is resolved.