docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Enum types

    A user-defined enum type will be serialized by built-in serialization code (with underlying integer type).

    enum SmallEnum : byte
    {
        A,
        B,
        C
    }
    
    enum NormalEnum // default -> int
    {
        X,
        Y,
        Z
    }
    
    [Rpc(SendTo.Server)]
    void ConfigServerRpc(SmallEnum smallEnum, NormalEnum normalEnum) { /* ... */ }
    
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.P))
        {
            ConfigServerRpc(SmallEnum.A, NormalEnum.X); // Client -> Server
        }
    }
    
    In This Article
    Back to top
    Copyright © 2025 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)