@@ -110,7 +110,7 @@ public class FirebaseMessagingActivityGenerator : IPreprocessBuildWithReport {
110110" @Override" ,
111111" protected void onCreate(Bundle savedInstanceState) {{" ,
112112" if (mUnityPlayer != null) {{" ,
113- " mUnityPlayer.quit ();" ,
113+ " mUnityPlayer.{1} ();" ,
114114" mUnityPlayer = null;" ,
115115" }}" ,
116116" super.onCreate(savedInstanceState);" ,
@@ -122,6 +122,12 @@ public class FirebaseMessagingActivityGenerator : IPreprocessBuildWithReport {
122122 private readonly string BaseGameActivityClass = "UnityPlayerGameActivity" ;
123123#endif
124124
125+ #if UNITY_2023_1_OR_NEWER
126+ private readonly string UnityPlayerQuitFunction = "destroy" ;
127+ #else
128+ private readonly string UnityPlayerQuitFunction = "quit" ;
129+ #endif
130+
125131 private readonly string GeneratedFileTag = "FirebaseMessagingActivityGenerated" ;
126132 // If this tag is present on the generated file, it will not be replaced.
127133 private readonly string PreserveTag = "FirebasePreserve" ;
@@ -144,7 +150,8 @@ public void OnPreprocessBuild(BuildReport report) {
144150 baseClass = BaseGameActivityClass ;
145151 }
146152#endif
147- string fileContents = System . String . Format ( System . String . Join ( "\n " , ActivityClassContents ) , baseClass ) ;
153+ string fileContents = System . String . Format ( System . String . Join ( "\n " , ActivityClassContents ) ,
154+ baseClass , UnityPlayerQuitFunction ) ;
148155
149156 // Check if the file has already been generated.
150157 string [ ] oldAssetGuids = AssetDatabase . FindAssets ( "l:" + GeneratedFileTag ) ;
0 commit comments