Hi, Ive created a list OnEnable(){} and every time the game object gets activated it adds the list again as a duplicate. Now that isn't the problem. The problem is I want to clear the list On Disable(){} but it doesn't work. Nothing happens when I use: List.Clear(); List = new List<string>();
How are you confirming the contents of the list? I don't see anything that removes existing options from stock before adding new ones from StockList so I'd hazard a guess that you are clearing the list but not clearing the old list values out of whatever stock is.
my list is generated by finding game objects with tags and adding them to a dropdown menu. all that works fine. I just cant clear those previous values as you say. I don't have an issue with the repopulating just the clearing. the On disable() is where I need to clear the list and it doesn't work.
I think stock is a dropdown, so a list is being added to the options. @OP, you'll need to clear your dropdown as well before adding the list to it again. https://docs.unity3d.com/ScriptReference/UI.Dropdown.ClearOptions.html