Hello people, I would like to create attribute that block add second same object. How can I do this ? Thanks in advance!
At design-time with the inspector or at run-time? Or both?
The first one would require you to have a property drawer that loops through your array/list and removes duplicates.
The second one would be as simple as using an interface to add elements to your list, rather than exposing the list publicly, such as:
public void AddItem(Item item)
{
if(list.Contains(item) == false)
list.Add(item);
}
At design time.