"Cast to" Failed ("Object" to child of "Object)

The input object is valid and has the same name, but casting fails.
“TestItemComponent” is a child of “Object”

334737-screenshot-2.png

You can do casts only to your parent or child BPs, so this setup wont work. Furthermore i suggest you forget about casting everytime you want to access some actor at runtime, especially on loops, because it lacks perfomance.
If you want to execute some function or event and you need to confirm that this particular actor can make it (for what you are using cast node i guess), you should just use interfaces. With them you dont need to cast everytime and they are more flexible than regular functions and events for some sort of things.

Also you can get fail-casts because youre trying to cast from an actor you already know. Lets say, you have a variable of “Actor1” and you try to cast them again to “Actor1”. And thats not what you need, since you can do whatever you want already.

If you’re trying to cast from a child actor component, you have to grab the child actor first:

334757-screenshot-2.jpg

maybe you have a bad initialize for your Array. for better init it’s better to clear your array to reduce the problem.

For Example this:

Thank you!
The problem is not in the initialization of the array, but in the initialization of the object.
Object has no spawn node, i thought it will initialize automatically.
I had to use construct node.

I guess I shouldn’t be using Object. Now i can’t get the type of the object.
I cannot find the GetType function, GetClass returns “Blueprint”.

I’m glad I was able to help you. Please confirm the answer if you get it to remove it from the unanswered questions, and give it a vote if you like.