Author Topic: How to show normal game object in UI?  (Read 1238 times)


  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 12
    • View Profile
How to show normal game object in UI?
« on: June 19, 2014, 01:22:47 AM »
Hello, here's a problem I'm trying to solve:

I'm using Unity2d. I have many game objects, most with normal sprite renderers. Some are animated (just tweening transforms). Some have multiple sub-objects (imagine a character wearing equipment where each piece of equipment is a sub object).

The Problem:
I have UI elements where I'd like to display these game objects with their sub-objects fully intact, and hopefully also with their animations. These UI constructs would be things like info windows, character dialogs, store catalogs, etc.

I haven't yet figured out how to integrate these normal game objects into NGUI. I try adding UI Anchors to them and parenting them in the editor in the UI heirarchy under UIRoot in hopes of placing them in an item grid or drag view or just a normal panel. But when I run the code, these normal game objects' positions and scales change, as if they aren't part of the UI structure.

Is there a standard way to solve this problem?

(I asked a similar question recently, but this is more generalized.)

« Last Edit: June 19, 2014, 11:11:55 AM by Peacewise »


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to show normal game object in UI?
« Reply #1 on: June 19, 2014, 06:06:20 PM »
Assuming by "normal game object" you mean an actual renderer (sprite renderer in your case), the simple answer is -- you shouldn't be mixing UI with sprite renderers. If you want to draw a sprite as a part of the UI, use a UI2DSprite (ALT+SHIFT+D).