Is there a way to find which actors have a specific component attached?
I tried right-clicking the component, then Reference Viewer, but that doesn’t seem to be what I’m looking for.
IF you want the components of an actor try AActor::GetComponents,
You can use it like GetComponents(TArrayYou’rePopulating)… then cycle through the components looking for the detailed one you want with a for loop, unless you just want all of them of that type. so like if you had a spider, and they had eight legs, GetComponents<Legs>(SpiderLegsOfBigTarantula)
. Also the Array you pass in is an out component, so it will be populated with any results, could still be null though.
[edit] Also found this a bit further down in the Unreal Course discord today:
FindComponentsByClass()
shiver… I had to mention spiders…
Hi myrhillion, thanks so much for the help :).
Is there a way through the UE4 Editor (I’m sure there must be a way to do this in c++ too) to list all Actors that a component is connected to? But specifically doing this in the editor.
This could help in the process of deleting a component as in the course video.
So if you wanted to quickly remove the component from any parent actors in a project, before deleting the component itself.
Yes there is. Add this line to your code -
UE_LOG(LogTemp, Warning, TEXT("%s"), *GetOwner())
And click play and open up the output log. The names that apper in there are the ones that have the component attached to them.
Missing ->GetName()
Oops! My programming is getting worse by the day by doing nothing at home…
That’s great, thanks so much everyone