x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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).

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). BlueprintConstScript

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

Product Version: UE 4.14
Tags:
more ▼

asked Jan 25 '17 at 10:31 AM in Packaging & Deployment

avatar image

Discaulit
6 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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

UObjectBase > UObjectBaseUtility > UObject > AActor

UObjectBase > UObjectBaseUtility > UObject > UActorComponent > USceneComponent > UChildActorComponent

Casting explained: https://forums.unrealengine.com/showthread.php?1684-Casting-explained&p=9983&viewfull=1#post9983

more ▼

answered Jan 25 '17 at 10:51 AM

avatar image

S-ed
1.1k 23 18 36

avatar image Discaulit Jan 25 '17 at 11:03 AM

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 ?

avatar image S-ed Jan 25 '17 at 12:28 PM

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

https://answers.unrealengine.com/questions/528455/child-actor-component-keeps-corrupting-its-parent.html

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

avatar image Discaulit Jan 25 '17 at 01:09 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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 ...

more ▼

answered Jan 27 '17 at 08:10 AM

avatar image

Discaulit
6 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question