指示当前活动的 Java 实例。
注意
using UnityEngine; using UnityEngine.Android;
public class Controller : MonoBehaviour { void Start() { var isRunningGameActivity = AndroidApplication.currentActivity.Call<string>("getLocalClassName").Equals("com.unity3d.player.UnityPlayerGameActivity"); var isRunningActivity = AndroidApplication.currentActivity.Call<string>("getLocalClassName").Equals("com.unity3d.player.UnityPlayerActivity"); Debug.Log($"GameActivity {isRunningGameActivity}"); Debug.Log($"Activity {isRunningActivity}"); } }