Hi Tony!
I am trying to add a background image to my portrait name... but since I really dont understand half of the Unity UI system, I figured I might as well write here... and it could perhaps help someone oneday that tries to do the same thing
As you can see in the picture below
I created a framing for the name... it is positionned properly in SLICED mode... so I can adjust the width and it will stretch to the right side to acomodate super long character names... or contract to the left for much smaller names... I'd like to automate that "stretching" based on the character names... but I fear the template I am using might not work for that... Any tips/help you could provide on how I could achieve that?
As always, THANKS SO MUCH for all your amazing support!
Variable Size Portrait Name
Re: Variable Size Portrait Name
This may be a little hard to describe since it will depend on how the parent UI elements are configured.
Let's assume the GameObject hierarchy is like this:
PortraitName:
Let's assume the GameObject hierarchy is like this:
Code: Select all
Canvas
...
PortraitNameBackground
PortraitName
- Add a Layout Element component to PortraitName. You can leave all of the checkboxes unticked.
- Set the Rect Transform to Anchor: top left. Pivot X=0, Y=1.
- Add a Horizontal Layout Group to PortraitNameBackground. Tick Control Child Size > Width; leave the others unticked. Set the Padding values if you want.
- Add a Content Size Fitter. Set Horizontal Fit to Preferred.
Re: Variable Size Portrait Name
2 things...
1st, IT WORKS!! you are so amazing its crazy!!
hehe...
2nd, i am getting the following warning after testing it...
Unexpected top level layout group! Missing GUILayout.EndScrollView/EndVertical/EndHorizontal?
UnityEditor.DockArea:OnGUI()
1st, IT WORKS!! you are so amazing its crazy!!
hehe...
2nd, i am getting the following warning after testing it...
Unexpected top level layout group! Missing GUILayout.EndScrollView/EndVertical/EndHorizontal?
UnityEditor.DockArea:OnGUI()
Re: Variable Size Portrait Name
Glad I could help with the 1st one!
For the 2nd one, this may be a relatively-harmless glitch in the Dialogue Editor window. Does it still happen if the Dialogue Editor window is closed?
For the 2nd one, this may be a relatively-harmless glitch in the Dialogue Editor window. Does it still happen if the Dialogue Editor window is closed?
Re: Variable Size Portrait Name
Well, it only happened twice the first time after i did the changes... so it might have been a fluke...
Consider this done/closed
Thanks again!
Consider this done/closed
Thanks again!