Trouble with UI elements on Sprites
I am having trouble with UI elements and sprites. I currently have a sprite that I want to display dynamic text on top of. What I did was have the sprite be a child of the canvas, and the text is a child of the sprite game object.
This sprite can be moved by the player and able to be moved over other sprites and if it does, the most recent sprite they picked is on top. Ex Sprite A, B, C, D. They move sprite C and now the sort order is C, A, B ,D. I do this by changing the sort order on the sprite. So the sprite sorting order is being changed every time the user moves the sprite. Also in this example, every sprite will have text on top of them.
When the player moves the sprite, the text disapears even though it is stil attached as the child. have read multiple solutions, but a lot of them are about z sorting (which I am guessing is outdated) or using canvas sort layers or using sprite sort layers, nothing in conjunction.
I guess I can try changing the sprite to an image, but then I would lose the functionality around it being a sprite. Unless there really is not much difference between a sprite and an image? Any ideas? I am kinda loss on which direction to take.
Your answer
Follow this Question
Related Questions
[Beginner Question] Loading, Destroying and Replacing UI Background Sprites (2D) 0 Answers
Inverse Sprite Maskin 0 Answers
Sprite mouse movement Unity2D 0 Answers
How to fix animation "auto-smoothing"? 0 Answers