Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 Oct 08, 2019 at 02:03 AM by emerz210 for the following reason:

THe question was based on faulty information

avatar image
1
Question by emerz210 · Oct 07, 2019 at 07:05 PM · optimizationdotsthreading

ECS: How to access to separate "groups" of same-archetype entities?

This is a program where you launch groups of objects into the play space, and apply forces to groups of entities. I need to apply different forces to different groups of entities. How can I get access to separate "groups" of same-archetype entities?


Current approach: "GroupIdComponent in an IJobForEach": I add a groupIdComponent to each entity on creation with an int field that represents their group, then in the execution of an IJobForEach(), I apply force based on the groupId. The information for how much force to apply to each groupId is retrieved from a dictionary stored elsewhere. At 10,000 entities this is a 20ms operation each frame and this is too slow.


Proposed Solution:"JobComponentSystem" What I can think of is to use a job component system, get access to these same-archetype entity groups, and call the job on each of them and pass in the force value specific to that group. However, I do not know how to get access to these groups. The only way I could do it currently is to pass into the struct a dictionary with the force to be added to every group, and that entity gets the force from its group from the dictionary. That is passing in a dictionary with values for every group when really it just needs the value for its own group.


Advice/feedback would be greatly appreciated.

Comment
Add comment · Show 3
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 Captain_Pineapple · Oct 07, 2019 at 08:52 PM 0
Share

Hey there,

i faced a similar problem ina project once. there i introduced different tagcomponents. but since this is rather rigid and i only had 2 groups this probably wont work for you.

Are you using burst? And can you share some code?

avatar image emerz210 Captain_Pineapple · Oct 08, 2019 at 03:05 PM 0
Share

Hey thanks for the reply, i got it figured out. Had to just learn a little more about ecs. Have a great day! For some reason I thought that you couldn't reference static variables of other classes inside a job and you can. The other part of the solution was to create "entititycaptians" that are entities in charge of updating a bunch of static info for other entities.

avatar image Captain_Pineapple emerz210 · Oct 08, 2019 at 08:29 PM 0
Share

Hey,

thanks for co$$anonymous$$g back on this. would you $$anonymous$$d sharing your experience a bit more detailed as an answer? As you probably have realised yourself while researching this topic there is only little up to date information on this topic.

Also note that in case you want to use the burst compiler (which i can highly recommend :D) you cannot access static references anymore so i wouldn't rely on this too much.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

118 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

Related Questions

Help with Neural Networks and Threading 1 Answer

ECS And the Job System 1 Answer

Unity Jobs Error - "Job can only create Temp memory" 1 Answer

How can I get a component data from an entity inside a JobComponentSystem? 1 Answer

RecalculateNormals optimization 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