Casting shorts results in an error.

So, we all know that using math operands in C# returns an int. So, I did the following to fix this:

short b = 5;
short c = 3;

short a = (short)(b - c);

Unfortunately, I get an internal compiler error:

Unhandled Exception: System.NotSupportedException: Operation is not supported.

This happened with byte casting, too. Is this a feature Unity doesn’t include or what can be happening here?

Here’s a pastebin of the full exception that outputs to the console: blah - Pastebin.com

Okay, I figured out the answer. The editor kept focusing me onto the code with short, but the actual error was coming from the line beneath it. It uses a wrapper class for sparse matrices, and I simply forgot to cast (int) when referencing the keys since vectors are floats by default.