serratemplar Posted February 23, 2016 Share Posted February 23, 2016 (edited) Hi everybody! I'm new here and new to UE3, and modding in general. Thanks in advance for your time. :smile:For a class I need access to (ones that I can't override and need info from) I've taken to spawning them like this: CharacterGenerator = `XCOMGAME.Spawn( class 'XGCharacterGenerator' ); At first, I was doing this in each function in my own Listener class, and setting up locally scoped vars assuming they'd be garbage collected upon function return. local XGCharacterGenerator CharacterGenerator; I got worried this might result in a memory leak as I wasn't 100% certain how UE3 (or any version of UDK for that matter) handled this stuff; maybe I was actually safe, but upon reading the doc page for Spawn, I found myself more convinced I should do a manual cleanup, by making one class-wide scoped var, removing all the locals, then putting Destroy calls in my Listener class's OnRemoved function, thus: event OnRemoved(UIScreen Screen) { CharacterGenerator.Destroy(); RandomFirstnameButton.Destroy(); RandomNicknameButton.Destroy(); RandomLastnameButton.Destroy(); RandomCountryButton.Destroy(); } Is this correct? Should I in fact be viewing Spawn the same way I view C++'s new operator? Or is that approach confusing me? EDITS. Clarifications. Edited February 23, 2016 by serratemplar Link to comment Share on other sites More sharing options...
Recommended Posts