Search Unity

Remove monobehaviour component from entity / chuck

Discussion in 'Entity Component System' started by Filtiarn_, Sep 12, 2019.

  1. Filtiarn_

    Filtiarn_

    Joined:
    Jan 24, 2013
    Posts:
    173
    I'm not sure why this monobehavior component is not being removed from chuck. Here is my code. I'm using Hybrid ECS with Convert To Entity workflow.

    Code (CSharp):
    1. using Unity.Entities;
    2. using UnityEngine;
    3.  
    4. [RequiresEntityConversion]
    5. public class MovementInputAuthor : MonoBehaviour, IConvertGameObjectToEntity
    6. {
    7.     public float smoothInputRate;
    8.  
    9.     public void Convert(Entity entity, EntityManager entityManager, GameObjectConversionSystem conversionSystem)
    10.     {  
    11.         entityManager.AddComponentData(entity, new MovementInputComponent(){smoothInputRate = smoothInputRate});
    12.         entityManager.RemoveChunkComponent<MovementInputAuthor>(entity);
    13.         entityManager.RemoveComponent<MovementInputAuthor>(entity);
    14.         Destroy(this);
    15.     }
    Screen Shot 2019-09-11 at 11.02.04 PM.png
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    The component hasn't been added yet.
     
    Last edited: Sep 12, 2019
  3. Filtiarn_

    Filtiarn_

    Joined:
    Jan 24, 2013
    Posts:
    173
    So under the first chunck utilization I can't remove the Author data? I'm a bit confused. I know it's not on the entity but ECS is still looking for those components?