- Home /
Boo bug? BCE0046: is can t be used with a value type ( UnityEngine.NetworkPlayer )
test as NetworkPlayer
if ( not test== null ) and (test == Network.player )
if ( not test== null ) and (test.Equals(Network.player) )
if ( not test== null ) and (test.ToString() == Network.player.ToString() )
if ( not test== null ) and (test.GetHashCode() == Network.player.GetHashCode() )
Any way. Error is still there. Boo bug? BCE0046: is can t be used with a value type ( UnityEngine.NetworkPlayer )
Thanks for your Help!!!
Btw, it would be great to know what "owner" is and on which line the error occurs...
Thank you~ I remove "( not test== null ) and", The error disappeared.
Answer by Bunny83 · Jan 25, 2013 at 06:50 PM
A variable of type UnityEngine.NetworkPlayer (which is a value type, in other words a struct) can't be tested with the "is" operator because it's not a reference type. A struct always has it's final type. It also can't be compared or set to null.