AssetPoolAttribute Class

Summary

An Weaver.AssetInjectionAttribute which assigns an Weaver.ObjectPool`1 to the attributed member that creates new items by instantiating copies of the target asset.
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["AssetPoolAttribute"] class Type type-node

Syntax

public sealed class AssetPoolAttribute : 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.
DontGetSharedPool bool
By default, the injected pool will be shared with any other pools using the target asset. Setting this to true disables that behaviour.
DontReleaseOnSceneLoad bool
By default, the injected pool will automatically release all active items when a scene is loaded. Setting this to true disables that behaviour.
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. Pools could potentially be injected in Edit Mode, but the instances would need to be destroyed manually and their ownership would be unclear.
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
PreAllocate int
The injected pool immediately creates this many items.
ShouldShow bool
[Editor-Only] Indicates whether this attribute should currently be visible in the Weaver.Editor.Window.WeaverWindow.
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 Weaver.ObjectPool`1 and isn't abstract.
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