Build project failed

Hi guys,

I am experimenting troubles when trying to package my game (with Blueprints). It failed saying it can’t cast an object to Actor. (see the attached [log Error][1]).

It is a ChildActorComponent, which I “cast” to actor via “Get Child Actor”, and then cast the result as its class.
I do this in the Construction Script (see image).

I never tried to package the game before, but I am doing this kind of thing for some month now in other classes, and I never experiment any trouble running the game within the Editor.

Does someone know how to fix things up ?

Thanks in advance,

Discaulit

You can’t cast ChildActorComponent to Actor. It would fail.

UObjectBase > UObjectBaseUtility > UObject > AActor

UObjectBase > UObjectBaseUtility > UObject > UActorComponent > USceneComponent > UChildActorComponent

Casting explained:

Hi S-ed,

Thanks for your quick answer, but I am not sure you understand what I said or you looked at the linked image. I am pretty aware of ChildActorComponent not being an Actor.

In Blueprints, you have a function/property/node called “ChildActor” from a ChildActorComponent. The output of the “ChildActor” node is an Actor. It allows you to get the Actor which the ChildActorComponent refers.

Then, you can take this Actor and cast it to whatever it really is.

The Blueprint I linked is fully functional. As I said, it works for month within the Editor. So I am not sure your answer and links will help me here, as it is not a “compilation” problem, but really the packaging step which failed.

Maybe I am wrong and don’t understand what you wanted to point me out ?

Sorry.
It was my misunderstanding. Seems it was a bug with ChildActorComponent. Probably it’s related:

Also You may try to copy a variable or move the asset.

123546-screenshot.1485347472.png

I also misused the “cast” word, hoping I was clear enough, but it seems I wasn’t, my bad.

So yeah, I guess it is related as I also experimented the crash discussed in your link. I worked this around by avoiding casts, I don’t remember exactly how, but to make it short I think the solution was the kind of “dirty but it works”.

I will try to find a work around here too, even though I don’t really know how …

I tried to make a copy as you suggested, then reuse the output of the “SET Child Actor Copy” node in the cast, but I have exactly the same error.

Just to laugh a bit with real Casting this time, going through the log output I also found that I have a Warning saying “this class B does not herit from class A, so the cast will always fail” … While my class B DOES herit from class A, and the cast DOES work … (well in this particular case I don’t care because I only use the “Cast Failed” output as I want to avoid this class, but still)

I really don’t understand how packaging works …

I’ll try to keep this subject updated if I found any way to fix this. Otherwise they said in your link that this bug would be fixed in the final 4.15 version so … Maybe I can just wait.
Sadly I would like to have it for this weekend to package the game for an event. Seems it will be run in the Editor if I can’t find a workaround before Friday.

Just for you to know, I can package my game using the UE 4.15 Preview version.

I just can’t manage to select which map I want, but this is another problem …