Unity is automatically instantiating variables

I have a list of Character instances and a ‘selectedChar’ variable that I set to null if no one is selected, but sometimes Unity decides to un-null it by creating an empty Character instance for it. I’ve run into this problem before where I would look at an object in the inspector and its variables would be auto-instantiated, so I fixed that by keeping the inspector blank at runtime. This time though, it does it regardless. Has anyone run into this problem before?

i don’t really know what you’re referring to, but it’s possible the magic NonSerialized directive might help you.

@System.NonSerialized
var thisProjectileHitType:int;