Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Discussion World Space Canvas or Projector

Discussion in 'Editor & General Support' started by DRRosen3, Dec 20, 2022.

  1. DRRosen3


    Jan 30, 2014
    I'm curious about thoughts on this. Which scenario would be more performant?

    (A) A scene with hundreds of Canvases set to World Space with a single image, where the canvas is only rendered when the local player is within a certain distance (controlled via a trigger collider on the player).

    (B) A scene with hundreds of Projectors (Decal Projectors if using URP or HDRP), where the projector is only turned on when the local player is within a certain distance (controlled via a trigger collider on the player).
  2. Kurt-Dekker


    Mar 16, 2013
    For performance issues there is only ONE way to find out. Always start by using the profiler:

    Window -> Analysis -> Profiler

    DO NOT OPTIMIZE "JUST BECAUSE..." If you don't have a problem, DO NOT OPTIMIZE!

    Failure to use the profiler first means you're just guessing, making a mess of your code for no good reason.

    Not only that but performance on platform A will likely be completely different than platform B. Test on the platform(s) that you care about, and test to the extent that it is worth your effort, and no more.

    Remember that optimized code is ALWAYS harder to work with and more brittle, making subsequent feature development difficult or impossible, or incurring massive technical debt on future development.

    Notes on optimizing UnityEngine.UI setups:

    At a minimum you want to clearly understand what performance issues you are having:

    - running too slowly?
    - loading too slowly?
    - using too much runtime memory?
    - final bundle too large?
    - too much network traffic?
    - something else?

    If you are unable to engage the profiler, then your next solution is gross guessing changes, such as "reimport all textures as 32x32 tiny textures" or "replace some complex 3D objects with cubes/capsules" to try and figure out what is bogging you down.

    Each experiment you do may give you intel about what is causing the performance issue that you identified. More importantly let you eliminate candidates for optimization. For instance if you swap out your biggest textures with 32x32 stamps and you STILL have a problem, you may be able to eliminate textures as an issue and move onto something else.

    This sort of speculative optimization assumes you're properly using source control so it takes one click to revert to the way your project was before if there is no improvement, while carefully making notes about what you have tried and more importantly what results it has had.
  3. DRRosen3


    Jan 30, 2014
    I can seriously appreciate the thorough response. However, it’s highly misplaced. This isn’t a matter of optimization. This is a matter of best practices/what approach to take. There’s no code to optimize. We’re simply talking about the way Unity handles rendering and the way the two different components (canvas/panel/image versus projector/decal projector) work.

    There’s nothing to use the profiler for right now. The question is more directed towards individuals/teams who’ve already faced this choice and what their findings were; or for actually Unity developers to chime in and give their insight based on their deeper understanding of all the things involved. It’s just a discussion not actually asking for help