Rama
(Rama)
March 26, 2016, 7:55pm
1
Dear Community,
I’ve just released a new wiki that shows you how you can count references to any AActor/UObject yourself!
You can also get an Object list of exactly who is referring to your UObject!
The code is quite simple, and I am using built-in runtime engine tools.
Garbage Collection ~ Count References to Any Object
After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
Reading time: 1 mins 🕑
Likes: 8 ❤
Enjoy!
Rama
Sample output:
TArray<UObject*> Referencers;
GetObjReferenceCount(this,&Referencers);
for(UObject* Each : Referencers)
{
if(Each)
{
UE_LOG(YourLog,Warning,TEXT("%s"), *Each->GetName());
}
}
Grogger
(Grogger)
March 28, 2016, 6:54pm
3
Thanks Rama, this should come in handy!
I noticed the return value in your example should probably be “ReferredToObjects.Num()” instead of the array pointer.
Rama
(Rama)
March 28, 2016, 9:43pm
4
Thanks Rama, this should come in handy!
I noticed the return value in your example should probably be “ReferredToObjects.Num()” instead of the array pointer.
I changed the name in the code at one point and must have not added that, but it is correct now on the wiki, so all is well
I hope you are having fun today!
Hee hee!
Rama
Andy_rst
(Andy_rst)
March 28, 2016, 9:55pm
5
Thanks Rama! Great stuff!
Thanks again, Rama! This is very useful information.
xCANAdan
(xCANAdan)
May 26, 2023, 5:35am
7
hey, would it be possible to get an update of this code, with the wiki being shut down and all that?
im getting some really odd issues with GC and something like this would be extremely helpful for telling me what references arnt being resolved.
kato4000
(kato4000)
October 31, 2023, 1:54pm
8
1 Like