Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Mixing Rect Transform and Transforms

Discussion in 'UGUI & TextMesh Pro' started by timothyallan, Jul 4, 2015.

  1. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    Using 5.1.1...

    I've got a World Space Canvas with some draggable UI panels + buttons as sub objects. They all have Rect Transforms as they normally would. I've also got a dynamically created/parented prefab which can be attached to one of the panels so they all drag as a group. The prefab has a normal Transform on it and contains a bunch of Cube Meshes/Colliders etc.

    This works okay, and they all move together as they should, however, since I had to scale the world space canvas down to .01, the Transform component on the prefab comes in at 100 scale to appear normally.

    This leads to headaches when I try and resize/move things later on.

    So my question(s) are:

    1. What is the best practice for mixing parented UI + 3D objects which have to be scaled in order to appear correctly?

    2. Should I not be mixing Rect Transforms + Transforms and just convert everything to a Rect if it's under a Canvas, regardless if it's a UI element or not?
     
  2. timothyallan

    timothyallan

    Joined:
    May 22, 2013
    Posts:
    72
    Bump as this was unfortunately my top search result 5 months later when I'm still wondering, now on 5.3.2 :D
     
  3. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @timothyallan

    Hi, I've had no need to use such transform/RectTransform setup, but have tried this a couple of times. All I can say, you'll lose anchoring on object that has just transform. However, based on limited experience with this I didn't have any problems mixing them.