Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Remove monobehaviour component from entity / chuck

Discussion in 'Data Oriented Technology Stack' started by Filtiarn_, Sep 12, 2019.

  1. Filtiarn_

    Filtiarn_

    Joined:
    Jan 24, 2013
    Posts:
    154
    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:
    2,387
    The component hasn't been added yet.
     
    Last edited: Sep 12, 2019
  3. Filtiarn_

    Filtiarn_

    Joined:
    Jan 24, 2013
    Posts:
    154
    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?
     
unityunity