Hi, I’m currently designing a system for a custom editor in unity. It’s mostly about making all kinds of modular scripts you can click in and out, but I’m running into a problem with one of my module’s structure.
This module is a script that let’s developers add Actions to. These Actions can have lots of different effects, like moving an object or sending a message or instantiating something. And these effects have their own set of variables accordingly, like the Send Message Action will have a string field that contains the actual message and a gameobject field that the target can be put in. However I’m not sure how to set something like this up. I’ve tried a few methods, but I’m looking for a method more optimized, cleaner and efficient. If anyone has any ideas, please share.
These are the methods I’ve tried so far:
1: Keep arrays individually for every variable. This makes the code cluttered because and stores too much stuff in memory, I think. Also most of the information isn’t even used this way, because for every Action ALL possible variables will be stored even though not even a half will be used.
2: Parse all info to an array of string arrays. I’ve written a lengthy piece of code that parses all info: strings, int, floats, bools and vector3, in and out of a certain string. This works pretty well but it does use an entire array of strings with a lot characters which doesn’t sound like it’s optimized very well.
If anyone has any ideas, please share.