public static Vector2Int GetSourceTextureDimensions(TextureImporter textureImporter) { if (textureImporter == null) { throw new ArgumentNullException(nameof(textureImporter)); } int width = 0; int height = 0; textureImporter.GetWidthAndHeight(ref width, ref height); return(new Vector2Int(width, height)); }
public void Load(SerializedObject so) { TextureImporter textureImporter = so.targetObject as TextureImporter; Texture texture = AssetDatabase.LoadAssetAtPath <Texture>(textureImporter.assetPath); base.name = texture.name; base.alignment = (SpriteAlignment)so.FindProperty("m_Alignment").intValue; base.border = textureImporter.spriteBorder; base.pivot = SpriteEditorUtility.GetPivotValue(base.alignment, textureImporter.spritePivot); this.tessellationDetail = so.FindProperty("m_SpriteTessellationDetail").floatValue; int num = 0; int num2 = 0; textureImporter.GetWidthAndHeight(ref num, ref num2); base.rect = new Rect(0f, 0f, (float)num, (float)num2); SerializedProperty serializedProperty = so.FindProperty("m_SpriteSheet.m_SpriteID"); base.spriteID = new GUID(serializedProperty.stringValue); }
public void GetWidthAndHeight(ref int width, ref int height) { m_TextureImporter.GetWidthAndHeight(ref width, ref height); }