public override IEnumerator PerformFirstPass()
        {
            iOSHapticFeedback instance = Service.Get <GameObject>().AddComponent <iOSHapticFeedback>();

            Service.Set(instance);
            yield break;
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Instantiate all feedback generators at start.
    /// </summary>
    protected void Awake()
    {
        // Prevent having more than one instance in a scene
        if (_instance)
        {
            Debug.LogWarning("There is already an instance of iOSHapticFeedback.");
            Destroy(gameObject);
            return;
        }

        // The iOSHapticFeedback instance should be persistent between scenes
        DontDestroyOnLoad(gameObject);

        _instance = this;

        // Initiate the feedback generators
        for (int i = 0; i < 5; i++)
        {
            if (FeedbackIdSet(i))
            {
                InstantiateFeedbackGenerator(i);
            }
        }

        feedbackGeneratorsSetUp = true;
    }