SgtRats
SgtRats

Reputation: 23

Change ReorderableList maximum items from script

I'm working with reorderable lists in Unity right now and I can't seem to figure out how to update the 'max items' field that is visible in the inspector from a script. I'm a little new to Unity so I might be missing something easy but I didn't see any way from the listed methods or properties to update this field. Just looking to set the max items in a reorderable list to the size of a Dictionary that I have populated.

Any help would be appreciated. Thanks.

Edit: Just to be clear, the value I'm trying to change is the bottom one in the screenshot below: enter image description here

I've tried things along the lines of listName.maxValue = X, listName.maxSize = X, but (at least out of what Visual Studio Code is showing me) there is no method available to change this value. I even tried opening the Reorderable List script (which is from an imported package) and adding my own method for it but it is still throwing an error after trying to use it.

Upvotes: 2

Views: 176

Answers (1)

derHugo
derHugo

Reputation: 90724

Note that such a class name already exists namely UnityEditorInternal.ReorderableList.

Make sure on top of your file you have

using UnityEngine.UI.Extensions;

instead of

using UnityEditorInternal;

Upvotes: 1

Related Questions