Welcome back, Unity developers! Today, I will be setting up a non-ECS Unity
  project to run using the Entity Component System (ECS), Moreover you will setup your first subscene and create your first entity. I will address entity not visible issue. If you haven't yet
  checked the
  commonly asked questions about the Entity Component System, you should take a look first, where I've explained the basic definition of
  ECS in Unity.
  | 
| Setting Up Unity DOTS Creating and Configuring Your First Entity by LearnUnityECS101.Blogspot.com | 
Table of Contents :
Project Clone Instruction:
  First of all, you need a Unity project in working condition. If you already
  have such a project, you can use it, but I would recommend using the project I
  am about to convert to Unity DOTS - ECS.
  Please clone the
  Tower-Defense project by EvanderChristianDumalang
  from GitHub into your project directory. I will be using this 2D Tower Defense
  Unity game to convert it to the Entity Component System, also known as Unity
  DOTS.
  Disclaimer: This Tower-Defense project is under the
    MIT license, so please ensure you read it first. Don't forget to give it a star or
    follow EvanderChristianDumalang, as this Tower Defense game is truly
    excellent.
ECS Package Install and Setup Guide :
  
    I hope you've already cloned the Tower Defense game. Please read carefully,
    as I will be using Unity 6 (6000.0.10f1). Therefore, ensure you upgrade the
    project's version to Unity Editor version 6000.0.10f1.
  
  
  
    Next, once the upgrade is complete, open the Package Manager and install the
    '
Entities' package. I'm using version 1.2.4, which I recommend, as it has been
    released with production-ready, stable features.
  
 
 
  
    I hope you have installed the relevant packages. Now, locate or open Level1
    from the Scenes folder and click the play button to run the game. If you
    encounter any errors, please comment them out, and we'll discuss them. If
    Level1 runs without any errors, it means you have successfully converted
    your game to use Unity ECS.
  
  
  
    However, I'm just joking—it's not as simple as installing a package and
    having your game converted to the DOTS system.
  
 
Setup ECS Scene :
  
    Let's create a new scene, name it 'SampleScene,' and save it. Once saved,
    open it. Next, right-click on the Hierarchy tab, select 'Create,' and then
    create a new subscene, naming it 'MainGame.'
  
  
  
    NOTE: The name of the scene is not critical; you can use any name you
    prefer.
  
 
Create Your First Entity :
  
    Now, let's create your first entity. Right-click on the subscene (in my
    case, it's named 'MainGame'), then choose GameObject -> 2D Objects ->
    Sprites -> Triangle. And there you have it—your first entity is
    successfully created.
  
  
  
  
  Entity is not visible error :
  
    Wait, what's this? Your entity isn't displaying? It looks like you've
    encountered a common issue when converting your project to the Entity
    Component System. The issue is that the created entity is not visible in
    either the scene or the game window.
  
  
  
    To resolve this, you need to install the 'com.unity.entities.graphics'
    package, also known as 'Entities Graphics,' from the Package Manager. I am
    using version 1.2.4.
  
  
  
    After installing the 'Entities Graphics' package, you should be able to see
    your Triangle, the first entity object, displayed both in the game scene and
    in the Scene view.
  
 
Verify Your First Entity :
  How can you check if the triangle you've created is an entity? Good question.
  To verify, select your triangle, then go to the Inspector tab. You should see
  a circle icon (or a webcam icon) to the left of the lock icon. Click on it and
  select 'Runtime.' 
  Ensure that you have installed the 'Entities Graphics' package; otherwise,
    you won't see any changes in the Inspector window.
Domain Reload Setting :
  
    To achieve the best performance for entities in the editor, you should
    disable the domain reload setting by navigating to Edit > Project
    Settings > Editor, and enable the 'Enter Play Mode Options' setting.
    However, make sure that both 'Reload Domain' and 'Reload Scene' boxes remain
    unchecked.
  
  
  
    To understand more about this feature, please refer to
      the official Unity guidelines. Disabling domain reload can affect the behaviour of your static fields in
    ways you might not expect.
  
 
 
  
    
  
  Summarizing :
  
    That's it for today. I hope you've enjoyed making progress. If you have any
    questions, feel free to ask in the comments. Let's summarise what we've
    covered in this post:
  
    Thank you once again. In the next post, I will introduce the new ECS windows
    and discuss each of the new Entity Component System windows in detail.
  
  
 
 
Comments
Post a Comment