From a button click I want to instantiate a new ProjectileShooter with type(IComponentData) on the player (editing the existing projectileshooter works) this script has a reference to the ProjectilePrefab. However if I want to instantiate the ProjectileShooter it needs to acces the baked Projectile but this seems impossible from a monobehaviour script. How would I do something like this?
entityManager.AddComponentData(entity, new ProjectileShooter {
Speed = 25,//math.clamp(Unity.Mathematics.Random.CreateFromIndex(0).NextFloat(), 10f, 100f),
ProjectileLifeTime = 5,
Projectile = ENTITY,
});
///////////////////////
public struct ProjectileShooter : IComponentData
{
public float Speed;
public float ProjectileLifeTime;
public Entity Projectile; //<----------
}
DOTS 1.0