Beispiel #1
0
    //---------------------------------------------------------
    // Makes a copy of material and U,V settings
    public void CopyMaterialSettings(GUIBase_Widget otherWidget)
    {
        if (otherWidget == null)
        {
            return;
        }
        if (otherWidget.m_Material == null || otherWidget.m_Material.mainTexture == null)
        {
            Debug.LogWarning("GUIBase_Widget.CopyMaterialSettings() :: Invalid source widget '" + otherWidget.GetFullName('.') + "'!!!",
                             otherWidget.gameObject);
            return;
        }

        // setup widget
        m_Material  = otherWidget.m_Material;
        m_InTexPos  = otherWidget.m_InTexPos;
        m_InTexSize = otherWidget.m_InTexSize;
        m_Grid9     = otherWidget.m_Grid9;

        // we don't need to call ChangeMaterial() if there is not any gui renderer assigned yet
        // we can wait until Initialize() call will do so
        if (m_GuiRenderer != null)
        {
            // reassign renderer and material
            ChangeMaterial(m_Material);
        }
    }