Protfolio-Emanuel-Polsky / Assets / _Project / Code / VerletIntegration / RenderFlag / Bake / MaterialFlagMono.cs
MaterialFlagMono.cs
Raw
using GarmentButton.Culling;
using Unity.Entities;
using UnityEngine;

namespace GarmentButton.VerletIntegration.Render
{
    [RequireComponent(typeof(BakePoints))]
    public class MaterialFlagMono : MonoBehaviour
    {
        public Material material;
    }
    public class MaterialFlagMonoBaker : Baker<MaterialFlagMono>
    {
        public override void Bake(MaterialFlagMono authoring)
        {
            //Create entity
            var entity = GetEntity(TransformUsageFlags.None);
            AddComponent(entity, new MaterialFlag
            {
                Value = authoring.material,
            });
            AddComponent<VisibleTag>(entity);
            SetComponentEnabled<VisibleTag>(entity,true);

        }
    }
    public struct MaterialFlag : IComponentData
    {
        public UnityObjectRef<Material> Value;
    }

    [UpdateInGroup(typeof(InitializationSystemGroup))]
    public partial class VerletIntegrationRenderGroupSystems : ComponentSystemGroup { }

}