Input Authority
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on Fusion.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Input Authority
firegamestudios
2022-07-24 23:31:39
Hello Ramon, how are you doing? We're having a problem here with InputAuthority, I was hoping you could help us.
In our game Eo, we have Dungeon Masters around the players and they need to be able to "Possess" NPCs, so they're always jumping from one NPC to the other to talk to players. So, in our NetworkPlayer, we have a method like this:
public void Possess(PlayerRef player, NetworkPlayer oldPlayer)
{
Local = this;
Camera.main.GetComponent<CameraScript>().target = transform;
//Enable new input and disable old one
SpawnManager.SetCharacterInput(characterInputHandler);
GetComponent<CharacterInputHandler>().enabled = true;
oldPlayer.GetComponent<CharacterInputHandler>().enabled = false;
SpawnManager.RPC_AlertDMs(oldPlayer.name + " possessed " + pcName);
Object.AssignInputAuthority(player);
oldPlayer.Object.RemoveInputAuthority();
// SpawnManager.Despawn(oldPlayer);
}
Seemed pretty straight forward to me, but we're failing here. If I comment the line oldPlayer.Object.RemoveInputAuthority() then it works but the Dungeon Master is moving both NPCs now, the one he possessed and the one he came from. The thing is, if we use the oldPlayer.Object.RemoveInputAuthority() line, something happens and the DM loses authority completely for both NPCs. Do you know what we're doing wrong here?
All the best,
Rafael at www.firegamestudios.com
Comments
firegamestudios
2022-07-26 04:01:40
Curiosidade: você é brasileiro? Nosso estúdio é brasileiro :)
Back to top