Added Feel plugin
This commit is contained in:
58
Assets/External/Feel/MMTools/Accessories/MMInput/MMAutoInputModule.cs
vendored
Normal file
58
Assets/External/Feel/MMTools/Accessories/MMInput/MMAutoInputModule.cs
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
#if MM_UI
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
|
||||
using UnityEngine.InputSystem.UI;
|
||||
#endif
|
||||
|
||||
namespace MoreMountains.Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// This helper class handles adding the appropriate input module depending on whether the project is using the old or new input system
|
||||
/// </summary>
|
||||
public class MMAutoInputModule : MonoBehaviour
|
||||
{
|
||||
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
|
||||
protected InputSystemUIInputModule _module;
|
||||
#endif
|
||||
|
||||
protected GameObject _eventSystemGameObject;
|
||||
|
||||
/// <summary>
|
||||
/// On Awake, we initialize the input module
|
||||
/// </summary>
|
||||
protected virtual void Awake()
|
||||
{
|
||||
StartCoroutine(InitializeInputModule());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// We add the appropriate input module
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected virtual IEnumerator InitializeInputModule()
|
||||
{
|
||||
EventSystem eventSystem = Object.FindAnyObjectByType<EventSystem>();
|
||||
|
||||
if (eventSystem == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
|
||||
_eventSystemGameObject = eventSystem.gameObject;
|
||||
_module = eventSystem.gameObject.AddComponent<InputSystemUIInputModule>();
|
||||
// thanks new input system.
|
||||
yield return null;
|
||||
_module.enabled = false;
|
||||
yield return null;
|
||||
_module.enabled = true;
|
||||
#else
|
||||
eventSystem.gameObject.AddComponent<StandaloneInputModule>();
|
||||
#endif
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
18
Assets/External/Feel/MMTools/Accessories/MMInput/MMAutoInputModule.cs.meta
vendored
Normal file
18
Assets/External/Feel/MMTools/Accessories/MMInput/MMAutoInputModule.cs.meta
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c82cf35166701394ab910f41269944f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 183370
|
||||
packageName: Feel
|
||||
packageVersion: 5.9.1
|
||||
assetPath: Assets/Feel/MMTools/Accessories/MMInput/MMAutoInputModule.cs
|
||||
uploadId: 830868
|
||||
Reference in New Issue
Block a user