Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Cannot GetEntityQuery on RenderBounds in OnStartRunning

Discussion in 'Graphics for ECS' started by Estellise-Yukihime, Nov 19, 2019.

  1. Estellise-Yukihime

    Estellise-Yukihime

    Joined:
    Aug 9, 2018
    Posts:
    9
    Hi, I am new to ECS and this is my first time posting a thread in unity, I'm in your care.

    I have an entity that has a RenderBounds that I want to access in OnStartRunning, but when I use

    Code (CSharp):
    1. query = GetEntityQuery(typeof(RenderBounds));
    It returns 0, but I have 1 entity shows in my EntityDebugger. I have also tried using EntityManager to get all the entities and access the component data of that entity but it returns an error

    Code (CSharp):
    1. var entities = EntityManager.GetAllEntities();
    2. var component = EntityManager.GetComponentData<RenderBounds>(entities[0]);
    upload_2019-11-20_7-35-36.png

    I am currently using a GameObject with a script attached ConvertToEntity.

    Is there something wrong with how I'm implementing it or this is just how it is with RenderBounds?
     

    Attached Files:

  2. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,718
    Try OnCreate() instead of OnStartRunning
     
  3. Estellise-Yukihime

    Estellise-Yukihime

    Joined:
    Aug 9, 2018
    Posts:
    9
    It's the same as OnCreate, and OnCreate is called before OnStartRunning.