using System; namespace UnityEngine.Rendering { /// /// Attribute specifying information to reload with . This is only /// used in the editor and doesn't have any effect at runtime. /// /// /// [AttributeUsage(AttributeTargets.Field)] public sealed class ReloadAttribute : Attribute { /// /// Lookup method for a resource. /// public enum Package { /// /// Used for builtin resources when the resource isn't part of the package (i.e. builtin /// shaders). /// Builtin, /// /// Used for resources inside the package. /// Root, /// /// Used for builtin extra resources when the resource isn't part of the package (i.e. builtin /// extra Sprite). /// BuiltinExtra, }; #if UNITY_EDITOR /// /// The lookup method. /// public readonly Package package; /// /// Search paths. /// public readonly string[] paths; #endif /// /// Creates a new for an array by specifying each resource /// path individually. /// /// Search paths /// The lookup method public ReloadAttribute(string[] paths, Package package = Package.Root) { #if UNITY_EDITOR this.paths = paths; this.package = package; #endif } /// /// Creates a new for a single resource. /// /// Search path /// The lookup method public ReloadAttribute(string path, Package package = Package.Root) : this(new[] { path }, package) { } /// /// Creates a new for an array using automatic path name /// numbering. /// /// The format used for the path /// The array start index (inclusive) /// The array end index (exclusive) /// The lookup method public ReloadAttribute(string pathFormat, int rangeMin, int rangeMax, Package package = Package.Root) { #if UNITY_EDITOR this.package = package; paths = new string[rangeMax - rangeMin]; for (int index = rangeMin, i = 0; index < rangeMax; ++index, ++i) paths[i] = string.Format(pathFormat, index); #endif } } }