I'm a Java guy, but learning C# has been interesting. I was wondering if anyone can shed some light about why I have been getting this Warning: "Accessing a member on 'MyGame.Player.index' may cause a runtime exception because it is a field of a marshal-by-reference class"
I get this warning when accessing these variables from my game logic code which is in another package/namespace.
I have added variables in the Player class that extends the BasePlayer class.
- Code: Select all
namespace MyGame
{
public class Player : BasePlayer
{
public Player enemy;
public float money;
public int index;
public Cheese cheese;
public Player()
{
}
}
}
I am wondering if this is the best approach to have variables on my Player Objects or if having that warning will in any way effect the game. (I have not tested to see if it will work even with these warnings).
Thanks