getVersion gives 2.2.21 for FMOD 2.02.15

I’m checking FMOD version on Android and iOS by using getVersion function of FMOD engine; see the code below. It reported the correct version number FMOD 2.0.9 that I was using earlier, but when I upgraded to FMOD 2.02.15, I’m getting now a version string of 2.2.21. This happens on both Android and iOS. Is there a bug or am I doing something wrong here?

        private static FMOD.System _coresystem = new FMOD.System();
        public uint GetVersionCode()
            uint ver = 0;
            RESULT res = _coresystem.getVersion(out ver);
            if (res != RESULT.OK)
                return 0;

            return ver;
        public string GetVersionString()
            uint ver = GetVersionCode();
            if (ver == 0)
                return "";

            uint majorversion = (ver >> 16) & 0xFFFFU;
            uint minorversion = (ver >> 8) & 0xFFU;
            uint patchversion = ver & 0xFFU;

            string str = majorversion + "." + minorversion + "." + patchversion;
            return str;


The issue is we use a Binary-coded decimal system which was fine until our version numbers entered the double digits. I have made a note to add this to our documentation.

The solution is to convert the patch version from its decimal value back to hexadecimal

string str = majorversion + "." + minorversion + "." + patchversion.ToString("X");

More information about the toString("X") function can be read here: Standard numeric format strings.

Hope this helps.

Thanks! Made that change, and now it works!

1 Like