Get and set not working properly
public Vector2 Get() { return var2; } public void 开发者_JS百科Set(Vector2 var1) { var2 = var1; }For some reason if call Get(), var2 is (0, 0)... even though both var 1 X and Y are greater than 0...
What am I doing wrong?
The proper syntax for a property in C# is:
public <TYPE_NAME> <PROPERTY_NAME>
{
    get
    {
        return <LOGIC HERE>;
    }
    set
    {
        //value is whatever the property is set to in the calling code
        <local_var, or whatever> = value;
    }
}
Please look stuff like this up on Google first.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论