I wanted to make several custom bitmap fonts for my game, and after looking into it I realized that this is a painstaking process to set up in Unity. So I decided to write an editor script to automatically generate the rects for my characters. The problem is, whenever I try to set the CharacterInfo struct inside my fonts, the change doesn’t seem to actually happen.
Here’s the relevant code:
if(changed) {
var nci = new CharacterInfo();
nci.minX = (int)currentRect.xMin;
nci.maxX = (int)currentRect.xMax;
nci.minY = (int)currentRect.yMax;
nci.maxY = (int)currentRect.yMin;
nci.index = ci.index;
currentFont.characterInfo[currentChar] = nci;
Debug.Log(currentFont.characterInfo[currentChar].minX);
}
After having set the new CharacterInfo struct, the value of the old CharacterInfo is always logged. Is this something new in Unity 5? It seems some things have changed, such as the way the uv and vertex rects are represented, but I don’t see how that should affect the behaviour. Is there something else I’m missing?