docs.unity.cn
    Show / Hide Table of Contents

    Class Baker<TAuthoringType>

    Inherit this class to bake an authoring component.

    Inheritance
    Object
    IBaker
    Baker<TAuthoringType>
    Inherited Members
    IBaker.GetSceneGUID()
    IBaker.GetComponent<T>()
    IBaker.GetComponent<T>(Component)
    IBaker.GetComponent<T>(GameObject)
    IBaker.GetComponents<T>(List<T>)
    IBaker.GetComponents<T>(Component, List<T>)
    IBaker.GetComponents<T>(GameObject, List<T>)
    IBaker.GetComponents<T>()
    IBaker.GetComponents<T>(Component)
    IBaker.GetComponents<T>(GameObject)
    IBaker.GetComponentInParent<T>()
    IBaker.GetComponentInParent<T>(Component)
    IBaker.GetComponentInParent<T>(GameObject)
    IBaker.GetComponentsInParent<T>(List<T>)
    IBaker.GetComponentsInParent<T>(Component, List<T>)
    IBaker.GetComponentsInParent<T>(GameObject, List<T>)
    IBaker.GetComponentsInParent<T>()
    IBaker.GetComponentsInParent<T>(Component)
    IBaker.GetComponentsInParent<T>(GameObject)
    IBaker.GetComponentInChildren<T>()
    IBaker.GetComponentInChildren<T>(Component)
    IBaker.GetComponentInChildren<T>(GameObject)
    IBaker.GetComponentsInChildren<T>(List<T>)
    IBaker.GetComponentsInChildren<T>(Component, List<T>)
    IBaker.GetComponentsInChildren<T>(GameObject, List<T>)
    IBaker.GetComponentsInChildren<T>()
    IBaker.GetComponentsInChildren<T>(Component)
    IBaker.GetComponentsInChildren<T>(GameObject)
    IBaker.GetParent()
    IBaker.GetParent(Component)
    IBaker.GetParent(GameObject)
    IBaker.GetParents()
    IBaker.GetParents(Component)
    IBaker.GetParents(GameObject)
    IBaker.GetParents(List<GameObject>)
    IBaker.GetParents(Component, List<GameObject>)
    IBaker.GetParents(GameObject, List<GameObject>)
    IBaker.GetChild(Int32)
    IBaker.GetChild(Component, Int32)
    IBaker.GetChild(GameObject, Int32)
    IBaker.GetChildren(Boolean)
    IBaker.GetChildren(Component, Boolean)
    IBaker.GetChildren(GameObject, Boolean)
    IBaker.GetChildren(List<GameObject>, Boolean)
    IBaker.GetChildren(Component, List<GameObject>, Boolean)
    IBaker.GetChildren(GameObject, List<GameObject>, Boolean)
    IBaker.GetChildCount()
    IBaker.GetChildCount(Component)
    IBaker.GetChildCount(GameObject)
    IBaker.GetName()
    IBaker.GetName(Component)
    IBaker.GetName(GameObject)
    IBaker.GetLayer()
    IBaker.GetLayer(Component)
    IBaker.GetLayer(GameObject)
    IBaker.GetTag()
    IBaker.GetTag(Component)
    IBaker.GetTag(GameObject)
    IBaker.GetEntity()
    IBaker.GetEntity(GameObject)
    IBaker.GetEntity(Component)
    IBaker.GetEntity(TransformUsageFlags)
    IBaker.GetEntity(GameObject, TransformUsageFlags)
    IBaker.GetEntity(Component, TransformUsageFlags)
    IBaker.GetEntityWithoutDependency()
    IBaker.IsActive()
    IBaker.IsActive(Component)
    IBaker.IsActive(GameObject)
    IBaker.IsActiveAndEnabled()
    IBaker.IsActiveAndEnabled(Component)
    IBaker.IsStatic()
    IBaker.IsStatic(Component)
    IBaker.IsStatic(GameObject)
    IBaker.IsClient()
    IBaker.IsServer()
    IBaker.DependsOn<T>(T)
    IBaker.DependsOnComponentInParent<T>()
    IBaker.DependsOnComponentInParent<T>(Component)
    IBaker.DependsOnComponentInParent<T>(GameObject)
    IBaker.DependsOnComponentsInParent<T>()
    IBaker.DependsOnComponentsInParent<T>(Component)
    IBaker.DependsOnComponentsInParent<T>(GameObject)
    IBaker.DependsOnComponentInChildren<T>()
    IBaker.DependsOnComponentInChildren<T>(Component)
    IBaker.DependsOnComponentInChildren<T>(GameObject)
    IBaker.DependsOnComponentsInChildren<T>()
    IBaker.DependsOnComponentsInChildren<T>(GameObject)
    IBaker.DependsOnComponentsInChildren<T>(Component)
    IBaker.DependsOnLightBaking()
    IBaker.AddBlobAsset<T>(BlobAssetReference<T>, Hash128)
    IBaker.AddBlobAssetWithCustomHash<T>(BlobAssetReference<T>, Hash128)
    IBaker.TryGetBlobAssetReference<T>(Hash128, BlobAssetReference<T>)
    IBaker.AddComponent<T>()
    IBaker.AddComponent<T>(T)
    IBaker.AddComponent<T>(Entity)
    IBaker.AddComponent<T>(Entity, T)
    IBaker.AddComponent(ComponentType)
    IBaker.AddComponent(Entity, ComponentType)
    IBaker.AddComponent(ComponentTypeSet)
    IBaker.AddComponent(Entity, ComponentTypeSet)
    IBaker.AddComponentObject<T>(T)
    IBaker.AddComponentObject<T>(Entity, T)
    IBaker.AddSharedComponentManaged<T>(T)
    IBaker.AddSharedComponentManaged<T>(Entity, T)
    IBaker.AddSharedComponent<T>(T)
    IBaker.AddSharedComponent<T>(Entity, T)
    IBaker.AddBuffer<T>()
    IBaker.AddBuffer<T>(Entity)
    IBaker.SetComponent<T>(Entity, T)
    IBaker.SetComponentEnabled<T>(Entity, Boolean)
    IBaker.SetComponentEnabled<T>(Boolean)
    IBaker.SetSharedComponentManaged<T>(Entity, T)
    IBaker.SetSharedComponent<T>(Entity, T)
    IBaker.SetBuffer<T>()
    IBaker.SetBuffer<T>(Entity)
    IBaker.AppendToBuffer<T>(T)
    IBaker.AppendToBuffer<T>(Entity, T)
    IBaker.CreateAdditionalEntity()
    IBaker.CreateAdditionalEntity(TransformUsageFlags, Boolean, String)
    IBaker.RegisterPrefabForBaking(GameObject)
    IBaker.AddTransformUsageFlags(TransformUsageFlags)
    IBaker.AddTransformUsageFlags(Entity, TransformUsageFlags)
    IBaker.IsBakingForEditor()
    IBaker.GetDotsSettings()
    Namespace: Unity.Entities
    Syntax
    public abstract class Baker<TAuthoringType> : IBaker where TAuthoringType : Component
    Type Parameters
    Name Description
    TAuthoringType

    The type of the authoring component.

    Remarks

    Use the methods in Baker<TAuthoringType> to access any data outside of the authoring component. This ensures that the baking pipeline can keep track of any dependencies. This applies to GameObject, Component, prefabs, and assets.

    For example you should use Baker<TAuthoringType> to query the authoring components instead of UnityEngine.GameObject.GetComponent``1.

    Examples
         public class MyAuthoring : MonoBehaviour
         {
             public int Value;
         }
    
         public struct MyComponent : IComponentData
         {
             public int Value;
             public float3 Position;
         }
    
         public class MyBaker : Baker<MyAuthoring>
         {
             public override void Bake(MyAuthoring authoring)
             {
                 // Accessing the transform using Baker function, not the GameObject one
                 // so the this baker can keep track of the dependency
                 var transform = GetComponent<Transform>();
                 var entity = GetEntity(TransformUsageFlags.Dynamic);
                 AddComponent(entity, new MyComponent
                 {
                     Value = authoring.Value,
                     Position = transform.position
                 } );
             }
         }

    Methods

    Name Description
    Bake(TAuthoringType)

    Called in the baking process to bake the authoring component

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023