docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Fixed strings

    Netcode's serialization system natively supports Unity's Fixed String types (FixedString32, FixedString64, FixedString128, FixedString512, and FixedString4096). The serialization system intelligently understands these fixed string types and ensures that only the amount of the string in use is serialized, even for the larger types. This native support ensures Netcode uses no more bandwidth than is necessary.

    [Rpc(SendTo.Server)]
    void SetPlayerNameServerRpc(FixedString32 playerName) { /* ... */ }
    
    void SetPlayerName(string name)
    {
        SetPlayerNameServerRpc(new FixedString32(name));
    }
    
    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)