{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Struct RpcExecutor | Netcode for Entities | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct RpcExecutor

    Struct that can be used to simplify writing systems and jobs that deserialize and execute received rpc commands.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.NetCode
    Assembly: solution.dll
    Syntax
    public struct RpcExecutor

    Methods

    Name Description
    ExecuteCreateRequestComponent<TActionSerializer, TActionRequest>(ref Parameters)

    Helper method that can be used to implement the execute method for the IRpcCommandSerializer<T> interface. By calling the ExecuteCreateRequestComponent, a new entity (with a TActionRequest and a ReceiveRpcCommandRequest component) is created. It is the users responsibility to write a system that consumes the created rpcs entities. For example:

    public struct MyRpcConsumeSystem : ISystem
    {
       private Query rcpQuery;
       public void OnCreate(ref SystemState state)
       {
           var builder = new EntityQueryBuilder(Allocator.Temp).WithAll<MyRpc, ReceiveRpcCommandRequestComponent>();
           rcpQuery = state.GetEntityQuery(builder);
       }
       public void OnUpdate(ref SystemState state)
       {
            foreach(var rpc in SystemAPI.Query<MyRpc>().WithAll<ReceiveRpcCommandRequestComponent>())
            {
                //do something with the rpc
            }
            //Consumes all of them
            state.EntityManager.DestroyEntity(rpcQuery);
       }
    }
    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)