Publishing a game made in Unity to the Play Store in 2022

Up till now, my game was still on the default platform: Windows/Mac OS. In order to turn it into a mobile phone, I need to switch the platform and support mobile input, then publish it to the Play Store. I've actually done it before in this post, but this time I'll add whichever steps I didn't document back then.

Change the platform

So I switched the Platform to Android.

Then I ran my Android Emulator.

Finally I clicked Build and Run, and I got this error message:

The ARM64 option is grayed out. To enable it, you have to switch the Scripting Backend from Mono to IL2CPP.

Switch Scripting Backend to "IL2CPP" to enable ARM64.

Now the ARM64 is checkable.

Finally, it runs in my Emulator.

It runs but Bloom is off, and there are weird artifacts.

Responding to touch events

Since we're on the phone, it should respond to touch events instead of mouse events. But to make it easy to test in Unity, we'll keep the mouse event handling. Using https://docs.unity3d.com/Manual/MobileInput.html, and after refactoring the ray tracing code, we get:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class InputManager : MonoBehaviour
{
  public EventVector3 OnClickEnvironment;
  public LayerMask clickableLayer;
  public GameManager gameManager;

  // Update is called once per frame
  void Update()
  {
    // Ignore inputs if the game is over.
    if (!gameManager.IsGameActive)
    {
      return;
    }

    // Support phone taps.
    foreach (Touch touch in Input.touches)
    {
      if (touch.phase == TouchPhase.Began)
      {
        MaybeGoTo(touch.position);
      }
    }
    // Support mouse clicks.
    if (Input.GetMouseButtonDown(0))
    {
      MaybeGoTo(Input.mousePosition);
    }
  }

  /**
   * position is in screen space.
   */
  void MaybeGoTo(Vector3 position)
  {
    RaycastHit hit;
    if (Physics.Raycast(Camera.main.ScreenPointToRay(position), out hit, 50, clickableLayer.value))
    {
      OnClickEnvironment.Invoke(hit.point);
    }
  }
}

[System.Serializable]
public class EventVector3 : UnityEvent<Vector3> { }

Post-processing is broken

After testing for a bit, I realized that my bloom effect, which made my lampposts shine in the dark, was gone, even when running it in Unity. I haven't searched in detail, but it looks like it's because it depends on the device's ES3 support:

I don't know if it's the actual reason. I'll try on my phone once I reach that stage.

Preparing Play Store assets

Now I can refer back to my previous posts:

It looks like there is a new version of the tool now.

The old version fo the tool links to the new one.
The new version of the tool.

Next, let's make the feature graphic.

Play Store

Now let's head over to the Google Play Console and create the app.

Google Play Console | Google Play Console
Publish and manage your apps and games with the Google Play Console and grow your business on Google Play. Learn about features that help you improve your app’s quality, engage your audience, earn revenue, and more.

Interesting that they have a specific question about being anti Korea.

The rest of the process takes a while but it's pretty painless.

Finally, when I thought I was ready to upload my APK, the Console told me this:

It looks like I should have made Unity create a Bundle instead of an APK.

Now it works fine with a bundle.

I also decided to launch in all countries. Let's hope it still rolls out quickly.

Graphics quality

I noticed that as soon as I switched to the Android platform, things are not as pretty as before. I lost the bloom effect I mentioned earlier, and more than that, I noticed big artifacts on my polygons.

This forum post advises to increase the quality in the Project Settings.

By default, Android builds are in Medium quality.

But now when I build and run, it fails with some vague error:

And I am guessing it's because I should make a development build.

But instead I get this error:

Another look at the logs shows this.

If I uninstall both and Build and Run again, it does install the game correctly. It simply fails to run it. I can run it manually and it works fine.

But the artifacts are still there. After googling a bit more, I found nothing conclusive, but ended up on Unity documentation about rendering pipelines on official sources:

What pipeline am I on though? I have no idea how to find this.

In my lighting settings, I don't seem to have any relevant information.

And in project settings, the Render Pipeline Settings is set to None.

However, comparing Tier settings between the computer and Android, I notice that "Use HDR" is enabled even for the lowest tier of computer settings, but it's disabled even for the highest tier of Android.

By default, HDR is enabled on all tiers on PC.
But it is disabled on all tiers on Mobile.

After enabling HDR for Android, Unity shows the bloom effect again in Play mode:

But it still won't show on the Emulator nor my actual Samsung Galaxy S9+.

After force-enabling HDR for low and medium presets, Bloom finally works on my phone! Also there is no artifact.

It looks like the artifact only happens on the Android Emulator on my Mac with M1.

Bloom works again. The artifacts on the character only happen in the Android Emulator.

While testing all this, I've noticed that I have to uninstall the previous build before I can install a new build.