- auto pos0 = theUniformName.GetStringView().rfind("[", pos);
- arrayIndex = atoi(theUniformName.GetCString() + pos0 + 1);
+ auto pos0 = theUniformName.GetStringView().rfind("[", pos);
+ if(pos == nameStringView.length() - 1) // if element is in struct, don't set array index.
+ {
+ arrayIndex = atoi(theUniformName.GetCString() + pos0 + 1);
+ }