I want to create a chat box. Messages should have a border. Also message could be located in one of two sides, I mean right or left side.
I have made two prefabs, one for left-side message and second one for right-side message.
When I add some prefab in chat box it works fine, I can see the border. But when I do it by the script, then the border is invisible.
Here is the structure.
The "Content" has Vertical Layout Group component with checked Width, and Content Size Fitter with Horizontal Fit - Unconstrained and Vertical Fit - Preferred Size.
The "Message left" has Horizontal Layout Group with unchecked Width and Height, and Layout Element with all unchecked.
The "Message (1)" has Content Size Fitter with Horizontal Fit - Unconstrained and Vertical Fit - Preferred Size, Horizontal Layout Group with Width checked, and Layout Element with Preferred Width - 291.5, and Flexible Width - 0.
Also here is two imaged, with border and without border.
UPDATE: The border is on "Message (1)" and it looks like
So how do I fix it? Is there a solution?
UPDATE2: I have fixed it. The problem was in Z scaling of sprite, I set it to 0, but it has to be 1.