Script that provides data as a resource in the inspector
Hello everyone !
I'm currently creating a cube marching algorithm in unity, and as you may know, a cube marching algorithm needs a 3d grid of floats to work. (or scalar field). For now, the grid is hard coded into the script that generates the mesh, but I would like to provide a way for the user to put custom grids to be polygonized
I've though about making a "GridProvider" class that you can extend from. In the mesh generator script, you would have a gridProvider field the mesh generator will be able to call a function on (like gridProvider.getCellAt(x, y, z).
Now, how would I make it so you could assign GridProviders from the inspector. Ideally, the user would be able to create a file like PerlinNoiseGridProvider, with inside a class extending the GridProvider class and implementing a custom algorithm (perlin noise in this case).
Can anyone help me on that ? Am I even heading in the right direction ? Thanks in advance !
EDIT : I found out about scriptable objects, but is it the only / best way I can achieve what I need ?
Your answer
Follow this Question
Related Questions
How to add a editing option to variables in a script in Inspector? 0 Answers
How to reference custom assets from Inspector or Script 0 Answers
How do I see what Reference properties and Value properties I can address in GetComponent in C#? 0 Answers
Public Variable in a Script do not show up in Inspector thus unable to assign it. 1 Answer
How to draw a model in the preview window of my custom editor using OnPreviewGUI? 0 Answers