Hi,
I have a question. Currently I designing a game where there will be many units moving around. As each unit is created, an UI object, which consists of a UILabel and 2 UIProgressBar, will be created. The 'UI Object' will follow the unit in the 3D environment by using Raycasting.
The hierarchy is as follow :
unit
unit
unit
UIRoot
-UICamera
-UI Object
--UILabel (for Name display)
--UIProgressBar (for Health bar)
---UISprite (Background)
---UISprite (Foreground)
--UIProgressBar (for Armor bar)
---UISprite (Background)
---UISprite (Foreground)
-UI Object
--...
-UI Object
--...
According to the Draw call tool, there is 1 draw call with 10 widgets.
Assuming I have 3 units with 3 'UI Object' being created. Whenever I moved the camera or a unit moved, the performance dropped (According to the Profiler, UIPanel.lateupdate() will 39.2% and 3 ms, majority goes to WriteToBuffer in UIPanel.FillDrawCall and UpdateWidget in UIPanel) rather significantly. The game which I am currently designing will consists of more than just 3 units (approximately 30 to 50, and most likely at least half of units or the UI Camera will always be moving), so may I kindly ask for some opinion in the improvement in the performance?
Note : On my side of the code, I already implemented that there will not a updating of the UI Object's transform position if current position (After Raycasting) is the same as the previous.