- Home /
Loading a Constant Array Of Integers
I have a question today that is no doubt simple, but I am having a hard time thinking of the best solution for it. I have an array of 256 integers (using C#) that need to be referenced in a script that takes the integer from the given array, and uses it to further process data. Now, I know the easy route for this would be to do something like this:
private int[] testArray = new int[] {6, 8, 14, 7};
However this is incredibly sloppy and looks horrible. I know there has to be a better solution to this, but I am drawing a blank. Does anybody have any suggestions?
There no problem making a array directly.
If the data will not change you can also create a ScriptableObject to hold the array. See Introduction to Scriptable Objects.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Spawn Random Enemy 3 Answers
C# - Simple Optimization / Variable Declaration 1 Answer
Multiple Cars not working 1 Answer
Clone of prefabs copy original´s script state during runtime? 0 Answers