Search Unity

Displaying an object in UI

Discussion in 'Getting Started' started by witcher101, Oct 30, 2015.

  1. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    I am trying to make a buy/sell UI for guns.
    I wana display gun models in UI slots.
    Is there anyway this can be done
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    If you mean showing a 3D model in a space, the first thing that comes to mind would be to use a Render Texture. Alternatively, you could just leave a blank space in the UI and have the object behind it?
     
  3. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    So if i make render texture for each guns (8-9)would it slow down performance considerably
    Also in the 2nd method woudnt UI be on top of the object so the object wont be seen
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    I'm not sure exactly what you have in mind here, so I can't say anything about performance. If you want 8 or 9 on screen at a time, forget the render texture. That would require 8 or 9 cameras, 8 or 9 materials, and sounds like asking for performance issues. If you want them all on at a time, make texture sprites of those weapons and use them as UI images.

    If your UI is in Camera space, you should be able to spread the elements out enough that you could put an object in between layers, so your UI wouldn't necessarily be on top of everything. Again, without knowing exactly what your end goal is here, I can't really say what the most sensible approach is, though.
     
  5. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664