Skip to content

RPC logic calling inherited type always calls base. #938

@FirstGearGames

Description

@FirstGearGames

Reported by Discord Id !@890806465835716659

https://discord.com/channels/424284635074134018/1034477094731784302/1390808006874107934

public class GameModeManager : NetworkBehaviour
{
    public TeamDeathMatch Active;

    public override void OnStartServer()
    {
        base.OnStartServer();
        StartGameMode();
    }

    [ObserversRpc]
    private void StartGameMode()
    {
        Active.OnStartGameModeClientSide(); // Logs "GameplayModeStarted TeamDeathMatch"
    }
}

public class GameplayMode : NetworkBehaviour
{
    public virtual void OnStartGameModeClientSide()
    {
        Debug.Log($"GameplayModeStarted {this.GetType().Name}");
    }
}

public class TeamDeathMatch : GameplayMode
{
    public override void OnStartGameModeClientSide()
    {
        Debug.Log($"TeamDeathMatchStarted {this.GetType().Name}");
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolved Pending ReleaseIssue is resolved and will be available on the noted version.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions