ImmediateModeShapeDrawer - Bad to have a lot of it?

Avatar
  • updated
  • Answered

Hi there, I have a class that I'd like to do some Immediate Mode drawing in, so I was going to inherit from ImmediateModeShapeDrawer to keep the code clean, but it's already inheriting from my own class.


Are there any downsides to then having my base class inherit from ImmediateModeShapeDrawer for the sake of the first class I mentioned, even if other child classes aren't going to use the Immediate Mode functionality?

My use case is visualizing debug stuff (enemy detection logic and jump heights) in both the editor and game view.

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
URP
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Answered

it's not that expensive if you're not using it to issue draw commands, in that case it's basically like an empty update loop

the expensive bit can happen if you issue multiple Draw.Command() calls in a single frame, though the limit of where it becomes expensive, depends, it might be fine on some platforms, and not fine on others.

Avatar
Freya Holmér creator
  • Answer
  • Answered

it's not that expensive if you're not using it to issue draw commands, in that case it's basically like an empty update loop

the expensive bit can happen if you issue multiple Draw.Command() calls in a single frame, though the limit of where it becomes expensive, depends, it might be fine on some platforms, and not fine on others.

Avatar
sean w
Quote from Freya Holmér

it's not that expensive if you're not using it to issue draw commands, in that case it's basically like an empty update loop

the expensive bit can happen if you issue multiple Draw.Command() calls in a single frame, though the limit of where it becomes expensive, depends, it might be fine on some platforms, and not fine on others.

Awesome, thank you!