using System.Collections; using System.Collections.Generic; using UnityEngine; public class InputProviderManager : MonoBehaviour { private static InputProviderManager instance; private BaseInputProvider currentInputProvider; private void Awake() { if (instance == null) instance = this; else Destroy(this.gameObject); // check the current platform and determine which Provider to use currentInputProvider = Application.isMobilePlatform ? gameObject.GetComponentInChildren() : gameObject.GetComponentInChildren(); // disable all InputProviders BaseInputProvider[] inputProviders = GetComponentsInChildren(); foreach (BaseInputProvider inputProvider in inputProviders) inputProvider.Disable(); currentInputProvider.Enable(); } public static InputProviderManager getInstance() { return instance; } public BaseInputProvider getCurrentInputProvider() { return currentInputProvider; } }