Advanced: Adaptive Tutorial
Switching tutorial design between devices.
[SerializeField] private TutorialSceneReferences tutorialDesktop;
[SerializeField] private TutorialSceneReferences tutorialMobile;
[SerializeField] private TutorialSceneReferences tutorialGamepad;
private TutorialSceneReferences currentTutorial;
// Assuming this returns a string like "Desktop", "Mobile", or "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;
}
// Turn on the selected tutorial only if it's not null
currentTutorial?.TurnOnTutorial();
}
// Example method to get device type
private string GetDeviceType()
{
if (Input.GetJoystickNames().Length > 0)
return "Gamepad";
if (Application.isMobilePlatform)
return "Mobile";
return "Desktop";
}Last updated