Announcement
Collapse
No announcement yet.
Struct, how to get a reference of a struct, not the copy of it. Pointers?
Collapse
X
-
Neongho repliedThanks for the information, i guess i can just go and, instance a whole new struct in the beginning of the function, then assign, with the actual one with a GetStruct, and afterwards go and set it with the NewOne And just, yeah do that... I fear it's a little bad for RAM, and such and processing and so but.... well it doesen't look to be so bad in gameplay. I have 0 idea.
-
UnrealEverything repliedI don't think it's possible like that. Either directly access it (which you indicated you're trying to avoid, yet you're still directly accessing the struct members) or do it the other way around and instead provide SetMyStructMemberX(TypeOfX Value) functions. That way it's ok that you're only getting a copy and in order to actually set the MyStruct members you're again using Set functions instead of direct access.
Leave a comment:
-
Struct, how to get a reference of a struct, not the copy of it. Pointers?
So we have actor.
.................................................. .
Actor has a cool struct called MyStruct.
We make a get function.
Code:Function StructType GetMyStruct (){ return MyStruct; }
Code:self.GetMyStruct().ValueA = 10
gets and sets make code cleaner, than direct accessing.Tags: None
Leave a comment: