Search Unity

UI panel disappears after I instantiate objects

Discussion in 'UGUI & TextMesh Pro' started by unity_SfxLFySbchQIWA, Jan 7, 2021.

  1. unity_SfxLFySbchQIWA

    unity_SfxLFySbchQIWA

    Joined:
    Mar 21, 2019
    Posts:
    1
    Hi!

    I am trying to write code which creates a dynamic UI table in Unity. I started with a code that instantiates a new UI "row".

    Unfortunately it doesn't work. Each time that the prefab gets instantiated, the whole content of the Panel becomes invisible, even the text that was there already before!.

    Why could that happen?


    Code (CSharp):
    1.     void Start()
    2.     {
    3.         var newRow = Instantiate(rowPrefab);
    4.         newRow.transform.SetParent(verticalList.transform);
    5.         //DrawTable();
    6.     }
    upload_2021-1-7_19-33-5.png
    Best,
    Aleks