Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Replace ui with other ui types

Discussion in 'Scripting' started by johnboyman12, May 27, 2017.

  1. johnboyman12

    johnboyman12

    Joined:
    Apr 13, 2017
    Posts:
    41
    Hello. I built a project with images instead of panels for my project, but I need to use panels instead. Is there any way to replace existing components in my scenes ui hierarchy with simliar ones like replace and image with a panel and keep its old specifications and children elements?
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    I had to double check, but other then some settings, a panel and an image are the same thing. They just have a few settings that are different. You could easily convert your images into the "panel" settings if you wanted to. Otherwise, UI is just a gameobject with components on it. Nothing really special. You can create an empty gameobject and add a button component to it and you have a button.
     
    Ryiah likes this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,952
    Below is a side-by-side comparison of a new Image and a new Panel. Like @Brathnann mentioned the differences are very minor and are almost entirely contained within the Rect Transform. Altering the anchors will likely be all you need to do to make your UI object behave in the way you want it to.

    side-by-side.png
     
  4. johnboyman12

    johnboyman12

    Joined:
    Apr 13, 2017
    Posts:
    41
    Oh thanks