Using non-variable in file path -


i want make file path changeable user. far can tell has static in order so. here got.

private string texturepath; more code... public string gettexturepath() { return (string)texturepath; }  public void onupdate() { super.onupdate(); this.texture = "/adventure/" + this.gettexturepath() + ".png"; } 

there multiple objects, , when using static variable changed of theirs same, without being able change them individuality.

you need send parameter method.

public void onupdate(string path){     super.onupdate();     this.texture = path + this.gettexturepath() + ".png"; } 

static vars belong class, not instances.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -