getAllActorsOfClass returns empty after packaging project

Hi there!

I’m having some trouble dealing with getAllActorsOfClass after packaging my project. I’ve been setting camera system based on this [tutorial ][1] (it has 4 parts, i followed all of them), and if in PlayInEditor everything works just fine, after packaging project and executing .exe, i has this in log:

LogScript: Warning: Script Msg: Attempted to access index 0 from array ‘CallFunc_GetAllActorsOfClass_OutActors’ of length 0 in ‘/Game/2DSideScrollerBP/Blueprints/2DSideScrollerCharacter.2DSideScrollerCharacter_C:ExecuteUbergraph_2DSideScrollerCharacter’!

How can i fix it and why does it even behave like that? All i need is to have reference on my custom camera actor inside my character as a variable. GetAllActorsOfClass node is in Set Camera Reference function belonging to character.

Tnx

1 Like

It look ok. As long as you are packaging NewWorld or the player, the camera should go also.

Are you packaging for development? Does the cast give an error?

A few things:

  1. You can use GetActorOfClass - then you don’t need the get

  2. No need to cast, it’s already the correct type. That’s why you get the blue note.

  3. It sounds like the camera isn’t getting packaged. Have you tried looking at the BP in the reference viewer, is anything relying on it?

Hi! thanks for answering.

1-2) i am using cast node just because it provides the way to see if cast failed

  1. do you mean this? i haven’t had any deal with reference viwer before. does it seem fine?

yes, it is for development.

the cast gives an error and i can see that since on the screen i have “failed to cast…” from the print string node

so i put the second bp_camera, and after playInEditor it caused red warnings (cause as a copy of bp_camera it has beginplay event and eventtick nodes too, i think). i packaged it, but still in .exe does not work as it should

also one of my friends has this project on his laptop and he has after packaging the same problem.

Tick and begin play shouldn’t matter. I can’t tell from here, I’m afraid…

but thank you for trying! have a good nice day/night c:

Ok, assuming it is just a weird packaging problem and not a BP thing, just try putting a copy of the camera somewhere in the map. You don’t use it, it just gets included in the map, which should force the packaging…

No worries. If you can make a minimal zip file of it, I’ll take a look…

it would be wonderful, how can i send it to you?

First figure out how big the project is, right click on the folder in the explorer and click properties.

Bear in mind you have to upload this somewhere like google docs or dropbox.

If you need to make the project smaller, then make a new project of the same kind and migrate ( right click in content browser ) only the necessary assets to the new project.

Then to zip it up use:

thank you, now you can download it here https://drive.google.com/file/d/1gO8Z5jlOULWWV6JimVRShWQGrSYDzyb8/view?usp=sharing

Well, it’s not making it to the PAK file, that’s all I have so far…

EDIT: No interesting info I’m afraid. I think maybe it’s not putting it in the pak because there’s something up with the blueprint.

I tried making a copy and using ‘replace references’ and it crashes the engine. Which also makes me wonder.

I think your best bet is to make a new actor, and copy the code from BP_CameraGame into it. Set things to use the new one and remove the old one…

Have you been having problems with crashes, or using ‘force delete’ a lot by any chance?

well, no, i haven’t been having any problems with crashes and, as far as i remember, I didn’t ‘force delete’. I will do as you advise then, otherwise I will get rid of the interface or return to the old camera systen. Thx for your help!

so i mad a new actor with the same bp code from into it and set things to use the new one, deleted the old one, now it works fine, but still, i has no idea why it wasn’t working previously.
thanks to ClockworkOcean!

Yes, strange eh? But, like I say, I couldn’t do various things with that old actor ( like replace refs ), which made me suspect something was up :slight_smile: