Advanced: Adaptive Tutorial
Switching tutorial design between devices.
[SerializeField] private TutorialSceneReferences tutorialDesktop;
[SerializeField] private TutorialSceneReferences tutorialMobile;
[SerializeField] private TutorialSceneReferences tutorialGamepad;
private TutorialSceneReferences currentTutorial;
// 假设此函数返回类似 "Desktop"、"Mobile" 或 "Gamepad" 的字符串
private void MethodForDeviceDetection()
{
tutorialDesktop?.TurnOffTutorial();
tutorialMobile?.TurnOffTutorial();
tutorialGamepad?.TurnOffTutorial();
string deviceType = GetDeviceType();
switch (deviceType)
{
case "Desktop":
currentTutorial = tutorialDesktop;
break;
case "Mobile":
currentTutorial = tutorialMobile;
break;
case "Gamepad":
currentTutorial = tutorialGamepad;
break;
default:
Debug.LogError("Device type not recognized!");
break;
}
// 仅在所选教程不为 null 时启用它
currentTutorial?.TurnOnTutorial();
}
// 获取设备类型的示例方法
private string GetDeviceType()
{
if (Input.GetJoystickNames().Length > 0)
return "Gamepad";
if (Application.isMobilePlatform)
return "Mobile";
return "Desktop";
}Last updated