I have implemented a Inheritance of UActorComponent, which I attached successfully to an Actor. It has a UFUNCTION, which I want to call from this Actor, but I am not really able to do that. What is to do here?
This is the declaration:
This is how it looks in my Actor:
With context sensitivity, the function won’t even be displayed.
This is my Workaround so far:
Is there a way, that component funtions kind of “become native” to it’s owning actor, without implementing something in all the Actors which own this component?
Thanks in advance!
Short Edit:
Debugged my approach, and it definitly works! So this question is more about a cosmetic preference, I guess?
That seems off. It appears as if it’s treating your “Inventory” as a base UActorComponent, forcing you to cast it to what it actually is. I wish I had the editor up in front of me to test some things but I don’t believe you should have to do this. Could you try adding a different actor component to your BP actor and see if it makes you cast that in order to get access to its native functions? If so then I guess this is just how it is. Otherwise, you might want to look at the declaration of whatever actor component you chose to see if there’s something special there.
Well, yeah, that casting thing is a little bit off, but not what’s really bothering me.
I will test it with other components, but I think this is how Unreal handles this.
What is bothering me, is, that this isn’t kind of “automated” for the blueprint artist.
I just want to search for functions, and get the functions of all my components which then should be displayed as if it were functions from the Actor-Class.
I wouldn’t even mind, if I had to reference the specific component (although it would be cool, if that’s automatic too, of course).
So maybe what I am trying to say, is that it is annoying that I have to turn of “context-sensitivity” for displaying and using methods, that should be native to the actor, even if they belong to a differenct class.
Edit: But yeah, it would be a start if I could drag out the component and will get the functions from it from there. I will look into the casting!
Edit: Yeah, dummy me, declared the Inventory as UActorComponent instead of the specific one. This makes life way easier!