- Home /
Items in List wont disappear on restart of game.
I have a List of custom items that stays the same on restart. It does not reset itself. Do i have to do it manually?
You can do this in the Start() method of the script by setting it to a new instance of itself. $$anonymous$$g:
// 'type' could be an int or string etc.
List<type> FilledList = new List<type>();
// 'FilledList' is now empty
The reason it doesnt restart is because it's probably inspector values that you have to change manually. @Durium
Is it a serialized field? If so, you probably have to do it the way @Llama_w_2Ls suggested.
Answer by MSavioti · Dec 30, 2020 at 08:51 PM
You probably set the custom items via inspector, what means that it won't get reset automatically. If you want clear it every time you'll have to do a list.Clear()
manually.
Thanks for your reply. I seem to have mixed together the prefab and the scene object.
Answer by Durium · Dec 30, 2020 at 11:19 PM
I seem to have mixed together the prefab and the scene object.