Search Unity

ECS in Editor

Discussion in 'Entity Component System' started by Sweco-Martijn, Dec 10, 2018.

  1. Sweco-Martijn

    Sweco-Martijn

    Joined:
    Jan 10, 2018
    Posts:
    8
    Hi,

    I would like to know if (and how) it is possible to draw entities in the Sceneview.
    I'v create a new world and added my entities. they show up in the entity debugger but i cannot get them to render in the Scene view / editor.

    Is this possible ?
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    You need [ExecuteInEditMode] on your system, it works with OnUpdate() ([ExecuteAlways] does not work)
     
  3. Sweco-Martijn

    Sweco-Martijn

    Joined:
    Jan 10, 2018
    Posts:
    8
    This is not working for me:

    Code (CSharp):
    1. [UnityEngine.ExecuteInEditMode]
    2. public class TestSystem : ComponentSystem
    3. {
    4.     protected override void OnUpdate()
    5.     {
    6.        Debug.Log("Working");
    7.     }
    8. }
     
  4. Sweco-Martijn

    Sweco-Martijn

    Joined:
    Jan 10, 2018
    Posts:
    8
  5. timmehhhhhhh

    timmehhhhhhh

    Joined:
    Sep 10, 2013
    Posts:
    157
    Do you mean during editing or play mode? Also, what components are attached to your entities? Anything that's being drawn with ECS needs at minimum a MeshInstanceRenderer component, Position component, and Rotation component.
     
  6. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    340
    Yeah, I got confused for a second.