Search Unity

Resolved List values are not displayed in the Inspector

Discussion in 'Editor & General Support' started by wiruka, Jan 10, 2022.

  1. wiruka

    wiruka

    Joined:
    Feb 17, 2019
    Posts:
    2
    I'm trying to edit list values in the Inspector.

    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. public class TestObject : MonoBehaviour
    7. {
    8.     [SerializeField]
    9.     private List<string> m_lName;
    10.  
    11.     // Start is called before the first frame update
    12.     void Start()
    13.     {
    14.        
    15.     }
    16.  
    17.     // Update is called once per frame
    18.     void Update()
    19.     {
    20.        
    21.     }
    22. }
    23.  
    However, the result looks like the attached image.
    Unable to set the value in the list.
    upload_2022-1-11_0-56-15.png

    I want to know the reason of this problem.
    How can I solve this problem?

    Thanks.

    Development Environment
    Windows 10 Home ( Version 20H2 )
    Unity 2021.2.7f1 Personal
     
  2. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    Hello,

    This looks like a bug to me. You can try reporting it to Unity at the top of your project via Help -> Report a Bug...

    However, you may want to try creating a new script to see if the issue persists. I'd also recommend using the latest LTS version if you want to avoid as many bugs as possible. The latest LTS version of Unity as of writing this is 2020.3.25f1

    I tested your exact script in the latest LTS, and this is what it looks like for me, so I'm fairly certain you have a bug:
    Capture.JPG
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    Agreed.

    For OP, some things to try:

    - right-click-reimport-all in your project

    Or try other types of lists, like a list of ints, or a list of GameObjects, etc.
     
    Unrighteouss likes this.
  4. wiruka

    wiruka

    Joined:
    Feb 17, 2019
    Posts:
    2
    Thank you for getting back to me.

    I tried the latest LTS version and it solved the problem.
    I'm going to use the latest LTS version.
    I've also reported a bug to Unity.
    thanks for your help.

    I have tried it but the result was the same.
    Thank you very much anyway.
     
    Unrighteouss likes this.