Classes and referencing objects?

I just have a quick question. so I am creating some objects in a blueprint class and I am wondering what is the best way to assign the values / data or hold it for referencing in some way to an object once I have created its class?

Example would be 10,000 Apple’s with different colors, names, price, weight etc. also I am not talking about serializing I am just talking about just the handling of data Thanks

If I understand your question, you are looking for an efficient way to store large sets of data, in this case a set of Apple Objects. For this I would use a ScriptableObject, so you only have one list of you Apples that can be referenced by any number of Objects. One thing to note is that a ScriptableObject CANNOT be modified at runtime.

Here are some code snippets that should help get you started:

First you will the script that defines the ScriptableObject, I choose to separate this into two classes, one that contains the list of apple data and the other defines what an apple is.

[System.Serializable]
public class AppleProfile
{
	public Color Color;
	public float Weight;
	public string Name;
	public float Price;
}

[System.Serializable]
public class AppleCollection : ScriptableObject
{
	public List<AppleProfile> appleList;
}

Next you need a way to create an instance of your create a new instance of your ScriptableObject. For this a simple editor script will allow you to create the AppleCollection from the Menubar.

public class MakeAppleCollection
{
	[MenuItem("Create/Apple Collection")]
	public static void CreateAppleCollection()
	{
		AppleCollection asset = ScriptableObject.CreateInstance<AppleCollection>();

		AssetDatabase.CreateAsset(asset, "Assets/AppleCollection.asset");

		EditorUtility.FocusProjectWindow();
		Selection.activeObject = asset;
	}
}

From here, whatever objects that need the reference to the AppleCollection you can just drag and drop. For instance an AppleVendor!

public class AppleVendor : MonoBehaviour
{
	public AppleCollection AppleCollection;

	public void Start()
	{
		// Do whatever you want with the data
		float cost = AppleCollection.appleList[0].price;
		print (cost);
	}
}