So here’s the set up I have so far:
- CSV is in assets folder
- When editor starts up, the CSV updates (if any changes are made)
- CSV data exists on a DataManager object in the scene
- When a weapon is instantiated, it automatically populates the data from the CSV
The weapon itself is a prefab.
I am struggling to figure out how to automatically load the data into the weapon object when in the editor. I want to be able to see the data updated when reviewing my prefab objects.
As I understand it ExecuteInEditMode doesn’t work for anything that isn’t in the scene. And I’m just trying to get my prefab’s field’s updated.
What would be a good way to accomplish this?
For the folks I’ve seen using CSV files, they’re still using scriptable objects. They update the CSV then run some editor code that updates all the related SO’s alongside making new ones and deleting no-longer needed ones.
Then your prefabs only have to reference these scriptable objects.
Yeah, this is exactly what we do. We have various assets (text, difficulty controls, level layouts, item stats, etc.) in Google spreadsheets, then we have editor scripts to hoover down as a CSV, transmogrify them into ScriptableObjects and off we go.
For my personal stuff I rarely ever touch CSV since ScriptableObjects are so much more robust and typed and infinitely connectable into crazy structures of pre-made data.
That was my exact thought. And there’s plenty of tools to show SO data in tabular form if that’s what floats your boat.
The only time I’m not saving asset-level data in SO’s is when it’s big data, and I save it to binary with the Odin serialiser.