### RenderMeshDescription Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Represents how to setup and configure Entities Graphics entities. ```APIDOC ## Struct RenderMeshDescription ### Description Represents how to setup and configure Entities Graphics entities. ### Type Struct ``` -------------------------------- ### HeapBlock.begin Property Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapBlock.html Gets the starting memory address of the allocated block. This is a raw offset within the managed heap. ```csharp public ulong begin { get; } ``` -------------------------------- ### Begin Upload Frame Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Starts a new upload frame, returning a ThreadedSparseUploader. This uploader is valid until the next call to EndAndCommit. Specify maximum data size, largest upload size, and maximum operation count for the frame. ```csharp public ThreadedSparseUploader Begin(int maxDataSizeInBytes, int biggestDataUpload, int maxOperationCount) ``` -------------------------------- ### Get Materials from MaterialMeshInfo Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Retrieves a list of Materials associated with a given MaterialMeshInfo. Returns null if the materials are runtime. ```csharp public List GetMaterials(MaterialMeshInfo materialMeshInfo) ``` -------------------------------- ### EntitiesGraphicsStatsDrawer Component Setup Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/manual/entities-graphics-performance.html Attach this component to a new GameObject to enable the on-screen GUI for Culling and Rendering stats in the GameView. This component is Editor only. ```csharp using Unity.Entities.Graphics; // ... // Create a new GameObject and attach the EntitiesGraphicsStatsDrawer component. // Example: // GameObject statsDrawer = new GameObject("EntitiesGraphicsStatsDrawer"); // statsDrawer.AddComponent(); ``` -------------------------------- ### Get Material from MaterialMeshInfo Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Retrieves the Material associated with a given MaterialMeshInfo. Returns null if the material is runtime. ```csharp public Material GetMaterial(MaterialMeshInfo materialMeshInfo) ``` -------------------------------- ### MaterialColor Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html An unmanaged component that acts as an example material override for setting the RGBA color of an entity. ```APIDOC ## Struct MaterialColor ### Description An unmanaged component that acts as an example material override for setting the RGBA color of an entity. ### Type Struct ``` -------------------------------- ### Get 128-bit Hash of RenderMeshArray Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Returns a 128-bit hash that uniquely identifies the contents of the RenderMeshArray. This is useful for efficient comparisons. ```csharp public uint4 GetHash128() ``` -------------------------------- ### MaterialMeshInfo Properties Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialMeshInfo.html Provides properties to get and set material and mesh IDs, as well as check for the presence of a material/mesh index range. ```APIDOC ## MaterialMeshInfo.HasMaterialMeshIndexRange { get; } ### Description True if the MaterialMeshInfo is using a MaterialMeshIndex range. ### Property Value - **HasMaterialMeshIndexRange** (bool) ``` ```APIDOC ## MaterialMeshInfo.MaterialID { get; set; } ### Description The material ID property. ### Property Value - **MaterialID** (BatchMaterialID) ``` ```APIDOC ## MaterialMeshInfo.MaterialMeshIndexRange { get; } ### Description The MaterialMeshIndex range. ### Property Value - **MaterialMeshIndexRange** (RangeInt) ``` ```APIDOC ## MaterialMeshInfo.MeshID { get; set; } ### Description The mesh ID property. ### Property Value - **MeshID** (BatchMeshID) ``` ```APIDOC ## MaterialMeshInfo.SubMesh { get; set; } ### Description The sub-mesh ID. ### Property Value - **SubMesh** (ushort) ``` -------------------------------- ### SparseUploader.Begin Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Begins a new upload frame and returns a new ThreadedSparseUploader that is valid until the next call to SparseUploader.EndAndCommit. ```APIDOC ## Begin(int, int, int) ### Description Begins a new upload frame and returns a new ThreadedSparseUploader that is valid until the next call to SparseUploader.EndAndCommit. ### Parameters - **maxDataSizeInBytes** (int) - An upper bound of total data size that you want to upload this frame. - **biggestDataUpload** (int) - The size of the largest upload operation that will occur. - **maxOperationCount** (int) - An upper bound of the total number of upload operations that will occur this frame. ### Returns - **ThreadedSparseUploader** - Returns a new ThreadedSparseUploader that must be passed to SparseUploader.EndAndCommit later. ### Remarks You must follow this method with a call to SparseUploader.EndAndCommit later in the frame. You must also pass the returned value from a Begin method to the next SparseUploader.EndAndCommit. ``` -------------------------------- ### Instantiate Entities in a Burst Job Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/manual/runtime-entity-creation.html This C# script demonstrates how to create a prototype entity and then spawn numerous copies of it within a Burst job. It utilizes `EntityCommandBuffer` for efficient parallel entity creation and `LocalToWorld` to set unique transforms for each spawned entity. Ensure you have `Mesh` and `Material` assigned in the Inspector. ```csharp using Unity.Collections; using Unity.Entities; using Unity.Jobs; using Unity.Mathematics; using Unity.Rendering; using Unity.Transforms; using UnityEngine; using UnityEngine.Rendering; public class AddComponentsExample : MonoBehaviour { public Mesh Mesh; public Material Material; public int EntityCount; // Example Burst job that creates many entities [GenerateTestsForBurstCompatibility] public struct SpawnJob : IJobParallelFor { public Entity Prototype; public int EntityCount; public EntityCommandBuffer.ParallelWriter Ecb; public void Execute(int index) { // Clone the Prototype entity to create a new entity. var e = Ecb.Instantiate(index, Prototype); // Prototype has all correct components up front, can use SetComponent to // set values unique to the newly created entity, such as the transform. Ecb.SetComponent(index, e, new LocalToWorld {Value = ComputeTransform(index)}); } public float4x4 ComputeTransform(int index) { return float4x4.Translate(new float3(index, 0, 0)); } } void Start() { var world = World.DefaultGameObjectInjectionWorld; var entityManager = world.EntityManager; EntityCommandBuffer ecb = new EntityCommandBuffer(Allocator.TempJob); // Create a RenderMeshDescription using the convenience constructor // with named parameters. var desc = new RenderMeshDescription( shadowCastingMode: ShadowCastingMode.Off, receiveShadows: false); // Create an array of mesh and material required for runtime rendering. var renderMeshArray = new RenderMeshArray(new Material[] { Material }, new Mesh[] { Mesh }); // Create empty base entity var prototype = entityManager.CreateEntity(); // Call AddComponents to populate base entity with the components required // by Entities Graphics RenderMeshUtility.AddComponents( prototype, entityManager, desc, renderMeshArray, MaterialMeshInfo.FromRenderMeshArrayIndices(0, 0)); entityManager.AddComponentData(prototype, new LocalToWorld()); // Spawn most of the entities in a Burst job by cloning a pre-created prototype entity, // which can be either a Prefab or an entity created at run time like in this sample. // This is the fastest and most efficient way to create entities at run time. var spawnJob = new SpawnJob { Prototype = prototype, Ecb = ecb.AsParallelWriter(), EntityCount = EntityCount, }; var spawnHandle = spawnJob.Schedule(EntityCount, 128); spawnHandle.Complete(); ecb.Playback(entityManager); ecb.Dispose(); entityManager.DestroyEntity(prototype); } } ``` -------------------------------- ### MaterialPropertyAttribute Name Property Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialPropertyAttribute.html Gets the name of the material property associated with this attribute. This property is read-only. ```csharp public string Name { get; } ``` -------------------------------- ### Initialize HeapAllocator Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Creates a new HeapAllocator instance with a specified initial size and minimum alignment. The allocator can be resized later. ```csharp public HeapAllocator(ulong size = 0, uint minimumAlignment = 1) ``` -------------------------------- ### Get Mesh from MaterialMeshInfo Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Retrieves the Mesh associated with a given MaterialMeshInfo. Returns null if the mesh is runtime. ```csharp public Mesh GetMesh(MaterialMeshInfo materialMeshInfo) ``` -------------------------------- ### RenderMeshDescription Constructor (Parameters) Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshDescription.html Constructs a RenderMeshDescription using specified values for rendering properties. ```APIDOC ## RenderMeshDescription(ShadowCastingMode, bool, MotionVectorGenerationMode, int, uint, LightProbeUsage, bool) ### Description Construct a RenderMeshDescription using the given values. ### Parameters - **shadowCastingMode** (ShadowCastingMode) - Mode for shadow casting - **receiveShadows** (bool) - Mode for shadow receival (defaults to false) - **motionVectorGenerationMode** (MotionVectorGenerationMode) - Mode for motion vectors generation (defaults to MotionVectorGenerationMode.Camera) - **layer** (int) - Rendering layer (defaults to 0) - **renderingLayerMask** (uint) - Rendering layer mask (defaults to 4294967295) - **lightProbeUsage** (LightProbeUsage) - Light probe usage mode (defaults to LightProbeUsage.Off) - **staticShadowCaster** (bool) - Static shadow caster flag (defaults to false) ``` -------------------------------- ### RenderMeshDescription Constructor (Renderer) Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshDescription.html Constructs a RenderMeshDescription using default settings from a given Renderer object. ```APIDOC ## RenderMeshDescription(Renderer) ### Description Construct a RenderMeshDescription using defaults from the given Renderer object. ### Parameters - **renderer** (Renderer) - The renderer object (e.g. a MeshRenderer) to get default settings from. ``` -------------------------------- ### Get Total Size of HeapAllocator Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Returns the total size of the memory heap managed by the HeapAllocator. This is the maximum capacity. ```csharp public ulong Size { get; } ``` -------------------------------- ### ConstructLightMaps Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.LightMaps.html A static method to create a new LightMaps instance by combining lists of Texture2D objects for colors, directions, and shadow masks. ```csharp public static LightMaps ConstructLightMaps(List inColors, List inDirections, List inShadowMasks) ``` -------------------------------- ### MaterialMeshInfo Constructors Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialMeshInfo.html Provides constructors for creating MaterialMeshInfo instances, allowing initialization with batch IDs or indices from a RenderMeshArray. ```APIDOC ## MaterialMeshInfo(BatchMaterialID, BatchMeshID, ushort) ### Description Creates an instance of MaterialMeshInfo from material and mesh/sub-mesh IDs registered with EntitiesGraphicsSystem. ### Parameters - **materialID** (BatchMaterialID) - The material ID from RegisterMaterial(Material). - **meshID** (BatchMeshID) - The mesh ID from RegisterMesh(Mesh). - **submeshIndex** (ushort) - An optional submesh ID. Defaults to 0. ``` ```APIDOC ## MaterialMeshInfo.FromMaterialMeshIndexRange(int, int) ### Description Creates an instance of MaterialMeshInfo from a range of material/mesh/submesh index in the corresponding RenderMeshArray. ### Parameters - **rangeStart** (int) - The first index of the range in MaterialMeshIndices. - **rangeLength** (int) - The length of the range in MaterialMeshIndices. ``` ```APIDOC ## MaterialMeshInfo.FromRenderMeshArrayIndices(int, int, ushort) ### Description Creates an instance of MaterialMeshInfo from material and mesh/sub-mesh indices in the corresponding RenderMeshArray. ### Parameters - **materialIndexInRenderMeshArray** (int) - The material index in Materials. - **meshIndexInRenderMeshArray** (int) - The mesh index in Meshes. - **submeshIndex** (ushort) - An optional submesh ID. Defaults to 0. ### Returns MaterialMeshInfo - Returns the MaterialMeshInfo instance that contains the material and mesh indices. ``` -------------------------------- ### MaterialPropertyAttribute OverrideSizeGPU Property Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialPropertyAttribute.html Gets the size of the material property in bytes on the GPU. This is an optional value set during attribute construction. ```csharp public short OverrideSizeGPU { get; } ``` -------------------------------- ### Equals Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.LightMaps.html Compares this LightMaps instance with another for equality. ```csharp public bool Equals(LightMaps other) ``` -------------------------------- ### Construct RenderMeshDescription with custom values Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshDescription.html Constructs a RenderMeshDescription using specified values for shadow casting, shadow reception, motion vectors, layer, rendering layer mask, light probe usage, and static shadow casting. Default values are provided for most parameters. ```csharp public RenderMeshDescription(ShadowCastingMode shadowCastingMode, bool receiveShadows = false, MotionVectorGenerationMode motionVectorGenerationMode = MotionVectorGenerationMode.Camera, int layer = 0, uint renderingLayerMask = 4294967295, LightProbeUsage lightProbeUsage = LightProbeUsage.Off, bool staticShadowCaster = false) ``` -------------------------------- ### HeapBlock.end Property Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapBlock.html Gets the ending memory address of the allocated block. This marks the boundary of the usable memory within the HeapBlock. ```csharp public ulong end { get; } ``` -------------------------------- ### ConstructLightMaps Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.LightMaps.html Constructs a LightMaps instance from lists of color, direction, and shadow mask textures. ```APIDOC ## ConstructLightMaps ### Description Constructs a LightMaps instance from a list of textures for colors, direction lights, and shadow masks. ### Method `public static LightMaps ConstructLightMaps(List inColors, List inDirections, List inShadowMasks)` ### Parameters #### Path Parameters - **inColors** (List) - Required - The list of Texture2D for colors. - **inDirections** (List) - Required - The list of Texture2D for direction lights. - **inShadowMasks** (List) - Required - The list of Texture2D for shadow masks. ### Returns #### Success Response - **LightMaps** - Returns a new LightMaps object. ``` -------------------------------- ### Get Used Space in HeapAllocator Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Retrieves the amount of memory currently occupied by allocated blocks within the HeapAllocator. This represents the used portion of the heap. ```csharp public ulong UsedSpace { get; } ``` -------------------------------- ### RenderFilterSettings Equals(RenderFilterSettings) Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Entities.Graphics.RenderFilterSettings.html Compares the current RenderFilterSettings instance with another RenderFilterSettings instance for equality. ```csharp public bool Equals(RenderFilterSettings other); ``` -------------------------------- ### MaterialMeshInfo Constructor Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialMeshInfo.html Creates an instance of MaterialMeshInfo using material and mesh IDs registered with EntitiesGraphicsSystem. An optional submesh index can be provided. ```csharp public MaterialMeshInfo(BatchMaterialID materialID, BatchMeshID meshID, ushort submeshIndex = 0) ``` -------------------------------- ### Get Free Space in HeapAllocator Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Retrieves the total amount of available free space within the HeapAllocator. This indicates how much memory can still be allocated. ```csharp public ulong FreeSpace { get; } ``` -------------------------------- ### Methods Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Provides methods for combining and creating RenderMeshArray instances. ```APIDOC ## CombineRenderMeshArrays(List) ### Description Combines a list of RenderMeshArrays into one RenderMeshArray. ### Parameters - **renderMeshArrays** (List) - The list of RenderMeshArray instances to combine. ### Returns - **RenderMeshArray** - Returns a RenderMeshArray instance that contains all of the meshes and materials. The MaterialMeshIndices field is left to null. ``` ```APIDOC ## CombineRenderMeshes(List) ### Description Combines a list of RenderMeshes into one RenderMeshArray. ### Parameters - **renderMeshes** (List) - The list of RenderMesh instances to combine. ### Returns - **RenderMeshArray** - Returns a RenderMeshArray instance that contains all of the meshes and materials. The MaterialMeshIndices field is left to null. ``` ```APIDOC ## ComputeHash128() ### Description Calculates and returns the 128-bit hash value of the component contents. ### Returns - **uint4** - Returns the calculated 128-bit hash value. ### Remarks This is equivalent to calling ResetHash128() and then GetHash128(). ``` ```APIDOC ## CreateWithDeduplication(List>, List>) ### Description Creates the new instance of the RenderMeshArray from given mesh and material lists, removing duplicate entries. ### Parameters - **materialsWithDuplicates** (List>) - The list of the materials. - **meshesWithDuplicates** (List>) - The list of the meshes. ### Returns - **RenderMeshArray** - Returns a RenderMeshArray instance that contains all off the meshes and materials, and with no duplicates. The MaterialMeshIndices field is left to null. ``` -------------------------------- ### Construct RenderMeshDescription from Renderer Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshDescription.html Constructs a RenderMeshDescription using default settings obtained from a given Renderer object. This is useful for initializing rendering configurations based on existing Unity renderers. ```csharp public RenderMeshDescription(Renderer renderer) ``` -------------------------------- ### Constructors Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Provides constructors for creating RenderMeshArray instances with different input types. ```APIDOC ## RenderMeshArray(ReadOnlySpan>, ReadOnlySpan>, ReadOnlySpan) ### Description Constructs an instance of RenderMeshArray from an array of materials and an array of meshes. ### Parameters - **materials** (ReadOnlySpan>) - The array of materials to use in the RenderMeshArray. - **meshes** (ReadOnlySpan>) - The array of meshes to use in the RenderMeshArray. - **materialMeshIndices** (ReadOnlySpan) - The array of MaterialMeshIndex to use in the RenderMeshArray. ``` ```APIDOC ## RenderMeshArray(Material[], Mesh[], MaterialMeshIndex[]) ### Description Constructs an instance of RenderMeshArray from an array of materials and an array of meshes. ### Parameters - **materials** (Material[]) - The array of materials to use in the RenderMeshArray. - **meshes** (Mesh[]) - The array of meshes to use in the RenderMeshArray. - **materialMeshIndices** (MaterialMeshIndex[]) - The array of MaterialMeshIndex to use in the RenderMeshArray. ``` -------------------------------- ### HeapAllocator Constructors Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Initializes a new HeapAllocator with specified size and alignment. ```APIDOC ## HeapAllocator(ulong size, uint minimumAlignment) ### Description Creates a new HeapAllocator with the given initial size and alignment. ### Parameters - **size** (ulong) - The initial size of the allocator. - **minimumAlignment** (uint) - The initial alignment of the allocator. ### Remarks You can resize the allocator later. ``` -------------------------------- ### Populate Frustum Planes from Camera Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.FrustumPlanes.html Use this static method to calculate and populate a NativeArray with the 6 frustum planes based on a given Camera. Ensure the NativeArray is initialized with a size of 6. ```csharp public static void FromCamera(Camera camera, NativeArray planes) ``` -------------------------------- ### Check if HeapAllocator is Created Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Verifies if the HeapAllocator has been initialized and is ready for use. Returns true if created, false otherwise. ```csharp public bool IsCreated { get; } ``` -------------------------------- ### MaterialMeshInfo Static Methods Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialMeshInfo.html Utility methods for converting between array indices and static indices for material and mesh references. ```APIDOC ## MaterialMeshInfo.ArrayIndexToStaticIndex(int) ### Description Converts the given array index (typically the index inside RenderMeshArray) into a negative number that denotes that array position. ### Parameters - **index** (int) - The index to convert. ### Returns int - Returns the converted index. ``` ```APIDOC ## MaterialMeshInfo.StaticIndexToArrayIndex(int) ### Description Converts the given static index (a negative value) to a valid array index. ### Parameters - **staticIndex** (int) - The index to convert. ### Returns int - Returns the converted index. ``` -------------------------------- ### FromMaterialMeshIndexRange Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialMeshInfo.html Creates a MaterialMeshInfo instance from a specified range of material, mesh, and submesh indices within the RenderMeshArray. ```csharp public static MaterialMeshInfo FromMaterialMeshIndexRange(int rangeStart, int rangeLength) ``` -------------------------------- ### Construct SparseUploader Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Constructs a new sparse uploader targeting a specific GraphicsBuffer. Optionally set the upload buffer chunk size. ```csharp public SparseUploader(GraphicsBuffer destinationBuffer, int bufferChunkSize = 16777216) ``` -------------------------------- ### SparseUploader Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Provides utility methods that you can use to upload data into GPU memory. ```APIDOC ## Struct SparseUploader ### Description Provides utility methods that you can use to upload data into GPU memory. ### Type Struct ``` -------------------------------- ### SparseUploader Constructor Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Constructs a new sparse uploader with the specified buffer as the target. ```APIDOC ## SparseUploader(GraphicsBuffer, int) ### Description Constructs a new sparse uploader with the specified buffer as the target. ### Parameters - **destinationBuffer** (GraphicsBuffer) - The target buffer to write uploads into. - **bufferChunkSize** (int) - The upload buffer chunk size. Defaults to 16777216. ``` -------------------------------- ### MaterialPropertyAttribute Constructor Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialPropertyAttribute.html Constructs a MaterialPropertyAttribute with the specified material property name and an optional GPU override size. ```APIDOC ## MaterialPropertyAttribute(string materialPropertyName, short overrideSizeGPU = -1) ### Description Constructs a material property attribute. ### Parameters - **materialPropertyName** (string) - Required - The name of the material property. - **overrideSizeGPU** (short) - Optional - An optional size of the property on the GPU. This is in bytes. ``` -------------------------------- ### MaterialMeshInfo Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Represents which materials and meshes to use to render an entity. ```APIDOC ## Struct MaterialMeshInfo ### Description Represents which materials and meshes to use to render an entity. ### Type Struct ``` -------------------------------- ### MaterialPropertyAttribute Constructor Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialPropertyAttribute.html Constructs a MaterialPropertyAttribute with the specified material property name and an optional override size for the GPU. Use this to link component data to shader properties. ```csharp public MaterialPropertyAttribute(string materialPropertyName, short overrideSizeGPU = -1) { } ``` -------------------------------- ### FromRenderMeshArrayIndices Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.MaterialMeshInfo.html Creates a MaterialMeshInfo instance using material and mesh indices from the RenderMeshArray. An optional submesh index can be specified. ```csharp public static MaterialMeshInfo FromRenderMeshArrayIndices(int materialIndexInRenderMeshArray, int meshIndexInRenderMeshArray, ushort submeshIndex = 0) ``` -------------------------------- ### AddComponents(Entity, EntityManager, RenderMeshDescription, MaterialMeshInfo) Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshUtility.html Sets the Entities Graphics component values to render the given entity using the provided description. Adds any missing components, which results in structural changes. ```APIDOC ## AddComponents(Entity, EntityManager, RenderMeshDescription, MaterialMeshInfo) ### Description Sets the Entities Graphics component values to render the given entity using the given description. Any missing components will be added, which results in structural changes. ### Parameters #### Path Parameters - **entity** (Entity) - Description: The entity to set the component values for. - **entityManager** (EntityManager) - Description: The Unity.Entities.EntityManager used to set the component values. - **renderMeshDescription** (in RenderMeshDescription) - Description: The description that determines how the entity is to be rendered. - **materialMeshInfo** (MaterialMeshInfo) - Description: The MaterialMeshInfo containing the mesh and material ids ``` -------------------------------- ### AddComponents(Entity, EntityManager, RenderMeshDescription, RenderMeshArray, MaterialMeshInfo) Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshUtility.html Sets the Entities Graphics component values to render the given entity using the provided description. Adds any missing components, which results in structural changes. ```APIDOC ## AddComponents(Entity, EntityManager, RenderMeshDescription, RenderMeshArray, MaterialMeshInfo) ### Description Sets the Entities Graphics component values to render the given entity using the given description. Any missing components will be added, which results in structural changes. ### Parameters #### Path Parameters - **entity** (Entity) - Description: The entity to set the component values for. - **entityManager** (EntityManager) - Description: The Unity.Entities.EntityManager used to set the component values. - **renderMeshDescription** (in RenderMeshDescription) - Description: The description that determines how the entity is to be rendered. - **renderMeshArray** (RenderMeshArray) - Description: The instance of the RenderMeshArray which contains mesh and material. - **materialMeshInfo** (MaterialMeshInfo) - Default: default - Description: The MaterialMeshInfo used to index into renderMeshArray. ``` -------------------------------- ### ThreadedSparseUploader Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html An unmanaged and Burst-compatible interface for SparseUploader. ```APIDOC ## Struct ThreadedSparseUploader ### Description An unmanaged and Burst-compatible interface for SparseUploader. ### Type Struct ``` -------------------------------- ### ThreadedSparseUploader Syntax Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.ThreadedSparseUploader.html Defines the structure for ThreadedSparseUploader, an unmanaged and Burst-compatible interface for SparseUploader. ```csharp public struct ThreadedSparseUploader ``` -------------------------------- ### AddComponents with RenderMeshDescription and MaterialMeshInfo Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshUtility.html Use this method to set the Entities Graphics component values for an entity. It adds any missing components, which may result in structural changes. ```csharp public static void AddComponents(Entity entity, EntityManager entityManager, in RenderMeshDescription renderMeshDescription, MaterialMeshInfo materialMeshInfo) ``` -------------------------------- ### HeapBlock Methods Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapBlock.html Provides methods for comparing HeapBlocks and checking for equality. ```APIDOC ### Methods #### CompareTo(HeapBlock) ##### Declaration ``` public int CompareTo(HeapBlock other) ``` ##### Parameters Type | Name | Description ---|---|--- HeapBlock | other | ##### Returns Type | Description ---|--- int | #### Equals(HeapBlock) ##### Declaration ``` public bool Equals(HeapBlock other) ``` ##### Parameters Type | Name | Description ---|---|--- HeapBlock | other | ##### Returns Type | Description ---|--- bool | ``` -------------------------------- ### Combine RenderMeshArrays Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Combines a list of RenderMeshArray instances into a single RenderMeshArray. The resulting instance contains all meshes and materials from the input list. The MaterialMeshIndices field will be null. ```csharp public static RenderMeshArray CombineRenderMeshArrays(List renderMeshArrays) ``` -------------------------------- ### RenderFilterSettings Methods Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Entities.Graphics.RenderFilterSettings.html Methods for comparing RenderFilterSettings instances and calculating hash codes. ```APIDOC ## Struct RenderFilterSettings ### Methods #### Equals(object) Indicates whether the current instance is equal to the specified object. ```csharp public override bool Equals(object obj) ``` #### Equals(RenderFilterSettings) Indicates whether the current instance is equal to the specified RenderFilterSettings. ```csharp public bool Equals(RenderFilterSettings other) ``` #### GetHashCode() Calculates the hash code for this object. ```csharp public override int GetHashCode() ``` ``` -------------------------------- ### RenderMeshUtility Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Helper class that contains static methods for populating entities so that they are compatible with the Entities Graphics package. ```APIDOC ## Class RenderMeshUtility ### Description Helper class that contains static methods for populating entities so that they are compatible with the Entities Graphics package. ### Type Class ``` -------------------------------- ### RenderFilterSettings GetHashCode() Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Entities.Graphics.RenderFilterSettings.html Calculates and returns the hash code for the current RenderFilterSettings instance. ```csharp public override int GetHashCode(); ``` -------------------------------- ### SparseUploader.ReplaceBuffer Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Replaces the destination GPU buffer with a new one. ```APIDOC ## ReplaceBuffer(GraphicsBuffer, bool) ### Description Replaces the destination GPU buffer with a new one. ### Parameters - **buffer** (GraphicsBuffer) - The new buffer to replace the old one with. - **copyFromPrevious** (bool) - Indicates whether to copy the contents of the old buffer to the new buffer. Defaults to false. ``` -------------------------------- ### HybridLightBakingDataSystem Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Represents a light baking system that assigns a LightBakingOutput to the bakingOutput of the Light component. ```APIDOC ## Class HybridLightBakingDataSystem ### Description Represents a light baking system that assigns a LightBakingOutput to the bakingOutput of the Light component. ### Type Class ``` -------------------------------- ### MaterialColorBaker.Bake Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.Authoring.MaterialColorBaker.html This method is called during the baking process to bake the authoring component. ```APIDOC ## Bake(MaterialColor) ### Description Called during the baking process to bake the authoring component. ### Method `public override void Bake(MaterialColor authoring)` ### Parameters #### Parameters - **authoring** (MaterialColor) - The authoring component to bake. ``` -------------------------------- ### Construct RenderMeshArray with Arrays Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Constructs an instance of RenderMeshArray using standard arrays for materials, meshes, and optional material mesh indices. This constructor is a convenient alternative when working with existing arrays. ```csharp public RenderMeshArray(Material[] materials, Mesh[] meshes, MaterialMeshIndex[] materialMeshIndices = null) ``` -------------------------------- ### AddComponents with RenderMeshDescription, RenderMeshArray, and MaterialMeshInfo Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshUtility.html This overload allows setting Entities Graphics component values using a RenderMeshArray for mesh and material information. It also adds any missing components, potentially causing structural changes. ```csharp public static void AddComponents(Entity entity, EntityManager entityManager, in RenderMeshDescription renderMeshDescription, RenderMeshArray renderMeshArray, MaterialMeshInfo materialMeshInfo = default) ``` -------------------------------- ### HeapAllocator Properties Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Provides information about the state and capacity of the HeapAllocator. ```APIDOC ## Empty ### Description Indicates whether the allocator is empty. This is true if the allocator is empty and false otherwise. ### Property Value - **bool** ``` ```APIDOC ## FreeSpace ### Description The amount of available free space in the allocator. ### Property Value - **ulong** ``` ```APIDOC ## Full ### Description Indicates whether the allocator is full. This is true if the allocator is full and false otherwise. ### Property Value - **bool** ``` ```APIDOC ## IsCreated ### Description Indicates whether the allocator has been created and not yet allocated. ### Property Value - **bool** ``` ```APIDOC ## Size ### Description The size of the heap that the allocator manages. ### Property Value - **ulong** ``` ```APIDOC ## UsedSpace ### Description The amount of used space in the allocator. ### Property Value - **ulong** ``` -------------------------------- ### HeapAllocator Methods Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Core methods for managing memory allocations within the HeapAllocator. ```APIDOC ## Allocate(ulong size, uint alignment) ### Description Attempt to allocate a block from the heap with at least the given size and alignment. ### Parameters - **size** (ulong) - The size of the block to allocate. - **alignment** (uint) - Alignment of the allocated block. ### Returns - **HeapBlock** - Returns a new allocated HeapBlock on success. Returns an empty block on failure. ### Remarks The allocated block might be bigger than the requested size, but will never be smaller. If the allocation fails, this method returns an empty block. ``` ```APIDOC ## Clear() ### Description Clears the allocator. ``` ```APIDOC ## Dispose() ### Description Disposes the HeapAllocator. ``` ```APIDOC ## Release(HeapBlock block) ### Description Releases a given block of memory and marks it as free. ### Parameters - **block** (HeapBlock) - The HeapBlock to release to the allocator. ### Remarks You must have wholly allocated the given block before you pass it into this method. However, it's legal to release big allocations in smaller non-overlapping sub-blocks. ``` ```APIDOC ## Resize(ulong newSize) ### Description Attempts to grow or shrink the allocator. ### Parameters - **newSize** (ulong) - The new size of the allocator. ### Returns - **bool** - Growing always succeeds, but shrinking might fail if the end of the heap is allocated. ``` -------------------------------- ### SparseUploader.FrameCleanup Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Cleans up internal data and recovers buffers into the free buffer pool. ```APIDOC ## FrameCleanup() ### Description Cleans up internal data and recovers buffers into the free buffer pool. ### Remarks It's best practice to call this once at the end of every frame. ``` -------------------------------- ### GetHashCode Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.LightMaps.html Calculates and returns the hash code for the LightMaps struct. ```csharp public override int GetHashCode() ``` -------------------------------- ### LightMaps Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Represents a container for light maps. ```APIDOC ## Struct LightMaps ### Description Represents a container for light maps. ### Type Struct ``` -------------------------------- ### AddMatrixUploadAndInverse Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.ThreadedSparseUploader.html Adds a pending matrix upload operation that also computes and stores the inverse of the matrices. This is useful when both the original and inverted matrices are needed on the GPU. ```csharp public void AddMatrixUploadAndInverse(void* src, int numMatrices, int offset, int offsetInverse, ThreadedSparseUploader.MatrixType srcType, ThreadedSparseUploader.MatrixType dstType) ``` -------------------------------- ### LightBakingOutputData Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html An unmanaged component that stores light baking data. ```APIDOC ## Struct LightBakingOutputData ### Description An unmanaged component that stores light baking data. ### Type Struct ``` -------------------------------- ### RegisterMaterial Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.EntitiesGraphicsSystem.html Registers a Material instance with the Entities Graphics System and returns its unique BatchMaterialID. ```csharp public BatchMaterialID RegisterMaterial(Material material) ``` -------------------------------- ### OnInspectorGUI Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Global%20Namespace.MaterialOverrideAssetEditor.html Draws the custom inspector for the material override asset. ```APIDOC ### Methods #### OnInspectorGUI() Draws the custom inspector for the material override asset. ##### Declaration ``` public override void OnInspectorGUI() ``` ``` -------------------------------- ### Animate Material Property with Burst C# System Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/manual/material-overrides-code.html Use this system to animate custom material properties. Ensure a matching IComponentData struct is created for each custom Shader Graph property with Hybrid Per Instance enabled. ```csharp class AnimateMyOwnColorSystem : SystemBase { protected override void OnUpdate() { Entities.ForEach((ref MyOwnColor color, in MyAnimationTime t) => { color.Value = new float4( math.cos(t.Value + 1.0f), math.cos(t.Value + 2.0f), math.cos(t.Value + 3.0f), 1.0f); }) .Schedule(); } } ``` -------------------------------- ### OverrideLightProbeAnchorComponent Syntax Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.OverrideLightProbeAnchorComponent.html Defines the structure of the OverrideLightProbeAnchorComponent, indicating its implementation of IComponentData and IQueryTypeParameter. ```csharp public struct OverrideLightProbeAnchorComponent : IComponentData, IQueryTypeParameter ``` -------------------------------- ### HeapAllocator Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Represents a generic best-fit heap allocation algorithm that operates on abstract integer indices. ```APIDOC ## Struct HeapAllocator ### Description Represents a generic best-fit heap allocation algorithm that operates on abstract integer indices. ### Type Struct ``` -------------------------------- ### RenderMeshUnmanaged Methods Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshUnmanaged.html Provides methods for equality comparison and hash code generation. ```APIDOC public bool Equals(RenderMeshUnmanaged other) public override int GetHashCode() ``` -------------------------------- ### Resize HeapAllocator Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Attempts to change the total size of the HeapAllocator. Growing the allocator always succeeds, but shrinking may fail if the end of the heap is currently allocated. ```csharp public bool Resize(ulong newSize) ``` -------------------------------- ### GetMaterials Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Retrieves a list of materials associated with a given MaterialMeshInfo. ```APIDOC ## GetMaterials(MaterialMeshInfo) ### Description Gets the materials for given MaterialMeshInfo. ### Method Signature ```csharp public List GetMaterials(MaterialMeshInfo materialMeshInfo) ``` ### Parameters #### Path Parameters - **materialMeshInfo** (MaterialMeshInfo) - The MaterialMeshInfo to use. ### Returns - **List** - Returns the associated material instances, or null if the material is runtime. ``` -------------------------------- ### SparseUploader.Dispose Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.SparseUploader.html Disposes of the SparseUploader. ```APIDOC ## Dispose() ### Description Disposes of the SparseUploader. ``` -------------------------------- ### EntitiesGraphicsSystem Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html Renders all entities that contain both RenderMesh and LocalToWorld components. ```APIDOC ## Class EntitiesGraphicsSystem ### Description Renders all entities that contain both RenderMesh and LocalToWorld components. ### Type Class ``` -------------------------------- ### ThreadedSparseUploader.AddUpload (void*) Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.ThreadedSparseUploader.html Adds a new pending upload operation for raw data. ```APIDOC ## AddUpload ### Description Adds a new pending upload operation to execute when you call SparseUploader.EndAndCommit. When this operation executes, the SparseUploader copies data from the source pointer. ### Parameters - **src** (void*) - The source pointer of data to upload. - **size** (int) - The amount of data, in bytes, to read from the source pointer. - **offsetInBytes** (int) - The destination offset of the data in the GPU buffer. - **repeatCount** (int) - Optional. The number of times to repeat the source data in the destination buffer when uploading. Defaults to 1. ``` -------------------------------- ### CreateWithDeduplication Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.RenderMeshArray.html Creates a new RenderMeshArray instance from lists of materials and meshes, automatically removing duplicate entries. ```APIDOC ## CreateWithDeduplication(List, List) ### Description Creates the new instance of the RenderMeshArray from given mesh and material lists, removing duplicate entries. ### Method Signature ```csharp public static RenderMeshArray CreateWithDeduplication(List materialsWithDuplicates, List meshesWithDuplicates) ``` ### Parameters #### Path Parameters - **materialsWithDuplicates** (List) - The list of the materials. - **meshesWithDuplicates** (List) - The list of the meshes. ### Returns - **RenderMeshArray** - Returns a RenderMeshArray instance that contains all of the meshes and materials, and with no duplicates. The MaterialMeshIndices field is left to null. ``` -------------------------------- ### Allocate Memory Block Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapAllocator.html Attempts to allocate a block of memory from the heap with a specified size and alignment. Returns an allocated HeapBlock on success or an empty block on failure. The allocated block may be larger than requested. ```csharp public HeapBlock Allocate(ulong size, uint alignment = 1) ``` -------------------------------- ### HeapBlock.CompareTo Method Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.HeapBlock.html Compares the current HeapBlock with another HeapBlock for ordering. Used for sorting or determining relative positions of memory blocks. ```csharp public int CompareTo(HeapBlock other) ``` -------------------------------- ### FrustumPlanes.FromCamera Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.FrustumPlanes.html Populates the frustum plane array from the given camera frustum. ```APIDOC ## FrustumPlanes.FromCamera(Camera, NativeArray) ### Description Populates the frustum plane array from the given camera frustum. ### Method static void ### Parameters #### Parameters - **camera** (Camera) - The camera to use for calculation. - **planes** (NativeArray) - The result of the operation. ### Exceptions - **ArgumentNullException**: Is thrown if the planes are empty. - **ArgumentException**: Is thrown if the planes size is not equal to 6. ``` -------------------------------- ### RenderBounds Source: https://docs.unity3d.com/Packages/com.unity.entities.graphics%401.4/api/Unity.Rendering.html An unmanaged component that represent the render bounds. ```APIDOC ## Struct RenderBounds ### Description An unmanaged component that represent the render bounds. ### Type Struct ```