• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Mar 11, 2020 at 03:06 AM by martygrof3708 for the following reason:

The question is answered, right answer was accepted

avatar image
2
Question by martygrof3708 · Mar 10, 2020 at 11:52 AM · renderingdots

ECS entity not rendering?

I have LocalToWorld and RenderMesh on the entity. Entity shows up in debugger. Hybrid Renderer installed.

My meshes just aren't appearing.

         EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
         Material material = GameHandler.instance.unitMaterial;
         Mesh mesh = GameHandler.instance.unitMesh;
 
         for ( int i = 0; i < NUMBER_OF_UNITS; i++ )
         {
             float3 unitPosition = new float3( 0 , 4 , 0 );
 
             Entity unit = entityManager.CreateEntity(
                 typeof( RenderMesh ) ,
                 typeof( LocalToWorld ) ,
                 typeof( Translation ) );
             entityManager.SetSharedComponentData<RenderMesh>(
                 unit ,
                 new RenderMesh { mesh = mesh , material = material } );
             entityManager.SetComponentData<Translation>(
                 unit , new Translation { Value = unitPosition } );
         }


Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GamerLordMat · Mar 11, 2020 at 02:13 AM 0
Share

So I tested your Script on unity 2019.3.4f1 and it didn't worked to my big suprise, the script is totally correct, I even watched Code$$anonymous$$onkeys video where he shows the same code. I tested it then on Unity 2019.2 and it worked. So unity messed something up apperently or changed someting. I didnt noticed it bec I work with prefabs on which I then use the ConvertToEntity script. Some older scripts of $$anonymous$$e also dont work and I dont know why :/

1 Reply

  • Sort: 
avatar image
3
Best Answer

Answer by GamerLordMat · Mar 10, 2020 at 05:47 PM

I think we need some code example to answer you question. Have you added Translation Component? So I tested your Script on unity 2019.3.4f1 and it didn't worked to my big suprise, the script is totally correct, I even watched CodeMonkeys video where he shows the same code. I tested it then on Unity 2019.2 and it worked. So unity messed something up apperently or changed someting. I didnt noticed it bec I work with prefabs on which I then use the ConvertToEntity script. Some older scripts of mine also dont work and I dont know why :/

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image martygrof3708 · Mar 11, 2020 at 12:39 AM 0
Share

I added my code.

avatar image martygrof3708 · Mar 11, 2020 at 03:04 AM 0
Share

Thanks for clarifying good to know its a bug not an issue with my code!

avatar image martygrof3708 · Mar 23, 2020 at 04:00 AM 2
Share

Hi, it turns out you need to add RenderBounds as well, lol.

avatar image NT_Ninetails · May 07, 2020 at 08:13 PM 0
Share

This has worked for. However if you are still having trouble try adding Scale, and Rotation, and make sure you set the value of Scale to 1f

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

147 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Entities not rendering in Hybrid V2 0 Answers

ECS mesh dissapears on camera move in Game or Scene 0 Answers

How do I enable DOTS Instancing on a material/shadergraph 1 Answer

HDRP clamps output values at 65504 0 Answers

Post Processing Layer Turns Scene and Game Black 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges