public virtual void Init() { if (m_mesh == null) { CreateMesh(); } // Assign to mesh object: m_mesh.Clear(); m_mesh.vertices = m_vertices; m_mesh.uv = m_uvs; m_mesh.colors = m_colors; m_mesh.triangles = m_faces; if (m_sprite != null) { SetWindingOrder(m_sprite.winding); // 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) { if (meshRenderer.sharedMaterial != null) { m_texture = meshRenderer.sharedMaterial.GetTexture("_MainTex"); } } 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); } m_mesh.RecalculateNormals(); m_sprite.SetColor(m_sprite.color); } else if (m_cotrol != null) { SetWindingOrder(m_cotrol.Winding); // Calculate UV dimensions: if (!m_cotrol.uvsInitialized) { m_cotrol.InitUVs(); m_cotrol.uvsInitialized = true; } m_cotrol.SetBleedCompensation(); // Build vertices: if (m_cotrol.pixelPerfect) { if (m_texture == null) { if (meshRenderer.sharedMaterial != null) { m_texture = meshRenderer.sharedMaterial.GetTexture("_MainTex"); } } if (m_texture != null) { m_cotrol.SetPixelToUV(m_texture); } } // else if (!m_cotrol.hideAtStart) // m_cotrol.SetSize(m_cotrol.width, m_cotrol.height); m_mesh.RecalculateNormals(); m_cotrol.color = m_cotrol.m_color; } }