C
C#3mo ago
jupiter.ryo

✅ 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?
No description
No description
8 Replies
jupiter.ryo
jupiter.ryoOP3mo ago
No description
Omnissiah
Omnissiah3mo ago
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?
Becquerel
Becquerel3mo ago
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.
jupiter.ryo
jupiter.ryoOP3mo ago
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
No description
No description
No description
Becquerel
Becquerel3mo ago
that or you're getting confused with references somewhere and reading from different entities than you're updating
jupiter.ryo
jupiter.ryoOP3mo ago
You mean this?
No description
Kouhai
Kouhai3mo ago
Yes
MODiX
MODiX3mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server