Components | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Components

    Components in DOTS Mode act as data containers only. To create Components in DOTS Mode, you must create a C# script which implements the IComponentData interface.

    The example below shows a component which contains the data for three float variables.

    using Unity.Entities;
    
    namespace game
    {
        public struct ThingComponent : IComponentData
        {
            public float radius;
            public float time;
            public float speed;
    
            public static ThingComponent Default
            {
                get
                {
                    var thing = new ThingComponent
                    {
                        radius = 1,
                        time = 1,
                        speed = 1
                    };
    
                    return thing;
                }
            }
        }
    }
    
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023