// Copyright (c) 2015 - 2023 Doozy Entertainment. All Rights Reserved. // This code can only be used under the standard Unity Asset Store End User License Agreement // A Copy of the EULA APPENDIX 1 is available at http://unity3d.com/company/legal/as_terms using System; // ReSharper disable MemberCanBePrivate.Global // ReSharper disable ClassNeverInstantiated.Global namespace Doozy.Runtime.Common.Attributes { /// /// Attribute used by the to clear an event, a field or a property on reload /// [AttributeUsage(AttributeTargets.Event | AttributeTargets.Field | AttributeTargets.Property)] public class ClearOnReloadAttribute : Attribute { /// Value set to the target field or property on reload public readonly object ValueOnReload; /// Flag used to create or not a new instance of the target field or property (does not work on events) public readonly bool CreateNewInstance; /// On reload, clear event, field or property public ClearOnReloadAttribute() { ValueOnReload = null; CreateNewInstance = false; } /// On reload, set the given value to a target field or property (does not work for events) /// Value set to target field or property. Value type needs to match the field/property type. Does not work on events. public ClearOnReloadAttribute(object resetValue) { ValueOnReload = resetValue; CreateNewInstance = false; } /// On reload, clear or re-initialize target field or property /// Create a new instance of the target field or property, if TRUE. Does not work on events. public ClearOnReloadAttribute(bool newInstance) { ValueOnReload = null; CreateNewInstance = newInstance; } } }