• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by eddyzy · Feb 19, 2014 at 08:38 PM · movementperformanceguitexturertsquad

What`s more expensive GUI Texures or Quads for displaying units health?(RTS)

Hello,

So what should i use? Quads that follow the units and change color? OR GUI texures that aquire the units position by ray shooting?

And what should i use for smooth movement, FixedUpdate?

Thx in advance.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by robertbu · Feb 20, 2014 at 12:25 AM

Whether you should worry about this issue depends on the number of units you have and what platform you are authoring for. GUITextures cost a drawcall each. It is possible to get all of your Quads to batch together into a single drawcall, but to do so is not as simple as just setting the Material.color. To cause your Quads to batch, you must use a Texture Atlas and/or use Vertex colors to change the color of your Quads. Setting the Material.color attribute breaks batching, so a Quad would be no more efficient than a GUITexture.

Most positioning of a GUITexure does not require a Raycast. It can be done by Camera.WorldToViewportPoint(). As for smooth movement, Update() or possibility LateUpdate() is likely the best choice.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image eddyzy · Feb 20, 2014 at 01:10 AM 0
Share

You`re right GUI textures are better.

(I just spent 3 hours on quads and they just move miserably)

I used Gui Textures + Camera.WorldToViewportPoint() before, but there`s a slight delay when I move the camera,and I thought that quads may perform better, but I was wrong ...

avatar image robertbu · Feb 20, 2014 at 01:20 AM 1
Share

Are you doing your movement of Quads and/or GUITexture in LateUpdate()? That may solve any lag issue.

avatar image whydoidoit · Feb 20, 2014 at 01:38 AM 1
Share

@eddyzy definitely don't use FixedUpdate for anything to do with the screen, that can cause jerkiness as the physics step does not necessarily update every frame. Quads can be totally smooth - so something interesting is going on with the order of things that you do.

avatar image eddyzy · Feb 20, 2014 at 12:09 PM 0
Share

Well quads are nice,but following the unit is the problem. I can`t seem to find a way to make the quads follow the unit smoothly. A idea on how to do that?(I used update and the movement isn`t that smooth as GUI Texures)

avatar image robertbu · Feb 20, 2014 at 03:10 PM 0
Share

Use LateUpdate(). That may not be the whole issue.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

using coroutines for move objects - performance. 1 Answer

NavMeshAgent is pushing Others 0 Answers

RTS Movement - I'm doing it wrong 2 Answers

how can I create a quad from script? 3 Answers

Help with camera lock in RTS 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges