AssetInstanceAttribute Class

Summary

An Weaver.AssetInjectionAttribute which instantiates a copy of the target asset and assigns the copy to the attributed member.
Assembly
Weaver.dll
Namespace
Weaver
Interfaces
  • IInjector
  • IHasCustomMenu
  • WeaverWindow.IItem
Base Types
graph BT Type-->Base0["AssetInjectionAttribute"] click Base0 "/weaver/api/Weaver/AssetInjectionAttribute" Base0-->Base1["InjectionAttribute"] click Base1 "/weaver/api/Weaver/InjectionAttribute" Base1-->Base2["Attribute"] Type-.->Interface0["IInjector"] Type-.->Interface1["IHasCustomMenu"] Type-.->Interface2["WeaverWindow.IItem"] Type["AssetInstanceAttribute"] class Type type-node

Syntax

public sealed class AssetInstanceAttribute : AssetInjectionAttribute, IInjector, IHasCustomMenu, 
    WeaverWindow.IItem

Fields

Name Constant Value Summary
_InspectorTooltip
[Editor-Only] The cached tooltip of this attribute. Should only be read by Weaver.InjectionAttribute.GetInspectorTooltip.
Inherited from InjectionAttribute
_ToString
[Editor-Only] Cached return value of Weaver.InjectionAttribute.ToString.
Inherited from InjectionAttribute

Properties

Name Value Summary
AllAssetInjectors List<AssetInjectionAttribute>
[Editor-Only] A subset of Weaver.Editor.InjectorManager.AllInjectionAttributes containing only asset injectors.
static
AssetType Type
[Editor-Only] The type of asset which will be injected into the attributed Weaver.InjectionAttribute.Member.
DisableAutoFind bool
If true, this attribute will not search for a target asset by name when it is first applied.
DontAssign bool
If set to true: when the instance is created it will not be assigned to the attributed member. This is useful if the instance doesn't need a static access point or if it will assign one itself.
EditorOnly bool
If set to true, this attribute won't be used in builds. Must be set for attributes inside #if UNITY_EDITOR regions since that fact can't be detected automatically.
Inherited from InjectionAttribute
FileName string
If set, this value will be used as the ideal file name when searching for the target asset.
InEditMode bool
[Editor-Only] Returns false. Asset instances should not be created automatically in Edit Mode.
Optional bool
If set to true, this attribute will not give any errors when it is unable to initialize with an appropriate value.
Inherited from InjectionAttribute
ShouldShow bool
[Editor-Only] Indicates whether this attribute should currently be visible in the Weaver.Editor.Window.WeaverWindow.
StartInactive bool
If set to true: the instance will be created with its UnityEngine.GameObject.activeSelf set to false. Only works for UnityEngine.GameObjects and UnityEngine.Components.
Tooltip string
A description of the purpose of the attributed property to be shown in the Unity Editor.
Inherited from InjectionAttribute

Methods

Name Value Summary
AddItemsToMenu(GenericMenu) void
[Editor-Only] Adds various functions for this attribute to the `menu`.
AppendDetail(StringBuilder, bool, string) void
[Editor-Only] Appends an opening bracket or comma depending on `isFirst` followed by the specified `detail` and sets `isFirst` to false. Intended for use within Weaver.InjectionAttribute.AppendDetails(System.Text.StringBuilder,System.Boolean@).
Inherited from InjectionAttribute
AppendDetails(StringBuilder, bool) void
[Editor-Only] Appends any optional properties that have been set on this attribute.
CheckContextMenu() void
[Editor-Only] Calls Weaver.InjectionAttribute.CheckContextMenu(UnityEngine.Rect) with the last UnityEngine.GUILayout rect.
Inherited from InjectionAttribute
CheckContextMenu(Rect) void
[Editor-Only] If the current event is a UnityEngine.EventType.ContextClick inside the `area`, this method builds a menu using Weaver.InjectionAttribute.AddItemsToMenu(UnityEditor.GenericMenu) and shows it.
Inherited from InjectionAttribute
DoAssetField() void
[Editor-Only] Draws an inspector field for the Weaver.AssetInjectionAttribute.Asset.
DoCreateButton() void
[Editor-Only] Draws a button to attempt to create a default asset of the Weaver.AssetInjectionAttribute.AssetType in the procedural asset output directory.
DoFindButton() void
[Editor-Only] Draws a button to attempt to find the target asset using an Weaver.Editor.AssetPathMatcher.
DoInspectorGUI() void
[Editor-Only] Draws the inspector GUI for this attribute.
Equals(Object) bool
[Editor-Only] Uses System.Object.ReferenceEquals(System.Object,System.Object) instead of the default System.Attribute.Equals(System.Object).
Inherited from InjectionAttribute
Get(MemberInfo) AssetInjectionAttribute
[Editor-Only] Returns the Weaver.AssetInjectionAttribute on the specified `member` (if any).
static
GetHashCode() int
[Editor-Only] Returns the hash code for this instance.
Inherited from InjectionAttribute
GetInspectorTooltip() string
[Editor-Only] Builds, caches, and returns a tooltip message for this attribute.
GetMissingValueMessage() string
[Editor-Only] Returns a message indicating that no value has been assigned for this attribute.
GetSourceAsset(Object) Object
[Editor-Only] Returns the original asset that was used to inject the specified `value` (if any).
static
GetTempLabelContent() GUIContent
[Editor-Only] Returns a reusable UnityEngine.GUIContent containing the name, tooltip, and icon of this attribute.
Inherited from InjectionAttribute
GetValue() Object
[Editor-Only] Tries to get the value of the attributed member. Catches and logs any exceptions.
Inherited from InjectionAttribute
GetValueToInject() Object
[Editor-Only] Returns a value to be assigned to the attributed property.
LogThisInvalidAttribute(string) bool
[Editor-Only] Logs a message indicating that this attribute is invalid, followed by a `message` explaining why. Returns false.
Inherited from InjectionAttribute
ManuallyAssignAsset(Object) void
[Editor-Only] Tries to set the Weaver.AssetInjectionAttribute.Asset and records an UnityEditor.Undo state for it.
SetValue(Object) void
[Editor-Only] Tries to set the value of the attributed member. Catches and logs any exceptions.
ToString() string
[Editor-Only] Returns a description of this attribute.
Inherited from InjectionAttribute
TryInitialize() bool
[Editor-Only] Attempts to initialize this attribute and returns true if successful.

Specifically, this method ensures that the Weaver.InjectionAttribute.MemberType inherits from UnityEngine.Object.
TryInitialize(Type) bool
[Editor-Only] Attempts to initialize this attribute and returns true if successful.

Specifically, this method ensures that the Weaver.InjectionAttribute.MemberType inherits from UnityEngine.Object.
ValidateAsset(Object) bool
[Editor-Only] Indicates whether the specified `asset` can be injected into the attributed Weaver.InjectionAttribute.Member by this attribute.

Operators

Name Value Summary
operator !=(InjectionAttribute, Object) bool
Inherited from InjectionAttribute
operator ==(InjectionAttribute, Object) bool
Inherited from InjectionAttribute