I wanted to share the experience of trying to test AR on Unreal 4.
That one’s a negative, I thought it might be a good idea to bring up some things unity got right.
- Trying to launch AR template results in nothing happening. The template is there, but doesn’t build. Trying to build the template results in a redirect to… a 404 page in unreal documentation. Apparently there was a quickstart page for Android, but it wasn’t updated for 4.27 and displays 404. The actors in editor are helpfully called “Documentation actors”
- Investigation revealed that Unreal 4 (unlike unity) does not come with packaged android sdk/jdk/ndk, and those need to be installed manually. I try installing android studio.
- The engine does not detect android studio. Android device is not detected as deploy target. Turns out that I also need to run a bat file within the engine directory. ("Engine\Extras\Android\SetupAndroid.bat ")
- Running SetupAndroid.bat fails! It can’t find the installation directory of sdk (custom location says hi). Online sources suggest to modify the bat by hand.
- The bat file tries to run sdkmanager.bat from android. The file, when launched, prints a java exception with a stack trace. (Ha). Investigation of online sources suggest that I need to install OpenJDK 8. Supposedly manual modification of bat file is necessary.
- It does nothing.
- And the suggestion turns out to be incorrect. Apparently it is necessary to install command line tools for android, because all the OpenJDK 8 thing is old news, and sdk actually comes with OpenJDK 11 now.
- Of course SetupAndroid can’t find the new tools, and needs to be modified by hand.
- It finally works! SetupAndroid.bat, that is.
- But the engine still doesn’t see Android SDK.
- I try to specify the sdk location by hand.
- Lo and Behold, now I can see the device I’m using in SDK manager.
- Except that I still can’t deploy onto it. It does not appear in “launch” option.
- Found out that trying to launch requires using “Launch Manager”. Build process starts and…
- And it fails. Of course. “ERROR: Platform Android is not a valid platform to build. Check that the SDK is installed properly.” No other details anywhere.
- I try to use “Package project for android”.
- The engine helpfully opens 404 page in unreal documentation when I attempt to do so . No other error messages. No other information.
- Lots of confused people online with the same problem and no answer. Some suggest deleting “build” folders that does nothing.
- After trial and error, turns out ndk path should be set to a specific ndk folder, and not the root with all ndks.
- It builds now!
- The build fails. Of course. “Installed Build Tools revision 31.0.0 is corrupted”
- Online sources suggest reinstallation of build tools.
- That doesn’t work.
- Online sources suggest that iti s because a file called d8.bat should actually be called dx.bat. And that should be renamed. People online wonder why the heck they should be renaming files by hand in 2021.
- That doesn’t work either.
- Random youtube video suggest downgrading build tools from 31.0.0 to 30.x.x.
- It now builds!
- Google play protect (that never interfered with unity deploy) warns that the package is for old android and shouldn’t be installed. Pressing “Install anyway”
- After the initial deploy the app seemingly freezes on Unreal splash screen.
- I kill the app, redeploy…
- It boots up to the UI! However, AR doesn’t work. Pressing “begin scanning” button does nothing. No error messages.
- I poke around the configuration change things, and it finally startsd working somehow.
- “Feels faster than on unity”.
- Trying to bring in the model to unreal.
- Unreal fails to find any textures. It did import base color, though. Very helpful, thanks.
- No obvious equivalent of AssetPostProcessor. No response online regarding it either. So, configuration by hand it is.
- I realize that the static mesh model has been exploded into individual components. Thanks, but, I uh, really needed that hierarchy?
- Hierarchy can be created by “Import into Scene” and only this way will create a blueprint from fbx (why).
- But it doesn’t let me import materials as material instances. (I really need the instances, thanks?)
- Searching how to create instances from existing materials results in “Can’t be done”.
- Which is a lie.
- To replace material with instance both needs to be selected, and then you need to do “REplace references”. That works.
- Yay to configurating 20 materials by hand.
- The window for selecting texture is too small to fit entire texture name.
- It finally functions!
- Except that I can’t move imported hierarchy by its root node. For some reason.
Now, compare that to using ARFoundation in unity.