Can I pass fake input to the PlayerInput class?

Velcer

Member
Okay so: The easiest means for me to achieve multiplayer I think, would be to disable the input on character controllers that should be simulated as other players, and enable input for the character that should be controlled.
Note: While I'm handling input, that is mainly to simulate animations. I have a system in place to synchronize all movement appropriately in an authoritative way.

The issue I'm encountering is this: Without heavily modifying existing code, I cannot tell a character to move, without actually pressing a key. I cannot send any input either, if a character shouldn't be receiving input.

Ultimately I need a character to, respond to inputs that I provide, but I am at a loss for how I could do this without severe modification of existing code, which is probably not the most practical way to proceed.

I depend upon both my player character and the character that represents other players be the same character prefab.
I have tried to use an AI agent, but I couldn't figure out how to actually make the character have input when doing that. I've also tried various other methods, but there wasn't much success.

I would really appreciate a solid answer on this. I get pointed to the documentation for various things, but: I'm here because I've read the documentation and my answer isn't something I can read there. I need something constructive that can perhaps help me understand how to use this system for my needs.

Thanks,
Velcer
 
I solved this by doing the following:

I now instantiate an AI character or a player character. The AI character is sent commands as seen in documentation.

Using a single character gameobject for both player and AI proved to be more difficult than it was worth, and probably super improper to begin with.
 
Top