robertkjonesjr
Member
One common way to solve your issue is to take a different approach - instead of a huge table of variables that are offset only by some index number, many would prefer to create a data type. Under Derived Data Types in Unity, create a type of <struct> and populate with all the variables you need for ONE machine. Since you are only changing the machine ID, I am assuming all your machines are the same. Once this data type is defined, in the variable editor you can create one tag of this type, and it will be populated with all the tags for the machine. If your machine naming is linear, you can even just create an array of of this new data type.
An example: create a DDT called ExpMsgCntrl that contains all the actual variables I need for operating explicit messages on an M340 platform:
Then create an array of 10 of these (an example) for 10 machines:
You can see if we open the first layer there will be ten of these structures, one for each machine:
Then open one of the specific machine structures and all of the variables we defined were there:
I like this organizational approach as it is much faster for me to create this and maintain it during development than having separate linear sets of variables. If you find you need another variable, or have to change the type of something, just go back and make one change in the DDT structure, and all instances are updated automatically. Otherwise, each change must be done for each machine, so 10 machines is 10 changes.
An example: create a DDT called ExpMsgCntrl that contains all the actual variables I need for operating explicit messages on an M340 platform:
Then create an array of 10 of these (an example) for 10 machines:
You can see if we open the first layer there will be ten of these structures, one for each machine:
Then open one of the specific machine structures and all of the variables we defined were there:
I like this organizational approach as it is much faster for me to create this and maintain it during development than having separate linear sets of variables. If you find you need another variable, or have to change the type of something, just go back and make one change in the DDT structure, and all instances are updated automatically. Otherwise, each change must be done for each machine, so 10 machines is 10 changes.