unity前后台触发

void OnApplicationFocus( bool  isFocus )
{
	if( isFocus )
	{
		Debug.Log("返回到游戏");//回到游戏     
	}
	else
	{
		Debug.Log("离开游戏");//切出游戏
	}
}

unity自动响应方法名对了就行

猜你喜欢

转载自blog.csdn.net/huangzhenxun/article/details/82594680