I have a really weird thing happening that I can’t figure out. I set a variable _redTeam.AttackMVP, but then when I check the results, the AttackMVP.Name is accessible and correct, but the AttackMVP itself is null.
It could just be that Debug.Log has no way to print out a string value for whatever class Piece and AttackMVP are, especially if they aren’t derived from MonoBehaviour
AttackMVP is an instance of the class Piece, which inherits from MonoBehaviour.
public class Piece : MonoBehaviour
@kru - that is very interesting, had never seen it before. So it seems in this case, it is because the GameObject gets destroyed, but the class data remains intact. So the null check returns true, because it’s using the “fake null” check. While the class data is actually there.
That’s it exactly. You have kicked over a stone and discovered a bit of very dark (yet darned convenient) magic in the Unity environment. Now that you know about it, you can safely put it to use.
is static. This means that if you’ve got two UnityEngine.Objects that you’re comparing with ==, but you’ve referenced them through System.Object or (more likely!) some interface, the magic null check will not happen, as the call will dispatch to System.Object.== instead of UnityEngine.Object.==