Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. 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,695
    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.