String array (Answers) is not visible in the Inspector

Hello,

Thank you for the value you share with the community.
One question related to video “56. Arrays”
I added the following command to my scriptable object:
[SerializeField] string answers = new string[4];

However, when I go to the Inspector, I see a big box under the Answers section. It has an index (4) but I can’t see the elements. If I click on that area and drag my mouse, I can see that there are some elements though.

Am I doing anything wrong or is it a Unity bug?


Bug2

Hi,

Welcome to our community! :slight_smile:

Which version of Unity do you use? Have you already clicked on the “+” to see what happens?

Hi Nina,

Thank you for your quick response.
I am using Unity 2021.2.2f1
I tapped the “+” and it adds a new element in the array (becomes “5”) but still it’s not visible in the “Answers” section.

Is there any chance that my Unity version is very buggy? I just opened the project again and it’s a mess. I did not leave it like this, I was following meticulously the instructions, step by step.
What do I mean by “mess”: all texts changed their position.

I would assume that I am using a very buggy version of Unity.
I changed the array size to [2] and the inspector was not updated (I saved my script first)
See image attached (I am using two screens)

I too suspect that the issue is caused by your version of Unity. Other students had many visual issues with 2021.2. I was not even able to install 2021.2 due to problems.

If you created an object of your class, changing the initial value of a field won’t affect the value in the Inspector. That is the correct behaviour. However, when you create a new object, the Inspector should take the initial value from the class for the new object.

Try to type 2 into the field that currently says 0 in your screenshot to see what happens.

If you still do not get the fields displayed, please downgrade to Unity 2021.1.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms