Can I use Immediate Mode in ECS System?

Avatar
  • updated

I would like to use IM in a system like the following:

public partial class SomeSystem : SystemBase
{
protected override void OnCreate()
{
base.OnCreate();
}

protected override void OnUpdate()
{
Entities.WithAll().ForEach((in DrawingData someData) =>
{
Draw.Line();
}).WithoutBurst().Run();
}}

Would it be possible to access IM from within such an Entites ForEach loop?

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Freya Holmér creator

I haven't designed it to be used with ECS, I don't know all the intricacies of how it handles rendering and command buffer dispatch. So I don't know I'm afraid! I've heard some who haven't been able to use it together with ECS, so I don't think it's supported, but it's possible it might work in certain configurations

Worst case, you can always try it and refund in case it doesn't work out!

Avatar
simon_

It does work as simple as that!:


protected override void OnUpdate()

{

using (Draw.Command(Camera.main))
{
Entities.WithAll().ForEach((in DrawingData someData) =>
{
Draw.Line();
}).WithoutBurst().Run();
}

}}