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++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -