Esempio n. 1
0
    /// <summary>
    ///
    /// </summary>
    void OnFocus()
    {
        // if application is not playing, find a vp_Input instance in resources
        GameObject go = Resources.Load("Input/vp_Input") as GameObject;

        // if not found create it
        if (go == null)
        {
#if UNITY_EDITOR
            vp_Input.CreateMissingInputPrefab(vp_Input.PrefabPath, vp_Input.FolderPath);
            go = Resources.Load("Input/vp_Input") as GameObject;
#endif
            if (go == null)
            {
                Debug.LogError("Error (" + this + ") Failed to create input manager.");
                return;
            }
        }

        m_Component = go.GetComponent <vp_Input>();
        if (m_Component == null)
        {
            m_Component = go.AddComponent <vp_Input>();
        }

        m_Component.SetupDefaults();

        m_Component.SetDirty(true);
    }
    void OnFocus()
    {
        // if application is not playing, find a vp_Input instance in resources
        GameObject go = Resources.Load("Input/vp_Input") as GameObject;

        // if not found create it
        if (go == null)
        {
            vp_Input.CreateIfNoExist();
            go = Resources.Load("Input/vp_Input") as GameObject;
        }

        m_Component = go.GetComponent <vp_Input>();
        if (m_Component == null)
        {
            m_Component = go.AddComponent <vp_Input>();
        }

        m_Component.SetupDefaults();

        m_Component.SetDirty(true);
    }