Help creating a persistent data class

Hello, I’m trying to create a class that is going to essentially create thousands of (C#) class objects and stores several attributes about each one. This data needs to persist through scenes and needs to be global so I can call functions to it and retrieve data back and forth.

How do I go about setting this code up? (I’m new to the Unity environment, sorry.)

What I would do, maybe it isn’t the best solution but it work for my game (a 4x strategy game that generate up to 1000 planets at the beginning of the game) is to use some statics arrays (or static lists). Each new object have to be atrribueted a slot in arrays (You need one arrays per attribute of your object) and u just store data in your static arrays. Then you can acces those data in any level (static var arrays list etc… can be accessed from anywhere in the game (most easy way to set up it is to put your script with static stuffs on an empty game object in scene 0 and use DontDestroyOnLoad). Data won’t reset before you quit the game, unless you have a script to reset it. Static must be unique, and you can access data without getcomponent, simply using MyStaticVarsScript.myStaticVar.

I’ll try this out. Thanks.