Hello!
Please I need a hand to understand what I am doing wrong and how to do this because I didn’t get it even reading other posts and watching some related videos.
I have an actor BP that is an elevator and it has another actor called Puerta (Door) as a component. I have been trying to access to that component from outside the BP using an interface but unsuccessfully. I can’t get to cast it.
I keep receiving a message saying: ‘BP Puerta Ascensor Ch’ does not inherit from ‘Scene Component’ ( Cast To BP_PuertaAscensorCh would always fail).
I’ve also tried the ‘Get Child Actor’ as I read in other posts but at that instance I don’t have that node available.
Could you please share a snapshot of the Blueprint Editor with Puerta selected? and in the details panel , make it show the Class and Template part of the details.
You should be able to Cast that ChildActor to Puerta if everything in the template bit is correct.
Sure, here is
The only weird thing I see there is the “-1” at the end of the template name but it doesn’t seem to be relevant. Could that be the reason why the cast to fails?
Maybe I need to destroy the actor and make it again from scratch
My comparison is not strict equaly and the blueprint is not placed in the constructor event but a custom event in the BP interface because I must handle it from outside the parent.
I am calling the event from a widget embedded in an object on the wall (the elevator call button called ‘ControlAscensorPB’ on the ground floor, 1st floor, etc.). And everything works perfect but that cast… honestly I am lost with this issue
As you said, it shoud work… but not. Cast fails all the time. No access to the child.
Ok I just printscreened the object and class… and the editor keeps adding weird thigs to the end. A “2021” in the name of the object and a “_C” in the class name I swear I didn’t add anything of that to the names. WTF is doing this editor? lol
So there is no way to use actors as components? Should I put all actors directly to the maps?
If no choice then it would be a shame because I wanted to make a reusable full functional actor for all my maps. I’m an old school programmer so I like to reuse my classes haha. I expected this to be simpler.
Thanks anyway for the quick replies and all the help you are giving to me RecourseDesign, much appreciated sir!!
Maybe another way to do it is to create a function in Ascensor that you call from the Interface, that function could then directly use the ChildActor component (drag onto your blueprint) and call GetChild() then cast from there?
Ok I did it as you suggested, I created an event in the actor ‘Ascensor’ and I handle the components from inside when I call it. And touché! At least now the cast works well when I push the button playing on the host (it’s a multiplayer game) but fails on the client. This could be probably caused by a replication wrongly set but it’s a big advance!!