Currently working on a planting simulator game where I am trying to add a second player (P2). The first player (P1) works perfectly fine in the absence of P2, it moves, has an inventory, etc.
Once I added P2 with the same components (with only a differing input system, I’m using Unity’s input system), not only does it not move- it completely erases P1 when I try to run the game! In an attempt to try and isolate problems, I untagged P1 in the inspector to see if at least P2 functions normally without P1, but it seems like P2 is just completely broken.
Player 1 is using WASD whereas I’m trying to get Player 2 to use arrow keys. Both have the “Player” tag and both player controllers use Unity events.
After trying multiple solutions, here are a few things I noticed:
- When trying to run the game, P2 is moved into DoNotDestroyOnLoad but P1 isn’t and disappears
- I receive a “MissingReferenceException” error in my console, but it is associated with another game object and is a result of P1’s disappearance
- When trying to test P2’s movement, its Z position keeps moving negative, freezing the value does not solve the problem
Here are a few solutions I tried:
- Added a “don’t destroy object” script to the player controller script attached to both players
- Tried question solutions referring to problems with animators and ‘skin mesh renders’(?), doesn’t seem to apply to my problems since I have no animations and only mesh renderers
- Messed around a lot with freezing/unfreezing player positions, P2 simply does not move, and P1 gets completely erased when tested
I would really appreciate any ideas on what to try or do to fix this, if anyone would like more info please lmk. Thanks!