FiE-Game/Assets/Photon Unity Networking/UtilityScripts/OnClickLoadSomething.cs
2023-07-19 18:11:02 +01:00

32 lines
850 B
C#

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
/// <summary>
/// This component makes it easy to switch scenes or open webpages on click.
/// Requires a InputToEvent component on the camera to forward clicks on screen.
/// </summary>
public class OnClickLoadSomething : MonoBehaviour
{
public enum ResourceTypeOption : byte
{
Scene,
Web
}
public ResourceTypeOption ResourceTypeToLoad = ResourceTypeOption.Scene;
public string ResourceToLoad;
public void OnClick()
{
switch (ResourceTypeToLoad)
{
case ResourceTypeOption.Scene:
SceneManager.LoadScene(ResourceToLoad);
break;
case ResourceTypeOption.Web:
Application.OpenURL(ResourceToLoad);
break;
}
}
}