public virtual void Hide(bool tf) { if (tf) { m_vertices[0] = Vector3.zero; m_vertices[1] = Vector3.zero; m_vertices[2] = Vector3.zero; m_vertices[3] = Vector3.zero; UpdateVerts(); hidden = tf; // Assign after so that UpdateVerts() will run. } else { hidden = tf; if (m_sprite != null) { if (m_sprite.pixelPerfect) { m_sprite.CalcSize(); } else { m_sprite.SetSize(m_sprite.width, m_sprite.height); } } } }
// Use this for initialization void Start() { sprite = gameObject.GetComponent<SpriteRoot>(); #if !UNITY_EDITOR sprite.width = ( sprite.RenderCamera.orthographicSize * sprite.RenderCamera.aspect * 2.0f) * sizeX; sprite.height = sprite.RenderCamera.orthographicSize * 2.0f * sizeY; sprite.CalcSize(); #endif }