Unity-Technologies / uaal-example

Other
733 stars 233 forks source link

[UUM-20370] Update the project to use GameActivity #86

Closed VeryHappyYoung closed 1 year ago

VeryHappyYoung commented 1 year ago

Purpose of this PR

Jira link: https://jira.unity3d.com/browse/UUM-20370

\ The issue:

  1. Before introducing GameActivity for Android in 2023.1, the way you get FrameLayout was updated.

    In 2022.2, UnityPlayer extends FrameLayout.

    Screenshot 2023-06-08 at 18 32 44

    In 2023.1 UnityPlayer doesn't extend FrameLayout. Instead, it offers getFrameLayout() API.

    Screenshot 2023-06-08 at 18 33 52 Screenshot 2023-06-08 at 18 38 11
  2. After introducing GameActivity for Android in 2023.1, Unity project exported using GameActivity entry point fails with the error like below: 

    C:\Projects\uaal-example-master\UnityProject\androidBuild\unityLibrary\src\main\java\com\company\product\OverrideUnityActivity.java:5: error: cannot find symbol
    import com.unity3d.player.UnityPlayerActivity;
                             ^
      symbol:   class UnityPlayerActivity
      location: package com.unity3d.player

\ \ Solution:

  1. Use mUnityPlayer.getFrameLayout() instead of mUnityPlayer
  2. Separate the branch for Activity and use the master branch for GameActivity

\ Note: Make sure that GameActivity is selected and Activity is not selected as the Application Entry Point in Player Settings (Android) when you use the master branch. For Activity, use 23LTS-UnityPlayerActivity branch.

Screenshot 2023-06-12 at 14 15 35