This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
How to Share collision data between systems in DOTS
Post Body
I have a collision system that detects when triggers on asteroids are hit and stores asteroid data, the point of collision, the player ID, etc in a NativeArray. I would like to use that data in another system to spawn "mined resources".
The collision might look like this:
public struct AsteroidHitList : IBufferElementData
{
public LocalTransform position;
public int playerProjectileOwnerId;
public int resourceGeneratedTypeId;
}
public partial struct BulletTriggersOnAsteroidsSystem : ISystem
{
NativeList<AsteroidHitList> resourcesArray;
Then I would want another system to generate resources... maybe something like this. What would be the proper way to share these data between systems:
public partial struct SpawnResourcesSystem : ISystem
{
public void OnUpdate(ref SystemState state)
{
World.GetExistingSystem<BulletTriggersOnAsteroidsSystem>().resourcesArray
}
}
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Unity3D/com...