docs.unity3d.com
Search Results for

    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(int)
    IBaker.GetChild(Component, int)
    IBaker.GetChild(GameObject, int)
    IBaker.GetChildren(bool)
    IBaker.GetChildren(Component, bool)
    IBaker.GetChildren(GameObject, bool)
    IBaker.GetChildren(List<GameObject>, bool)
    IBaker.GetChildren(Component, List<GameObject>, bool)
    IBaker.GetChildren(GameObject, List<GameObject>, bool)
    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>(ref BlobAssetReference<T>, out Hash128)
    IBaker.AddBlobAssetWithCustomHash<T>(ref BlobAssetReference<T>, Hash128)
    IBaker.TryGetBlobAssetReference<T>(Hash128, out BlobAssetReference<T>)
    IBaker.AddComponent<T>()
    IBaker.AddComponent<T>(in T)
    IBaker.AddComponent<T>(Entity)
    IBaker.AddComponent<T>(Entity, in T)
    IBaker.AddComponent(ComponentType)
    IBaker.AddComponent(Entity, ComponentType)
    IBaker.AddComponent(in ComponentTypeSet)
    IBaker.AddComponent(Entity, in 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, in T)
    IBaker.SetComponentEnabled<T>(Entity, bool)
    IBaker.SetComponentEnabled<T>(bool)
    IBaker.SetSharedComponentManaged<T>(Entity, in T)
    IBaker.SetSharedComponent<T>(Entity, in T)
    IBaker.SetBuffer<T>()
    IBaker.SetBuffer<T>(Entity)
    IBaker.AppendToBuffer<T>(T)
    IBaker.AppendToBuffer<T>(Entity, T)
    IBaker.CreateAdditionalEntity()
    IBaker.CreateAdditionalEntity(TransformUsageFlags, bool, string)
    IBaker.CreateAdditionalEntities(NativeArray<Entity>, TransformUsageFlags, bool)
    IBaker.RegisterPrefabForBaking(GameObject)
    IBaker.AddTransformUsageFlags(TransformUsageFlags)
    IBaker.AddTransformUsageFlags(Entity, TransformUsageFlags)
    IBaker.IsBakingForEditor()
    IBaker.GetDotsSettings()
    Namespace: Unity.Entities
    Assembly: Unity.Entities.Hybrid.dll
    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 GameObjects, Components, prefabs, and assets.

    For example you should use Baker<TAuthoringType>.GetComponent<T>() to query the authoring components instead of GameObject.GetComponent<T>().

    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

    In This Article
    Back to top
    Copyright © 2024 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)