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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -