✅ A problem with field.
I have an abstract
Entity
class. This class has "Position" field.
I also have a Player
class, that inherits from Entity
. Position
in Player
sets to an certain value (let's say 1, 1) every frame. But for some reason, if I'll try to access entity's position it'll only return the position that set through the constructor, no matter what I do. (it's 0, 0) figuratively speaking, how can I make it return 1, 1?8 Replies
first fact is it's not a field but a property, a struct property
can you debug this line by line to look that the correct values are going through there?
when you say 'no matter what you do', have you tried making a new Player, immediately settings its position and then reading it back out?
i say that because my first intuition is that this is an ordering issue where you're trying to read your property before it's set.
1. Yeah, sorry about that;
2. Not sure what you exactly mean by "correct values are going through there". The only debug I've made was this, and I honestly have no idea what else I can do
that or you're getting confused with references somewhere and reading from different entities than you're updating
You mean this?
Yes
If you have no further questions, please use /close to mark the forum thread as answered