using System; using UnityEngine; namespace UnityEditor.XR.ARSubsystems.InternalBridge { /// /// Extension methods for the UnityEditor.TextureImporter. /// public static class TextureImporterInternals { /// /// Gets the original image dimensions. The texture import settings can affect the resulting /// texture size, for instance: rounding to a power of 2. /// /// The TextureImporter on which to operate. /// The original dimensions of the imported image. /// Thrown if is null. #if UNITY_2021_2_OR_NEWER [Obsolete("Use TextureImporter.GetSourceTextureWidthAndHeight instead.")] #endif 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); } } }