Prefab with canvas inside not working on "horizontal layout group"

Hello!
On my current project i have prefab’s with individual canvas, when i try organize then on a “horizontal layout group” they just dont work…

Exemple:
197789-whatsapp-image-2022-07-19-at-234747.jpeg
In this exemple the “horizontal layout group” is on “Panel” and the “Image” just ignore it.

With this code bellow its works, but a lose the individual canvas:

GameObject.Find("Image").transform.SetParent(GameObject.Find("Panel").transform, true);

Any suggestions?
Very thanks!

Check this out, this might help : https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-HorizontalLayoutGroup.html/ DMVNow.com

Hi!

Horizontal layout groups only work on the direct children of the component. The Image needs to be a child of the panel to be at all affected. (This is why your code snippet works)

May I ask why you need the Canvas2 object? Does it serve a special purpose in your project?