GLSL How to access UNIFORM array?

Turns out you cannot access UNIFORM array, which hasn’t been created with certain size, with integers that are created within the void main() method/function
If you want to access UNIFORM array that hasn’t been created with specified size, you will have to type in a “static” number.
This code will work nicely.

	uniform float[] myArray = float[](0, 10, 20);
	
	void main() {
		float x = myArray[0];
	}

This code won’t compile.

	uniform float[] myArray = float[](0, 10, 20);
	
	void main() {
		int index = 0;
		float x = myArray[index];
	}

If you want to access your UNIFORM array with “index”, you will need to do this.

	uniform float[3] myArray = float[3](0, 10, 20);
	
	void main() {
		int index = 0;
		float x = myArray[index];
	}