Protect references from garbage collection

Rider (for UE) shows a warning for the references this exercise adds to the header file: ‘Object member … can be garbage collected at any time’. If I understand correctly, the way to protect against possible garbage collection is to use the UPROPERTY macro. We don’t want to expose these references to the editor (give that we’re setting them in code), so it seems using the plain macro (not using arguments) is best here. If I’m wrong/ missing something, please someone let me know :slight_smile:

Yes, you can use just the UPROPERTY() without any qualifiers. This will tell the GC that it shouldn’t be recycled unless nothing is pointing to it.

1 Like

How is Ryder for Unreal, btw? I use ReSharper in Visual Studio Community (which rocks for C#, but is causing my C++ projects to run out of memory). Thinking I may spring the extra $2.00 a month to change to Ryder if it’s robust.

1 Like

I like it, but given that I’m new to C++ I don’t have much to compare it with (other than the little bit of time I spent with VS/ VS Code, which both seemed to work ok). In the past I’ve used IntelliJ for Java, and found that it was way better than the other editors out there, and given that this is an edition specialized on UE, I sort of assumed it’d be good. It’s in preview (for free) here https://www.jetbrains.com/lp/rider-unreal. If it works well, I wouldn’t mind spending some money on it once it comes out of preview.

Privacy & Terms