Hi,
What is the difference between them ?
Thanks a lot.
Best regards,
AB
Hi,
What is the difference between them ?
Thanks a lot.
Best regards,
AB
The main difference is the renderer, Sprites use a SpriteRenderer and UI uses a CanvasRenderer.
Other than that, not much.
UI is effectively the 2D sprite system bounded by a heap load of additional functionality to layout your UI for rendering.
Hi,
Thanks for your reply.
So it cost much to use an UI Image than a Sprite…
Thanks a lot !
It depends on what you want to use it for.
I find if you have fixed UI or static UI, then the new system is brilliant.
If you just want to draw 2D objects in a scene or use world coordinates for everything, or need physics applied to 2D object, then the 2D system is better.
As with everything, use that which makes sense.
Perfect thanks.
Is it possible to add a rigid body to an ui element ? Like a chart pie with a rigidbody who is updated with the chart pie update?
Thanks again !
You can attach a rigidbody to any game object in the hierarchy. However, for UI element, unless you use the whole canvas as a the game view, it might be pointless to attach one. What might you be using the rigidbody for though?
For a pie chart, you need an angle, a center point, a split point, and a radius. What might rigidbody contribute :-?..
I would be wary about adding physics elements to UI components. They are rendered in a different way to normal GO’s
In all my tests previously, you get a significant about of lag because UI is only processed in the main Update/LateUpdate loop. Changes in FixedUpdate do not apply until the next frame.
You can add RigidBody and Collision components to UI, it just doesn’t update frequently.
Hi,
Thanks !
Do you see another solution to do something like the youtube video I sent ?
Thanks again !
Best regards,
AB
If it’s the gameplay you are referring to, then I would just use the 2D sprite system, not the UI system.
UI is for UI/UX, the 2D system is for your game/gameplay.
Looks like a outer circle mesh with a mesh collier and a 2D sprite with a simple box collider. Obviously you could go more complicated that that if you wished.