public void Initialize()
    {
        m_HasBeenInitialized = true;

        AwesomiumUnityWebCore.EnsureInitialized();

        // Call resize which will create a texture and a webview for us if they do not exist yet at this point.
        Resize(m_Width, m_Height);

        if (guiTexture)
        {
            guiTexture.texture = m_Texture;
        }
        else if (renderer && renderer.material)
        {
            renderer.material.mainTexture      = m_Texture;
            renderer.material.mainTextureScale = new Vector2(Mathf.Abs(renderer.material.mainTextureScale.x) * (m_FlipX ? -1.0f : 1.0f),
                                                             Mathf.Abs(renderer.material.mainTextureScale.y) * (m_FlipY ? -1.0f : 1.0f));
        }
        else
        {
            Debug.LogWarning("There is no Renderer or guiTexture attached to this GameObject! AwesomiumUnityWebTexture will render to a texture but it will not be visible.");
        }

        m_WebView.SetTransparent(m_Transparent);
    }
Exemplo n.º 2
0
    public void Initialize()
    {
        m_HasBeenInitialized = true;

        if (!m_Is_KeyCodeList_Initialized)
        {
            InitializeKeyLists();
            m_Is_KeyCodeList_Initialized = true;
        }

        AwesomiumUnityWebCore.EnsureInitialized();

        // Call resize which will create a texture and a webview for us if they do not exist yet at this point.
        Resize(m_Width, m_Height);

        m_RawImage = GetComponent <RawImage>();
        if (m_RawImage)
        {
            m_RawImage.texture = m_Texture;
        }
        else
        {
            Debug.LogWarning("There is no RawImage attached to this GameObject! AwesomiumUnityWebTextureUGUI will add RawImage component in order to render to a VISIBLE texture.");
            m_RawImage         = gameObject.AddComponent <RawImage>();
            m_RawImage.texture = m_Texture;
        }

        m_WebView.SetTransparent(m_Transparent);
    }
    /*void OnEnable()
     * {
     #if UNITY_EDITOR
     *      EditorApplication.playmodeStateChanged += StateChange;
     #endif
     * }
     *
     #if UNITY_EDITOR
     * void StateChange()
     * {
     *      if (EditorApplication.isPlayingOrWillChangePlaymode && EditorApplication.isPlaying) {
     *
     *                      }
     *
     * }
     #endif
     *
     *
     * void OnDisable()
     * {
     #if UNITY_EDITOR
     *      EditorApplication.playmodeStateChanged -= StateChange;
     #endif
     * }*/

    void Awake()
    {
        if (m_Instance != null)
        {
            Debug.LogError("An instance of AwesomiumUnityWebCoreHelper already exists!");
            DestroyImmediate(this);
        }

        m_Instance = this;
        AwesomiumUnityWebCore.EnsureInitialized();
        DontDestroyOnLoad(this.gameObject);
    }