c# - Public variable of struct is not changing -
this question has answer here:
okay, i've got list<specialtile>
called specialtiles
specialtile
struct. 1 of attributes of specialtile
struct public boolean value called active
i'm trying change, doesn't work reason. i'm not sure if it's relevant, list owned instance of class. here's picture when ran through debugger:
so anyway, ran problem because tried use line of code
mgen.specialtiles[esv.editthis].active = !mgen.specialtiles[esv.editthis].active;
but told me "active" not variable. can see won't let me modify value way:
so assumed i'd have modify value through method. apparently doesn't work either?
am missing list variables? , if it's not supposed modify value, why debugger list "active" false , flip true?
thanks!
this issue structs. calling list indexer mgen.specialtiles[x]
returns copy of structure stored in list, method call on struct operate on copy. , since copy temporary, changes made method end being discarded.
if change specialdata
class should resolve issue.
Comments
Post a Comment