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

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,554
    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:
    155
    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:
    335
    Yeah, I got confused for a second.