Can't find class on android

I’m having an issue when playing my game on android gearVR, the package completes without errors and with some irrelevant warnings (about stuff thats not being used). Im testing a feature which reads a Json file that contains actors described in it and then spawns them. The problem comes in the following process:

  • starts app in android on level ‘X’
  • ends level ‘X’ after conditions are met
  • menu with level selection appears
  • Level selected (when the level is selected, a Uobject gets the correspondent json file and parses it to spawn the actors)
  • after the file is retrieved, A emptylevel is opened and that UObject starts to spawn the actors from the json file
    → This is where the problem occurs, in my test, the level retrieved is the same from before (level ‘X’, so the classes should all be there, since the game already starts with them instantiated) but only 2 classes are found, with the others the function FindObject function returns null.

This process works perfectly on the Editor and I already printed the json parsing results enought to know that it gets the info correctly (all 15 actors are there, but only 2 classes are found).
I also tried saving the class path in the json file to retrieve it using this solution:

but same story, works on editor and not in android.

Any ideas of what could be?

Hey -

Just to make sure I understand correctly, are you saying that the you start in “Level X” then choose a new level (Level Y) but Level X is loaded again instead? Or is the problem that when the next level loads, the actors that populate the level aren’t spawning? Can you clarify what your issue is and provide reproduction steps or a small sample project that shows the problem occurring to help me test the issue locally.

No, sorry if I wasn’t clear. The thing is, I generate a json file with the actors of this level X (it contains the actors class and transform only) because I want to spawn them later in an empty level. I only said that I start at level X in my android build to clarify that those actors from level X were spawned at least once. The problem is that when I go to an empty level (I call an Open Level from game instance) and try to spawn the actors in that json file, Only 2 of them (actualy they are from the same class, which inherited from Character) returns a UClass when I run this:
FindObject(ANY_PACKAGE, ~“CLASS NAME”~);

This works fine on Editor, but not on builds ( just checked and on windows the same thing happens). As I was trying to reproduce this in a new project I noticed that i couldn’t find the class by FindObject before putting one actor of that class in the scene… How can I get a UClass of a actor that wasn’t spawned in the level yet?

OMG, found the problem… I tried using staticLoadClass, but my path had extra apostrophes (like this: “’ path’”)… I think FindObject was not supposed to work anyway in package Right? Since the class was not in memory yet. Now its working =)!