Search Unity

Losing reference to propertyField after play and then return to editor mode

Discussion in 'UI Toolkit' started by cemleme, Jul 3, 2019.

  1. cemleme

    cemleme

    Joined:
    Mar 24, 2017
    Posts:
    30
    Hello,

    I am creating a property field on CreateInspectorGUI() and attaching it to the root visual element.

    everything works perfectly and the property fields shows normal; but when I play the scene and then get back to the editor, the property field disappears.

    the test label I created still shows after play/get back to the editor.

    Code (CSharp):
    1.        
    2.             private SerializedProperty dialogueShowUpperCaseProperty;
    3.  
    4.             dialogueShowUpperCaseProperty = serializedObject.FindProperty("showUpperCase");
    5.             PropertyField showUpperField = new PropertyField(dialogueShowUpperCaseProperty);
    6.             conversationSettingsHolder.Add(showUpperField);
    7.  
    8.             Label testLabel = new Label("test label");
    9.             conversationSettingsHolder.Add(testLabel);
    10.  
    11.             root.Add(conversationSettingsHolder);
    any ideas?

    thanks
     
  2. etienne_phil_unity

    etienne_phil_unity

    Unity Technologies

    Joined:
    Jan 15, 2019
    Posts:
    16
    hello! Could you please post the full editor script and the component it corresponds to?