示例#1
0
    public virtual void Init()
    {
        if (m_sprite != null)
        {
            if (!m_sprite.Started)
            {
                m_sprite.Start();
            }

            // Calculate UV dimensions:
            if (!m_sprite.uvsInitialized)
            {
                m_sprite.InitUVs();
                m_sprite.uvsInitialized = true;
            }

            m_sprite.SetBleedCompensation(m_sprite.bleedCompensation);

            // Build vertices:
            if (m_sprite.pixelPerfect)
            {
                if (m_texture != null)
                {
                    m_sprite.SetPixelToUV(m_texture);
                }

                if (m_sprite.renderCamera == null)
                {
                    m_sprite.SetCamera(Camera.main);
                }
                else
                {
                    m_sprite.SetCamera(m_sprite.renderCamera);
                }
            }
            else if (!m_sprite.hideAtStart)
            {
                m_sprite.SetSize(m_sprite.width, m_sprite.height);
            }

            // Set colors:
            m_sprite.SetColor(m_sprite.color);
        }
    }