Hi, I need some explain how I can split my Player Pfreab class into small pieces. For example my Player class contains 20 Commands 20 Rpc and 20 TargetRpc methods, it’s very hard to navigate through them.
I want so split it by class “containers” like PlayerCommnds, PlayerRpcs, PlayerTargetRpc.
I tryied to create field in Player class, move method into this field type and call, but it causes diffrent network errors. When I revert method back to Player it’s again work great.
What is correct way to split Player when it growth to 999 methods?
public class Player : NetworkBehaviour
{
public ServerCommands ServerCommands;
}
public class ServerCommands
{
[Command]
public void CmdStartGame(NetworkIdentity identity)
{
// Do magic
}
public class GameManager
{
Player findLocalPlayer = ...;
findLocalPlayer.ServerCommands.CmdStartGame(findLocalPlayer .NetworkIdentity)
}