diff --git a/.github/workflows/publish-docfx.yml b/.github/workflows/publish-docfx.yml new file mode 100644 index 0000000..cfa2785 --- /dev/null +++ b/.github/workflows/publish-docfx.yml @@ -0,0 +1,54 @@ +name: Publish DocFX + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Setup Dotnet + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + + - name: Setup DocFx + run: dotnet tool update -g docfx + + - name: Dotnet Restore + run: dotnet tool restore + + - name: Build + run: docfx docs/docfx.json + + - name: Upload artifacts + uses: actions/upload-pages-artifact@v2 + with: + path: docs/_site + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..57ba112 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,3 @@ +.cache +/**/_site/ +*.DS_Store \ No newline at end of file diff --git a/docs/api/.gitignore b/docs/api/.gitignore new file mode 100644 index 0000000..1be8a67 --- /dev/null +++ b/docs/api/.gitignore @@ -0,0 +1,3 @@ +# temp file +*.yml +.manifest \ No newline at end of file diff --git a/docs/articles/en/about.md b/docs/articles/en/about.md new file mode 100644 index 0000000..5d6e05e --- /dev/null +++ b/docs/articles/en/about.md @@ -0,0 +1,9 @@ +# Alchemy Overview + +![header](../../images/header.png) + +Alchemy is a library that provides a rich set of editor extensions for Unity. By integrating Alchemy, over 30 attributes are added to easily extend the Inspector. Additionally, by utilizing the Unity.Serialization package and a dedicated Source Generator, it becomes possible to serialize and edit types not normally serializable in Unity (`Dictionary`, `HashSet`, `Nullable`, `ValueTuple`, etc.) directly from the Inspector. + +![img](../../images/img-v2.0.png) + +Furthermore, version 2.0 introduces new features such as EditorWindow extensions and Hierarchy extensions. These enable the easy creation of tools to streamline the development workflow within the editor. \ No newline at end of file diff --git a/docs/articles/en/alchemy-editor-window.md b/docs/articles/en/alchemy-editor-window.md new file mode 100644 index 0000000..4d19904 --- /dev/null +++ b/docs/articles/en/alchemy-editor-window.md @@ -0,0 +1,53 @@ +# AlchemyEditorWindow + +By inheriting from `AlchemyEditorWindow` instead of `EditorWindow`, you can create editor windows using Alchemy attributes. + +```cs +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; +using Alchemy.Editor; +using Alchemy.Inspector; + +public class EditorWindowExample : AlchemyEditorWindow +{ + [MenuItem("Window/Example")] + static void Open() + { + var window = GetWindow("Example"); + window.Show(); + } + + [Serializable] + [HorizontalGroup] + public class DatabaseItem + { + [LabelWidth(30f)] + public float foo; + + [LabelWidth(30f)] + public Vector3 bar; + + [LabelWidth(30f)] + public GameObject baz; + } + + [ListViewSettings(ShowAlternatingRowBackgrounds = AlternatingRowBackground.All, ShowFoldoutHeader = false)] + public List items; + + [Button, HorizontalGroup] + public void Button1() { } + + [Button, HorizontalGroup] + public void Button2() { } + + [Button, HorizontalGroup] + public void Button3() { } +} +``` + +![img](../../images/img-editor-window.png) + +Data from windows created by inheriting `AlchemyEditorWindow` is saved in JSON format in the ProjectSettings folder of the project. For more details, refer to the [Saving Editor Window Data](saving-editor-window-data.md) page. \ No newline at end of file diff --git a/docs/articles/en/alchemy-serialization-process.md b/docs/articles/en/alchemy-serialization-process.md new file mode 100644 index 0000000..ce57dee --- /dev/null +++ b/docs/articles/en/alchemy-serialization-process.md @@ -0,0 +1,80 @@ +# Alchemy Serialization Process + +In Alchemy, by adding the `[AlchemySerialize]` attribute to the target type, a dedicated Source Generator automatically implements `ISerializationCallbackReceiver`. Within this process, all fields annotated with `[AlchemySerializeField]` are gathered, and using the Unity.Serialization package, they are converted to JSON format. However, fields of type `UnityEngine.Object` cannot be handled in JSON format, so their instances are saved in a single list, and only their indices are written to JSON. + +For example, consider the following class: + +```cs +using System; +using System.Collections.Generic; +using UnityEngine; +using Alchemy.Serialization; + +[AlchemySerialize] +public partial class AlchemySerializationExample : MonoBehaviour +{ + [AlchemySerializeField, NonSerialized] + public Dictionary dictionary = new(); +} +``` + +Alchemy generates code similar to the following: + +```cs +partial class AlchemySerializationExample : global::UnityEngine.ISerializationCallbackReceiver +{ + [global::System.Serializable] + sealed class AlchemySerializationData + { + [global::System.Serializable] + public sealed class Item + { + [global::UnityEngine.HideInInspector] public bool isCreated; + [global::UnityEngine.TextArea] public string data; + } + + public Item dictionary = new(); + + [global::UnityEngine.SerializeField] private global::System.Collections.Generic.List unityObjectReferences = new(); + + public global::System.Collections.Generic.IList UnityObjectReferences => unityObjectReferences; + } + + [global::UnityEngine.HideInInspector, global::UnityEngine.SerializeField] private AlchemySerializationData alchemySerializationData = new(); + + void global::UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize() + { + if (this is global::Alchemy.Serialization.IAlchemySerializationCallbackReceiver receiver) receiver.OnBeforeSerialize(); + alchemySerializationData.UnityObjectReferences.Clear(); + + try + { + alchemySerializationData.dictionary.data = global::Alchemy.Serialization.Internal.SerializationHelper.ToJson(this.dictionary , alchemySerializationData.UnityObjectReferences); + alchemySerializationData.dictionary.isCreated = true; + } + catch (global::System.Exception ex) + { + global::UnityEngine.Debug.LogException(ex); + } + } + + void global::UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() + { + try + { + if (alchemySerializationData.dictionary.isCreated) + { + this.dictionary = global::Alchemy.Serialization.Internal.SerializationHelper.FromJson>(alchemySerializationData.dictionary.data, alchemySerializationData.UnityObjectReferences); + } + } + catch (global::System.Exception ex) + { + global::UnityEngine.Debug.LogException(ex); + } + + if (this is global::Alchemy.Serialization.IAlchemySerializationCallbackReceiver receiver) receiver.OnAfterDeserialize(); + } +} +``` + +Using `[AlchemySerializeField]` increases the processing load for serialization and deserialization. Therefore, it is recommended to avoid using `[AlchemySerializeField]` whenever possible. \ No newline at end of file diff --git a/docs/articles/en/attributes/assets-only.md b/docs/articles/en/attributes/assets-only.md new file mode 100644 index 0000000..885f5e4 --- /dev/null +++ b/docs/articles/en/attributes/assets-only.md @@ -0,0 +1,13 @@ +# Assets Only Attribute + +Limits the reference that can be entered into an object field to assets only. + +![img](../../../images/img-attribute-assets-only.png) + +```cs +[AssetsOnly] +public Object asset1; + +[AssetsOnly] +public GameObject asset2; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/blockquote.md b/docs/articles/en/attributes/blockquote.md new file mode 100644 index 0000000..d2f9b76 --- /dev/null +++ b/docs/articles/en/attributes/blockquote.md @@ -0,0 +1,14 @@ +# Blockquote Attribute + +Displays a quotation in the Inspector. + +![img](../../../images/img-attribute-blockquote.png) + +```cs +[Blockquote("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")] +public float foo; +``` + +| Parameter | Description | +| - | - | +| Text | The text to display in the quotation | \ No newline at end of file diff --git a/docs/articles/en/attributes/box-group.md b/docs/articles/en/attributes/box-group.md new file mode 100644 index 0000000..b31b4f3 --- /dev/null +++ b/docs/articles/en/attributes/box-group.md @@ -0,0 +1,29 @@ +# Box Group Attribute + +Creates a group that wraps multiple members in a box for display. + +![img](../../../images/img-attribute-box-group.png) + +```cs +[BoxGroup("Group1")] +public float foo; + +[BoxGroup("Group1")] +public Vector3 bar; + +[BoxGroup("Group1")] +public GameObject baz; + +[BoxGroup("Group1/Group2")] +public float alpha; + +[BoxGroup("Group1/Group2")] +public Vector3 beta; + +[BoxGroup("Group1/Group2")] +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| GroupPath | Specifies the path of the group. Groups can be nested by separating them with `/`. | \ No newline at end of file diff --git a/docs/articles/en/attributes/button.md b/docs/articles/en/attributes/button.md new file mode 100644 index 0000000..231117a --- /dev/null +++ b/docs/articles/en/attributes/button.md @@ -0,0 +1,30 @@ +# Button Attribute + +Displays a button in the Inspector that can execute a method. If the method has parameters, input fields for those parameters will be added. + +![img](../../../images/img-attribute-button.png) + +```cs +[Button] +public void Foo() +{ + Debug.Log("Foo"); +} + +[Button] +public void Foo(int parameter) +{ + Debug.Log("Foo: " + parameter); +} + +[Button] +public void Foo(SampleClass parameter) +{ + var builder = new StringBuilder(); + builder.AppendLine(); + builder.Append("foo = ").AppendLine(parameter.foo.ToString()); + builder.Append("bar = ").AppendLine(parameter.bar.ToString()); + builder.Append("baz = ").Append(parameter.baz == null ? "Null" : parameter.baz.ToString()); + Debug.Log("Foo: " + builder.ToString()); +} +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/disable-alchemy-editor.md b/docs/articles/en/attributes/disable-alchemy-editor.md new file mode 100644 index 0000000..0f52d39 --- /dev/null +++ b/docs/articles/en/attributes/disable-alchemy-editor.md @@ -0,0 +1,15 @@ +# Disable Alchemy Editor Attribute + +Disables the AlchemyEditor for the target class and uses the default Inspector for rendering. When this attribute is added to a field, only that field will be rendered using the default PropertyField. + +![img](../../../images/img-attribute-disable-alchemy-editor.png) + +```cs +[DisableAlchemyEditor] +public class DisableAlchemyEditorExample : MonoBehaviour +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/disable-if.md b/docs/articles/en/attributes/disable-if.md new file mode 100644 index 0000000..06abeee --- /dev/null +++ b/docs/articles/en/attributes/disable-if.md @@ -0,0 +1,27 @@ +# Disable If Attribute + +If the boolean value of the target member is true, the field becomes disabled. + +![img](../../../images/img-attribute-disable-if-false.png) + +![img](../../../images/img-attribute-disable-if-true.png) + +```cs +public bool isDisabled; + +public bool IsDisabled => isDisabled; +public bool IsDisabledMethod() => isDisabled; + +[DisableIf("isDisabled")] +public int disableIfField; + +[DisableIf("IsDisabled")] +public int disableIfProperty; + +[DisableIf("IsDisabledMethod")] +public int disableIfMethod; +``` + +| Parameter | Description | +| - | - | +| Condition | The name of the field, property, or method used for condition evaluation. | \ No newline at end of file diff --git a/docs/articles/en/attributes/disable-in-edit-mode.md b/docs/articles/en/attributes/disable-in-edit-mode.md new file mode 100644 index 0000000..84f1a94 --- /dev/null +++ b/docs/articles/en/attributes/disable-in-edit-mode.md @@ -0,0 +1,12 @@ +# Disable In Edit Mode Attribute + +During Edit Mode, the field becomes disabled. + +![img](../../../images/img-attribute-disable-in-edit-mode-editor.png) + +![img](../../../images/img-attribute-disable-in-edit-mode-player.png) + +```cs +[DisableInEditMode] +public float foo; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/disable-in-play-mode.md b/docs/articles/en/attributes/disable-in-play-mode.md new file mode 100644 index 0000000..d701b16 --- /dev/null +++ b/docs/articles/en/attributes/disable-in-play-mode.md @@ -0,0 +1,12 @@ +# Disable In Play Mode Attribute + +During Play Mode, the field becomes disabled. + +![img](../../../images/img-attribute-disable-in-play-mode-editor.png) + +![img](../../../images/img-attribute-disable-in-play-mode-player.png) + +```cs +[DisableInPlayMode] +public float foo; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/enable-if.md b/docs/articles/en/attributes/enable-if.md new file mode 100644 index 0000000..df70722 --- /dev/null +++ b/docs/articles/en/attributes/enable-if.md @@ -0,0 +1,27 @@ +# Enable If Attribute + +The field becomes editable only if the boolean value of the target member is true. + +![img](../../../images/img-attribute-enable-if-false.png) + +![img](../../../images/img-attribute-enable-if-true.png) + +```cs +public bool isEnabled; + +public bool IsEnabled => isEnabled; +public bool IsEnabledMethod() => isEnabled; + +[EnableIf("isEnabled")] +public int enableIfField; + +[EnableIf("IsEnabled")] +public int enableIfProperty; + +[EnableIf("IsEnabledMethod")] +public int enableIfMethod; +``` + +| Parameter | Description | +| - | - | +| Condition | The name of the field, property, or method used for condition evaluation | diff --git a/docs/articles/en/attributes/foldout-group.md b/docs/articles/en/attributes/foldout-group.md new file mode 100644 index 0000000..b1295fd --- /dev/null +++ b/docs/articles/en/attributes/foldout-group.md @@ -0,0 +1,29 @@ +# Foldout Group Attribute + +Creates collapsible groups for multiple members. + +![img](../../../images/img-attribute-foldout-group.png) + +```cs +[FoldoutGroup("Group1")] +public float foo; + +[FoldoutGroup("Group1")] +public Vector3 bar; + +[FoldoutGroup("Group1")] +public GameObject baz; + +[FoldoutGroup("Group2")] +public float alpha; + +[FoldoutGroup("Group2")] +public Vector3 beta; + +[FoldoutGroup("Group2")] +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| GroupPath | Specifies the path of the group. Groups can be nested using `/`. | \ No newline at end of file diff --git a/docs/articles/en/attributes/group.md b/docs/articles/en/attributes/group.md new file mode 100644 index 0000000..877612e --- /dev/null +++ b/docs/articles/en/attributes/group.md @@ -0,0 +1,29 @@ +# Group Attribute + +Creates a group to display multiple members together. + +![img](../../../images/img-attribute-group.png) + +```cs +[Group("Group1")] +public float foo; + +[Group("Group1")] +public Vector3 bar; + +[Group("Group1")] +public GameObject baz; + +[Group("Group2")] +public float alpha; + +[Group("Group2")] +public Vector3 beta; + +[Group("Group2")] +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| GroupPath | Specifies the path of the group. Groups can be nested using `/`. | \ No newline at end of file diff --git a/docs/articles/en/attributes/help-box.md b/docs/articles/en/attributes/help-box.md new file mode 100644 index 0000000..61fb523 --- /dev/null +++ b/docs/articles/en/attributes/help-box.md @@ -0,0 +1,21 @@ +# Help Box Attribute + +Adds a note or warning above a field. + +![img](../../../images/img-attribute-help-box.png) + +```cs +[HelpBox("Custom Info")] +public float foo; + +[HelpBox("Custom Warning", HelpBoxMessageType.Warning)] +public Vector2 bar; + +[HelpBox("Custom Error", HelpBoxMessageType.Error)] +public GameObject baz; +``` + +| Parameter | Description | +| - | - | +| Message | The text to display inside the box. | +| MessageType | The type of message. | \ No newline at end of file diff --git a/docs/articles/en/attributes/hide-if.md b/docs/articles/en/attributes/hide-if.md new file mode 100644 index 0000000..bb1a05c --- /dev/null +++ b/docs/articles/en/attributes/hide-if.md @@ -0,0 +1,27 @@ +# Hide If Attribute + +Hides the member in the Inspector if the boolean value is true. + +![img](../../../images/img-attribute-hide-if-false.png) + +![img](../../../images/img-attribute-hide-if-true.png) + +```cs +public bool hide; + +public bool Hide => hide; +public bool IsHideTrue() => hide; + +[HideIf("hide")] +public int hideIfField; + +[HideIf("Hide")] +public int hideIfProperty; + +[HideIf("IsHideTrue")] +public int hideIfMethod; +``` + +| Parameter | Description | +| - | - | +| Condition | The name of the field, property, or method used for the condition evaluation. | \ No newline at end of file diff --git a/docs/articles/en/attributes/hide-in-edit-mode.md b/docs/articles/en/attributes/hide-in-edit-mode.md new file mode 100644 index 0000000..d1ea8b9 --- /dev/null +++ b/docs/articles/en/attributes/hide-in-edit-mode.md @@ -0,0 +1,12 @@ +# Hide In Edit Mode Attribute + +Hides the field while in Edit Mode. + +![img](../../../images/img-attribute-hide-in-edit-mode-editor.png) + +![img](../../../images/img-attribute-hide-in-edit-mode-player.png) + +```cs +[HideInEditMode] +public float foo; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/hide-in-play-mode.md b/docs/articles/en/attributes/hide-in-play-mode.md new file mode 100644 index 0000000..fb2b137 --- /dev/null +++ b/docs/articles/en/attributes/hide-in-play-mode.md @@ -0,0 +1,12 @@ +# Hide In Play Mode Attribute + +Hides the field while in Play Mode. + +![img](../../../images/img-attribute-hide-in-play-mode-editor.png) + +![img](../../../images/img-attribute-hide-in-play-mode-player.png) + +```cs +[HideInPlayMode] +public float foo; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/hide-label.md b/docs/articles/en/attributes/hide-label.md new file mode 100644 index 0000000..39e1032 --- /dev/null +++ b/docs/articles/en/attributes/hide-label.md @@ -0,0 +1,16 @@ +# Hide Label Attribute + +Hides the label of the field. + +![img](../../../images/img-attribute-hide-label.png) + +```cs +[HideLabel] +public float foo; + +[HideLabel] +public Vector3 bar; + +[HideLabel] +public GameObject baz; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/hide-script-field.md b/docs/articles/en/attributes/hide-script-field.md new file mode 100644 index 0000000..d8b6e57 --- /dev/null +++ b/docs/articles/en/attributes/hide-script-field.md @@ -0,0 +1,15 @@ +# Hide Script Field Attribute + +Hides the target script field. + +![img](../../../images/img-attribute-hide-script-field.png) + +```cs +[HideScriptField] +public class HideScriptFieldSample : MonoBehaviour +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/horizontal-group.md b/docs/articles/en/attributes/horizontal-group.md new file mode 100644 index 0000000..a3d8466 --- /dev/null +++ b/docs/articles/en/attributes/horizontal-group.md @@ -0,0 +1,44 @@ +# Horizontal Attribute + +Creates a group that displays multiple members horizontally. + +![img](../../../images/img-attribute-horizontal-group.png) + +```cs +[HorizontalGroup("Group1")] +public int a; + +[HorizontalGroup("Group1")] +public int b; + +[HorizontalGroup("Group1")] +public int c; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box1")] +public float foo; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box1")] +public Vector3 bar; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box1")] +public GameObject baz; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box2")] +public float alpha; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box2")] +public Vector3 beta; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box2")] +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| GroupPath | Specifies the path of the group. Groups can be nested using `/`. | \ No newline at end of file diff --git a/docs/articles/en/attributes/horizontal-line.md b/docs/articles/en/attributes/horizontal-line.md new file mode 100644 index 0000000..863e77b --- /dev/null +++ b/docs/articles/en/attributes/horizontal-line.md @@ -0,0 +1,23 @@ +# Horizontal Line Attribute + +Adds a horizontal line to the Inspector. + +![img](../../../images/img-attribute-horizontal-line.png) + +```cs +[HorizontalLine] +public float foo; + +[HorizontalLine(1f, 0f, 0f)] +public Vector2 bar; + +[HorizontalLine(1f, 0.5f, 0f, 0.5f)] +public GameObject baz; +``` + +| Parameter | Description | +| - | - | +| r | Red component of the line color | +| g | Green component of the line color | +| b | Blue component of the line color | +| a | Alpha value of the line color | \ No newline at end of file diff --git a/docs/articles/en/attributes/indent.md b/docs/articles/en/attributes/indent.md new file mode 100644 index 0000000..66d8d79 --- /dev/null +++ b/docs/articles/en/attributes/indent.md @@ -0,0 +1,20 @@ +# Indent Attribute + +Adds an indent to the field in the Inspector. + +![img](../../../images/img-attribute-indent.png) + +```cs +[Indent] +public float foo; + +[Indent(2)] +public Vector2 bar; + +[Indent(3)] +public GameObject baz; +``` + +| Parameter | Description | +| - | - | +| Indent | Number of indents | \ No newline at end of file diff --git a/docs/articles/en/attributes/inline-editor.md b/docs/articles/en/attributes/inline-editor.md new file mode 100644 index 0000000..09f6ca5 --- /dev/null +++ b/docs/articles/en/attributes/inline-editor.md @@ -0,0 +1,10 @@ +# Inline Editor Attribute + +Displays the Inspector of the target ScriptableObject or component inline, allowing for editing. + +![img](../../../images/img-attribute-inline-editor.png) + +```cs +[InlineEditor] +public SampleScriptableObject sample; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/label-text.md b/docs/articles/en/attributes/label-text.md new file mode 100644 index 0000000..b76b3ec --- /dev/null +++ b/docs/articles/en/attributes/label-text.md @@ -0,0 +1,30 @@ +# Label Text Attribute + +Overrides the label text of the field. + +![img](../../../images/img-attribute-label-text.png) + +```cs +[LabelText("FOO!")] +public float foo; + +[LabelText("BAR!")] +public Vector3 bar; + +[LabelText("BAZ!")] +public GameObject baz; + +[Space] +[LabelText("α")] +public float alpha; + +[LabelText("β")] +public Vector3 beta; + +[LabelText("γ")] +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| Text | The text to display on the field label | \ No newline at end of file diff --git a/docs/articles/en/attributes/list-view-settings.md b/docs/articles/en/attributes/list-view-settings.md new file mode 100644 index 0000000..85aeee4 --- /dev/null +++ b/docs/articles/en/attributes/list-view-settings.md @@ -0,0 +1,28 @@ +# List View Settings Attribute + +Changes the display settings for collections. This attribute allows you to enhance the readability of rows, and create arrays where the element count/order cannot be changed from the Inspector. + +![img](../../../images/img-attribute-list-view-settings.png) + +```cs +[ListViewSettings(ShowAlternatingRowBackgrounds = AlternatingRowBackground.All, ShowFoldoutHeader = false)] +public int[] array1; + +[ListViewSettings(Reorderable = false, ShowAddRemoveFooter = false, ShowBorder = false, ShowBoundCollectionSize = false)] +public Vector3[] array2 = new Vector3[] +{ + Vector3.zero, + Vector3.one +}; +``` + +| Parameter | Description | +| - | - | +| ShowAddRemoveFooter | Whether to display the footer for adding/removing elements | +| ShowAlternatingRowBackgrounds | Whether to change the background color for every other row | +| ShowBorder | Whether to display borders | +| ShowBoundCollectionSize | Whether to display the field for changing the number of elements | +| ShowFoldoutHeader | Whether to display the foldout header | +| SelectionType | Selection settings for elements | +| Reorderable | Whether elements can be reordered | +| ReorderMode | Settings for displaying reordering | \ No newline at end of file diff --git a/docs/articles/en/attributes/on-inspector-destroy.md b/docs/articles/en/attributes/on-inspector-destroy.md new file mode 100644 index 0000000..bfdacf7 --- /dev/null +++ b/docs/articles/en/attributes/on-inspector-destroy.md @@ -0,0 +1,11 @@ +# On Inspector Destroy Attribute + +Executes a method when the Inspector is destroyed. + +```cs +[OnInspectorDestroy] +void OnInspectorDestroy() +{ + Debug.Log("Destroy"); +} +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/on-inspector-disable.md b/docs/articles/en/attributes/on-inspector-disable.md new file mode 100644 index 0000000..a8d82f1 --- /dev/null +++ b/docs/articles/en/attributes/on-inspector-disable.md @@ -0,0 +1,11 @@ +# On Inspector Disable Attribute + +Executes a method when the Inspector is disabled. + +```cs +[OnInspectorDisable] +void OnInspectorDisable() +{ + Debug.Log("Disable"); +} +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/on-inspector-enable.md b/docs/articles/en/attributes/on-inspector-enable.md new file mode 100644 index 0000000..bbc20af --- /dev/null +++ b/docs/articles/en/attributes/on-inspector-enable.md @@ -0,0 +1,11 @@ +# On Inspector Enable Attribute + +Executes a method when the Inspector is enabled. + +```cs +[OnInspectorEnable] +void OnInspectorEnable() +{ + Debug.Log("Enable"); +} +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/on-value-changed.md b/docs/articles/en/attributes/on-value-changed.md new file mode 100644 index 0000000..af4eea7 --- /dev/null +++ b/docs/articles/en/attributes/on-value-changed.md @@ -0,0 +1,17 @@ +# On Value Changed Attribute + +Executes a method with the specified name when the value of the field changes. + +```cs +[OnValueChanged("OnValueChanged")] +public int foo; + +void OnValueChanged(int value) +{ + Debug.Log(value); +} +``` + +| Parameter | Description | +| - | - | +| MethodName | The name of the method to be called when the value changes. | \ No newline at end of file diff --git a/docs/articles/en/attributes/order.md b/docs/articles/en/attributes/order.md new file mode 100644 index 0000000..39adabe --- /dev/null +++ b/docs/articles/en/attributes/order.md @@ -0,0 +1,20 @@ +# Order Attribute + +Changes the display order of the field. The default value of order is 0, and members are displayed in ascending order. + +![img](../../../images/img-attribute-order.png) + +```cs +[Order(2)] +public float foo; + +[Order(1)] +public Vector3 bar; + +[Order(0)] +public GameObject baz; +``` + +| Parameter | Description | +| - | - | +| Order | The display order of the member. | \ No newline at end of file diff --git a/docs/articles/en/attributes/read-only.md b/docs/articles/en/attributes/read-only.md new file mode 100644 index 0000000..9b3216f --- /dev/null +++ b/docs/articles/en/attributes/read-only.md @@ -0,0 +1,19 @@ +# Read Only Attribute + +Makes the field uneditable. + +![img](../../../images/img-attribute-read-only.png) + +```cs +[ReadOnly] +public float field = 2.5f; + +[ReadOnly] +public int[] array = new int[5]; + +[ReadOnly] +public SampleClass classField; + +[ReadOnly] +public SampleClass[] classArray = new SampleClass[3]; +``` diff --git a/docs/articles/en/attributes/required.md b/docs/articles/en/attributes/required.md new file mode 100644 index 0000000..8a8d57b --- /dev/null +++ b/docs/articles/en/attributes/required.md @@ -0,0 +1,17 @@ +# Required Attribute + +Displays a warning if the field does not have an object reference assigned. + +![img](../../../images/img-attribute-required.png) + +```cs +[Required] +public GameObject requiredField1; + +[Required("Custom message")] +public Material requiredField2; +``` + +| Parameter | Description | +| - | - | +| Message | Text to display in the warning | diff --git a/docs/articles/en/attributes/show-if.md b/docs/articles/en/attributes/show-if.md new file mode 100644 index 0000000..0e7bc15 --- /dev/null +++ b/docs/articles/en/attributes/show-if.md @@ -0,0 +1,27 @@ +# Show If Attribute + +Displays in the Inspector only if the boolean value of the target member is true. + +![img](../../../images/img-attribute-show-if-false.png) + +![img](../../../images/img-attribute-show-if-true.png) + +```cs +public bool show; + +public bool Show => show; +public bool IsShowTrue() => show; + +[ShowIf("show")] +public int showIfField; + +[ShowIf("Show")] +public int showIfProperty; + +[ShowIf("IsShowTrue")] +public int showIfMethod; +``` + +| Parameter | Description | +| - | - | +| Condition | The name of the field, property, or method used for condition checking | \ No newline at end of file diff --git a/docs/articles/en/attributes/show-in-inspector.md b/docs/articles/en/attributes/show-in-inspector.md new file mode 100644 index 0000000..8e818b6 --- /dev/null +++ b/docs/articles/en/attributes/show-in-inspector.md @@ -0,0 +1,19 @@ +# Show In Inspector Attribute + +Allows non-serialized fields or properties to be edited in the Inspector. Note that these values are not serialized, and changes are not saved. + +![img](../../../images/img-attribute-show-in-inspector.png) + +```cs +[NonSerialized, ShowInInspector] +public int field; + +[NonSerialized, ShowInInspector] +public SampleClass classField = new(); + +[ShowInInspector] +public int Getter => 10; + +[field: NonSerialized, ShowInInspector] +public string Property { get; set; } = string.Empty; +``` \ No newline at end of file diff --git a/docs/articles/en/attributes/tab-group.md b/docs/articles/en/attributes/tab-group.md new file mode 100644 index 0000000..4c157c6 --- /dev/null +++ b/docs/articles/en/attributes/tab-group.md @@ -0,0 +1,30 @@ +# Tab Group Attribute + +Creates a group that divides multiple members into tabs. + +![img](../../../images/img-attribute-tab-group.png) + +```cs +[TabGroup("Group1", "Tab1")] +public float foo; + +[TabGroup("Group1", "Tab2")] +public Vector3 bar; + +[TabGroup("Group1", "Tab3")] +public GameObject baz; + +[TabGroup("Group1", "Tab1")] +public float alpha; + +[TabGroup("Group1", "Tab2")] +public Vector3 beta; + +[TabGroup("Group1", "Tab3")] +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| GroupPath | Specifies the path of the group. Groups can be nested using `/`. | +| TabName | Specifies the name of the tab to which the member belongs. | \ No newline at end of file diff --git a/docs/articles/en/attributes/title.md b/docs/articles/en/attributes/title.md new file mode 100644 index 0000000..ffec6dd --- /dev/null +++ b/docs/articles/en/attributes/title.md @@ -0,0 +1,22 @@ +# Title Attribute + +Displays a header with a separator line in the Inspector. + +![img](../../../images/img-attribute-title.png) + +```cs +[Title("Title1")] +public float foo; +public Vector3 bar; +public GameObject baz; + +[Title("Title2", "Subtitle")] +public float alpha; +public Vector3 beta; +public GameObject gamma; +``` + +| Parameter | Description | +| - | - | +| Title | Text to display in the header. | +| Subtitle | Text displayed below the title in smaller font. | \ No newline at end of file diff --git a/docs/articles/en/attributes/validate-input.md b/docs/articles/en/attributes/validate-input.md new file mode 100644 index 0000000..98a8178 --- /dev/null +++ b/docs/articles/en/attributes/validate-input.md @@ -0,0 +1,28 @@ +# Validate Input Attribute + +Displays a warning if the value of the specified member is false. + +![img](../../../images/img-attribute-validate-input.png) + +```cs +[ValidateInput("IsNotNull")] +public GameObject obj; + +[ValidateInput("IsZeroOrGreater", "foo must be 0 or greater.")] +public int foo = -1; + +static bool IsNotNull(GameObject go) +{ + return go != null; +} + +static bool IsZeroOrGreater(int a) +{ + return a >= 0; +} +``` + +| Parameter | Description | +| - | - | +| Condition | Name of the field, property, or method used for validation. | +| Message | Text displayed in the warning. | \ No newline at end of file diff --git a/docs/articles/en/button-attribute.md b/docs/articles/en/button-attribute.md new file mode 100644 index 0000000..0b615ac --- /dev/null +++ b/docs/articles/en/button-attribute.md @@ -0,0 +1,45 @@ +# Button Attribute + +By adding the `[Button]` attribute to a method, you can display a button in the Inspector to execute the method. + +```cs +using System; +using UnityEngine; +using Alchemy.Inspector; + +[Serializable] +public sealed class Example +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} + +public class ButtonAttributeExample : MonoBehaviour +{ + [Button] + public void Foo() + { + Debug.Log("Foo"); + } + + [Button] + public void Foo(int parameter) + { + Debug.Log("Foo: " + parameter); + } + + [Button] + public void Foo(Example parameter) + { + var builder = new StringBuilder(); + builder.AppendLine(); + builder.Append("foo = ").AppendLine(parameter.foo.ToString()); + builder.Append("bar = ").AppendLine(parameter.bar.ToString()); + builder.Append("baz = ").Append(parameter.baz == null ? "Null" : parameter.baz.ToString()); + Debug.Log("Foo: " + builder.ToString()); + } +} +``` + +![img](../../images/img-button.png) \ No newline at end of file diff --git a/docs/articles/en/comparison-with-other-libraries.md b/docs/articles/en/comparison-with-other-libraries.md new file mode 100644 index 0000000..8f5890e --- /dev/null +++ b/docs/articles/en/comparison-with-other-libraries.md @@ -0,0 +1,15 @@ +# Comparison with Other Libraries + +Alchemy offers features equivalent to or surpassing those of other assets/libraries for editor extensions. Here's a comparison of Alchemy's features with other assets/libraries: + +| | Alchemy | [Odin Inspector & Serializer](https://odininspector.com/) | [NaughtyAttributes](https://github.com/dbrizov/NaughtyAttributes) | [Tri Inspector](https://github.com/codewriter-packages/Tri-Inspector) | [Unity Editor Toolbox](https://github.com/arimger/Unity-Editor-Toolbox) | +| - | - | - | - | - | - | +| Open Source | ✔︎ | ❌ | ✔︎ | ✔︎ | ✔︎ | +| Grouping Attributes | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | +| Button Attribute | ✔︎ | ✔︎ | ✔︎
(without arguments) | ✔︎ | ✔︎
(without arguments) | +| Editing NonSerialized Members | ✔︎ | ✔︎ | ❌ | ✔︎ | ❌ | +| SerializeReference Support | ✔︎ | ✔︎ | ❌ | ✔︎ | ✔︎ | +| Serialization Extension | ✔︎
(requires partial) | ✔︎
(inherit from dedicated types) | ❌ | ❌ | ❌
(provides serializable types) | +| UI Toolkit Support | ✔︎ | ✔︎ | ❌ | ✔︎ | ❌ | +| EditorWindow Extensions | ✔︎ | ✔︎ | ❌ | ❌ | ❌ | +| Hierarchy Extensions | ✔︎ | ❌ | ❌ | ❌ | ✔︎ | diff --git a/docs/articles/en/creating-custom-attribute.md b/docs/articles/en/creating-custom-attribute.md new file mode 100644 index 0000000..76501f7 --- /dev/null +++ b/docs/articles/en/creating-custom-attribute.md @@ -0,0 +1,48 @@ +# Creating Custom Attributes + +By using `AlchemyAttributeDrawer`, it is possible to create custom attributes that work within Alchemy. Here is an example demonstrating the implementation of `HelpBoxAttribute` and its corresponding drawer. + +First, define the attribute to be added to fields or properties. + +```cs +using System; +using UnityEngine.UIElements; + +public sealed class HelpBoxAttribute : Attribute +{ + public HelpBoxAttribute(string message, HelpBoxMessageType messageType = HelpBoxMessageType.Info) + { + Message = message; + MessageType = messageType; + } + + public string Message { get; } + public HelpBoxMessageType MessageType { get; } +} +``` + +Next, create the drawer corresponding to the defined attribute. Drawer scripts should be placed within the Editor folder. + +```cs +using UnityEngine.UIElements; +using Alchemy.Editor; + +[CustomAttributeDrawer(typeof(HelpBoxAttribute))] +public sealed class HelpBoxDrawer : AlchemyAttributeDrawer +{ + HelpBox helpBox; + + public override void OnCreateElement() + { + var att = (HelpBoxAttribute)Attribute; + helpBox = new HelpBox(att.Message, att.MessageType); + + var parent = TargetElement.parent; + parent.Insert(parent.IndexOf(TargetElement), helpBox); + } +} +``` + +Implement the `OnCreateElement()` method to add processing when creating the corresponding VisualElement for the member. Unlike regular `PropertyDrawer`s that override the drawing process, here we're adding post-processing after the creation of the Visual Element. This mechanism allows Alchemy to combine multiple drawers. + +Additionally, make sure to add the `CustomAttributeDrawer` attribute to the defined drawer, with the type of the defined attribute as an argument. Alchemy uses this attribute to search for the necessary drawers for element rendering. diff --git a/docs/articles/en/creating-custom-group-attribute.md b/docs/articles/en/creating-custom-group-attribute.md new file mode 100644 index 0000000..739c110 --- /dev/null +++ b/docs/articles/en/creating-custom-group-attribute.md @@ -0,0 +1,41 @@ +# Creating Custom Group Attributes + +By using `AlchemyGroupDrawer`, it is possible to create custom attributes for grouping fields. Here is an example demonstrating the implementation of `FoldoutGroupAttribute` and its corresponding drawer. (Some parts of the actual implementation have been omitted for the sake of explanation.) + +First, define the attribute to be used for defining groups. This attribute must inherit from `PropertyGroupAttribute`. + +```cs +using Alchemy.Inspector; + +public sealed class FoldoutGroupAttribute : PropertyGroupAttribute +{ + public FoldoutGroupAttribute() : base() { } + public FoldoutGroupAttribute(string groupPath) : base(groupPath) { } +} +``` + +Next, create the drawer corresponding to the defined attribute. Drawer scripts should be placed within the Editor folder. + +```cs +using UnityEngine.UIElements; +using Alchemy.Editor; + +[CustomGroupDrawer(typeof(FoldoutGroupAttribute))] +public sealed class FoldoutGroupDrawer : AlchemyGroupDrawer +{ + public override VisualElement CreateRootElement(string label) + { + var foldout = new Foldout() + { + style = { + width = Length.Percent(100f) + }, + text = label + }; + + return foldout; + } +} +``` + +Implement the `CreateRootElement(string label)` method to create the root VisualElement for each group. Additionally, make sure to add the `CustomGroupDrawer` attribute to the defined drawer, with the type of the defined attribute as an argument. Alchemy uses this attribute to search for the necessary drawers for group rendering. \ No newline at end of file diff --git a/docs/articles/en/debugging-serialized-data.md b/docs/articles/en/debugging-serialized-data.md new file mode 100644 index 0000000..a8d0f9d --- /dev/null +++ b/docs/articles/en/debugging-serialized-data.md @@ -0,0 +1,20 @@ +# Debugging Serialized Data + +By adding the `[ShowAlchemySerializationData]` attribute along with `[AlchemySerialize]`, you can inspect serialized data from the Inspector. + +```cs +using System; +using System.Collections.Generic; +using UnityEngine; +using Alchemy.Serialization; + +[AlchemySerialize] +[ShowAlchemySerializationData] +public partial class AlchemySerializationExample : MonoBehaviour +{ + [AlchemySerializeField, NonSerialized] + public Dictionary dictionary = new(); +} +``` + +![img](../../images/img-show-serialization-data.png) diff --git a/docs/articles/en/decorating-hierarchy.md b/docs/articles/en/decorating-hierarchy.md new file mode 100644 index 0000000..4f479a0 --- /dev/null +++ b/docs/articles/en/decorating-hierarchy.md @@ -0,0 +1,19 @@ +# Decorating Hierarchy + +Alchemy allows you to decorate the Hierarchy by adding headers and separators, making it more visually appealing and easier to navigate. + +![img](../../images/img-hierarchy.png) + +To add headers and separators, navigate to the Hierarchy and click the "+" button, then choose `Alchemy > Header/Separator`. + +![img](../../images/img-create-hierarchy-object.png) + +These objects used for decoration in the Hierarchy are called `HierarchyObjects` in Alchemy. They are excluded from the build process. If any child objects exist, they will be detached using `transform.DetachChildren()` before deletion. + +You can configure the handling of `HierarchyObjects` in the Alchemy settings under `Project Settings > Alchemy`. + +![img](../../images/img-project-settings.png) + +For individual `HierarchyObjects`, you can adjust their settings from the Inspector. + +![img](../../images/img-hierarchy-header-inspector.png) \ No newline at end of file diff --git a/docs/articles/en/disable-default-editor.md b/docs/articles/en/disable-default-editor.md new file mode 100644 index 0000000..b691967 --- /dev/null +++ b/docs/articles/en/disable-default-editor.md @@ -0,0 +1,5 @@ +# Disabling the Default Editor + +By default, Alchemy uses its own editor class to handle the drawing of all types. However, to avoid conflicts with other libraries or assets, you can disable this behavior. + +To disable the default editor, add `ALCHEMY_DISABLE_DEFAULT_EDITOR` to the `Scripting Define Symbols` field in `Project Settings > Player`. If you want to use Alchemy's features while this option is enabled, you'll need to define your own editor class that inherits from `AlchemyEditor`. \ No newline at end of file diff --git a/docs/articles/en/extending-alchemy-editor.md b/docs/articles/en/extending-alchemy-editor.md new file mode 100644 index 0000000..de61a37 --- /dev/null +++ b/docs/articles/en/extending-alchemy-editor.md @@ -0,0 +1,21 @@ +# Extending AlchemyEditor + +If a MonoBehaviour or ScriptableObject has its own custom editor class, Alchemy attributes won't work by default. +To combine your custom editor extension with Alchemy, you need to inherit from `AlchemyEditor` class instead of the regular `Editor` class. + +```cs +using UnityEditor; +using Alchemy.Editor; + +[CustomEditor(typeof(Example))] +public class EditorExample : AlchemyEditor +{ + public override VisualElement CreateInspectorGUI() + { + // Always call the base CreateInspectorGUI + base.CreateInspectorGUI(); + + // Add your custom logic here + } +} +``` \ No newline at end of file diff --git a/docs/articles/en/group-attributes.md b/docs/articles/en/group-attributes.md new file mode 100644 index 0000000..68a1584 --- /dev/null +++ b/docs/articles/en/group-attributes.md @@ -0,0 +1,85 @@ +# Group Attributes + +Alchemy provides attributes to group fields together. + +```cs +using UnityEngine; +using Alchemy.Inspector; + +public class GroupAttributesExample : MonoBehaviour +{ + [FoldoutGroup("Foldout")] + public int a; + + [FoldoutGroup("Foldout")] + public int b; + + [FoldoutGroup("Foldout")] + public int c; + + [TabGroup("Tab", "Tab1")] + public int x; + + [TabGroup("Tab", "Tab2")] + public string y; + + [TabGroup("Tab", "Tab3")] + public Vector3 z; +} +``` + +![img](../../images/img-group-1.png) + +Each group can be nested by using slashes. + +```cs +using UnityEngine; +using Alchemy.Inspector; + +public class GroupAttributesExample : MonoBehaviour +{ + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box1")] + public float foo; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box1")] + public Vector3 bar; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box1")] + public GameObject baz; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box2")] + public float alpha; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box2")] + public Vector3 beta; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box2")] + public GameObject gamma; +} +``` + +![img](../../images/img-group-2.png) + +Additionally, you can add group attributes to a defined Serializable class to change how its members are displayed within corresponding groups. + +```cs +using System; +using UnityEngine; +using Alchemy.Inspector; + +[Serializable] +[BoxGroup] +public sealed class Example +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} + +public class GroupAttributeExample : MonoBehaviour +{ + public Example example; +} +``` + +![img](../../images/img-group-3.png) \ No newline at end of file diff --git a/docs/articles/en/hierarchy-toggles-and-icons.md b/docs/articles/en/hierarchy-toggles-and-icons.md new file mode 100644 index 0000000..ea51b4a --- /dev/null +++ b/docs/articles/en/hierarchy-toggles-and-icons.md @@ -0,0 +1,9 @@ +# Toggles and Icons + +By integrating Alchemy, you can add toggles to the Hierarchy to switch objects between active and inactive states, as well as icons for each component. + +![gif](../../images/gif-hierarchy-toggle.gif) + +These features are disabled by default. You can configure Hierarchy display settings in `Project Settings > Alchemy`. + +![img](../../images/img-project-settings.png) \ No newline at end of file diff --git a/docs/articles/en/inspector-extension-with-attributes.md b/docs/articles/en/inspector-extension-with-attributes.md new file mode 100644 index 0000000..42b71ae --- /dev/null +++ b/docs/articles/en/inspector-extension-with-attributes.md @@ -0,0 +1,28 @@ +# Inspector Extension with Attributes + +Alchemy allows you to extend the Inspector using attributes. To customize the display in the Inspector, you can add attributes to the fields of your class. + +```cs +using UnityEngine; +using UnityEngine.UIElements; +using Alchemy.Inspector; // Add Alchemy.Inspector namespace + +public class AttributesExample : MonoBehaviour +{ + [LabelText("Custom Label")] + public float foo; + + [HideLabel] + public Vector3 bar; + + [AssetsOnly] + public GameObject baz; + + [Title("Title")] + [HelpBox("HelpBox", HelpBoxMessageType.Info)] + [ReadOnly] + public string message = "Read Only"; +} +``` + +![img](../../images/img-attributes-example.png) \ No newline at end of file diff --git a/docs/articles/en/installation.md b/docs/articles/en/installation.md new file mode 100644 index 0000000..954c254 --- /dev/null +++ b/docs/articles/en/installation.md @@ -0,0 +1,40 @@ +# Installation + +Let's install Alchemy into your project to start using it. + +### Requirements + +* Unity 2021.2 or later (Unity 2022.1 or later recommended for serialization extensions) +* Serialization 2.0 or later (if using serialization extensions) + +### Install via Package Manager (Recommended) + +You can install Alchemy via the Package Manager. + +1. Open the Package Manager by navigating to Window > Package Manager. +2. Click the "+" button and choose "Add package from git URL". +3. Enter the following URL: + +```text +https://github.com/AnnulusGames/Alchemy.git?path=/Alchemy/Assets/Alchemy +``` + +![img1](../../images/img-setup-1.png) + +Alternatively, you can add the following line to the dependencies block in your Packages/manifest.json file: + +```json +{ + "dependencies": { + "com.annulusgames.alchemy": "https://github.com/AnnulusGames/Alchemy.git?path=/Alchemy/Assets/Alchemy" + } +} +``` + +### Install from unitypackage + +You can also install Alchemy from a unitypackage file. + +1. Go to Releases and navigate to the latest release. +2. Download the unitypackage file. +3. Open the file and import it into your project. diff --git a/docs/articles/en/saving-editor-window-data.md b/docs/articles/en/saving-editor-window-data.md new file mode 100644 index 0000000..c987079 --- /dev/null +++ b/docs/articles/en/saving-editor-window-data.md @@ -0,0 +1,39 @@ +# Saving EditorWindow Data + +The data of an editor window created by inheriting from `AlchemyEditorWindow` is automatically saved in JSON format within the ProjectSettings folder of your project. + +You can customize the saving/loading process and the destination path by overriding the `SaveWindowData()`, `LoadWindowData()`, and `GetWindowDataPath()` methods. + +```cs +using UnityEditor; +using UnityEngine; +using Alchemy.Editor; + +public class EditorWindowExample : AlchemyEditorWindow +{ + [MenuItem("Window/Example")] + static void Open() + { + var window = GetWindow("Example"); + window.Show(); + } + + protected override string GetWindowDataPath() + { + // Return the path where the data will be saved + return ... + } + + protected override void LoadWindowData(string dataPath) + { + // Write the loading process here + ... + } + + protected override void SaveWindowData(string dataPath) + { + // Write the saving process here + ... + } +} +``` \ No newline at end of file diff --git a/docs/articles/en/serialization-callback.md b/docs/articles/en/serialization-callback.md new file mode 100644 index 0000000..9c52cf4 --- /dev/null +++ b/docs/articles/en/serialization-callback.md @@ -0,0 +1,21 @@ +# Serialization Callbacks + +When using the `[AlchemySerialize]` attribute, the Source Generator automatically implements `ISerializationCallbackReceiver`. Therefore, you cannot use `ISerializationCallbackReceiver` to add callbacks. + +Instead, Alchemy provides an alternative interface called `IAlchemySerializationCallbackReceiver`. Please use this interface instead of `ISerializationCallbackReceiver` when using `[AlchemySerialize]`. + +```cs +[AlchemySerialize] +public partial class AlchemySerializationSample : MonoBehaviour, IAlchemySerializationCallbackReceiver +{ + public void OnAfterDeserialize() + { + Debug.Log("OnAfterDeserialize"); + } + + public void OnBeforeSerialize() + { + Debug.Log("OnBeforeSerialize"); + } +} +``` \ No newline at end of file diff --git a/docs/articles/en/serialization-extension.md b/docs/articles/en/serialization-extension.md new file mode 100644 index 0000000..a37e043 --- /dev/null +++ b/docs/articles/en/serialization-extension.md @@ -0,0 +1,49 @@ +# Serialization Extension + +If you want to edit types that Unity cannot serialize normally, such as Dictionary, you can serialize them using the `[AlchemySerialize]` attribute. + +To use serialization extension, you need the [Unity.Serialization](https://docs.unity3d.com/Packages/com.unity.serialization@3.1/manual/index.html) package. Also, please note that reflection-based Unity.Serialization serialization may not work in AOT environments prior to Unity 2022.1. Please refer to the package manual for details. + +Here is a sample using Alchemy's serialization extension to serialize various types and make them editable in the Inspector: + +```cs +using System; +using System.Collections.Generic; +using UnityEngine; +using Alchemy.Serialization; // Add Alchemy.Serialization namespace + +[AlchemySerialize] +public partial class AlchemySerializationExample : MonoBehaviour +{ + // Add the [AlchemySerializeField] and [NonSerialized] attributes to the target field. + [AlchemySerializeField, NonSerialized] + public HashSet hashSet = new(); + + [AlchemySerializeField, NonSerialized] + public Dictionary dictionary = new(); + + [AlchemySerializeField, NonSerialized] + public (int, int) tuple; + + [AlchemySerializeField, NonSerialized] + public Vector3? nullable = null; +} +``` + +![img](../../images/img-serialization-sample.png) + +Currently, the following types can be edited in the Inspector: + +- Primitive types +- UnityEngine.Object +- AnimationCurve +- Gradient +- Array +- List<> +- HashSet<> +- Dictionary<,> +- ValueTuple<> +- Nullable<> +- class/struct consisting of the above types + +For technical details on serialization, please refer to [Alchemy's Serialization Process](alchemy-serialization-process.md). \ No newline at end of file diff --git a/docs/articles/en/serialize-reference.md b/docs/articles/en/serialize-reference.md new file mode 100644 index 0000000..935e3a4 --- /dev/null +++ b/docs/articles/en/serialize-reference.md @@ -0,0 +1,40 @@ +# SerializeReference + +Alchemy supports Unity's `[SerializeReference]`. By adding the `[SerializeReference]` attribute, you can edit interfaces or abstract classes in the Inspector. + +```cs +using System; +using UnityEngine; + +public interface IExample { } + +[Serializable] +public sealed class ExampleA : IExample +{ + public float alpha; +} + +[Serializable] +public sealed class ExampleB : IExample +{ + public Vector3 beta; +} + +[Serializable] +public sealed class ExampleC : IExample +{ + public GameObject gamma; +} + +public class SerializeReferenceExample : MonoBehaviour +{ + [SerializeReference] public IExample example; + [SerializeReference] public IExample[] exampleArray; +} +``` + +![img](../../images/img-serialize-reference.png) + +Interfaces and abstract classes are displayed as shown above, and you can select and create subclasses from the dropdown. + +For more information about SerializeReference serialization, please refer to [Unity's official documentation](https://docs.unity3d.com/2020.3/ScriptReference/SerializeReference.html). \ No newline at end of file diff --git a/docs/articles/en/toc.yml b/docs/articles/en/toc.yml new file mode 100644 index 0000000..f6dd75a --- /dev/null +++ b/docs/articles/en/toc.yml @@ -0,0 +1,134 @@ +- name: Get Started +- name: Alchemy Overview + href: about.md +- name: Installation + href: installation.md + +- name: Inspector +- name: Inspector Extension with Attributes + href: inspector-extension-with-attributes.md +- name: Group Attributes + href: group-attributes.md +- name: Button Attribute + href: button-attribute.md +- name: SerializeReference + href: serialize-reference.md +- name: Attribute List + items: + - name: General + - name: Assets Only + href: attributes/assets-only.md + - name: Button + href: attributes/button.md + - name: Disable Alchemy Editor + href: attributes/disable-alchemy-editor.md + - name: Hide Script Field + href: attributes/hide-script-field.md + - name: Indent + href: attributes/indent.md + - name: Inline Editor + href: attributes/inline-editor.md + - name: List View Settings + href: attributes/list-view-settings.md + - name: Order + href: attributes/order.md + - name: Read Only + href: attributes/read-only.md + - name: Show In Inspector + href: attributes/show-in-inspector.md + + - name: Conditionals + - name: Disable If + href: attributes/disable-if.md + - name: Disable In Edit Mode + href: attributes/disable-in-edit-mode.md + - name: Disable In Play Mode + href: attributes/disable-in-play-mode.md + - name: Enable If + href: attributes/enable-if.md + - name: Hide If + href: attributes/hide-if.md + - name: Hide In Edit Mode + href: attributes/hide-in-edit-mode.md + - name: Hide In Play Mode + href: attributes/hide-in-play-mode.md + - name: Show If + href: attributes/show-if.md + + - name: Decoration + - name: Blockquote + href: attributes/blockquote.md + - name: Help Box + href: attributes/help-box.md + - name: Hide Label + href: attributes/hide-label.md + - name: Horizontal Line + href: attributes/horizontal-line.md + - name: Label Text + href: attributes/label-text.md + - name: Title + href: attributes/title.md + + - name: Validation + - name: Required + href: attributes/required.md + - name: Validate Input + href: attributes/validate-input.md + + - name: Events + - name: On Inspector Destroy + href: attributes/on-inspector-destroy.md + - name: On Inspector Disable + href: attributes/on-inspector-disable.md + - name: On Inspector Enable + href: attributes/on-inspector-enable.md + - name: On Value Changed + href: attributes/on-value-changed.md + + - name: Groups + - name: Box Group + href: attributes/box-group.md + - name: Foldout Group + href: attributes/foldout-group.md + - name: Group + href: attributes/group.md + - name: Horizontal Group + href: attributes/horizontal-group.md + - name: Tab Group + href: attributes/tab-group.md + +- name: Hierarchy +- name: Toggles and Icons + href: hierarchy-toggles-and-icons.md +- name: Decorating Hierarchy + href: decorating-hierarchy.md + +- name: Editor Window +- name: AlchemyEditorWindow + href: alchemy-editor-window.md +- name: Saving Editor Window Data + href: saving-editor-window-data.md + +- name: Serialization +- name: Serialization Extension + href: serialization-extension.md +- name: Alchemy Serialization Process + href: alchemy-serialization-process.md +- name: Debugging Serialized Data + href: debugging-serialized-data.md +- name: Serialization Callback + href: serialization-callback.md + +- name: Extensions +- name: Extending Alchemy Editor + href: extending-alchemy-editor.md +- name: Creating Custom Attribute + href: creating-custom-attribute.md +- name: Creating Custom Group Attribute + href: creating-custom-group-attribute.md + +- name: Others +- name: Disable Default Editor + href: disable-default-editor.md +- name: Comparison with Other Libraries + href: comparison-with-other-libraries.md \ No newline at end of file diff --git a/docs/articles/ja/about.md b/docs/articles/ja/about.md new file mode 100644 index 0000000..2ae0867 --- /dev/null +++ b/docs/articles/ja/about.md @@ -0,0 +1,10 @@ +# Alchemyとは + +![header](../../images/header.png) + +AlchemyはUnity向けの豊富なエディタ拡張の機能を提供するライブラリです。Inspectorを手軽に拡張するための30以上の属性が追加されるほか、Unity.Serializationパッケージと専用のSource Generatorを使用することで、通常のUnityではシリアル化できない型(`Dictionary`, `HashSet`, `Nullable`, `ValueTuple`, etc.)をシリアル化してInspectorから編集することを可能にします。 + +![img](../../images/img-v2.0.png) + +またv2.0の新機能としてEditorWindow拡張とHierarchy拡張が追加されました。これらを用いることで、エディタでの開発フローを効率化するツールを簡単に作成できるようになります。 + diff --git a/docs/articles/ja/alchemy-editor-window.md b/docs/articles/ja/alchemy-editor-window.md new file mode 100644 index 0000000..c6870b6 --- /dev/null +++ b/docs/articles/ja/alchemy-editor-window.md @@ -0,0 +1,53 @@ +# AlchemyEditorWindow + +`EditorWindow`の代わりに`AlchemyEditorWindow`を継承することで、Alchemyの属性を用いてエディタウィンドウを作成することができるようになります。 + +```cs +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; +using Alchemy.Editor; +using Alchemy.Inspector; + +public class EditorWindowExample : AlchemyEditorWindow +{ + [MenuItem("Window/Example")] + static void Open() + { + var window = GetWindow("Example"); + window.Show(); + } + + [Serializable] + [HorizontalGroup] + public class DatabaseItem + { + [LabelWidth(30f)] + public float foo; + + [LabelWidth(30f)] + public Vector3 bar; + + [LabelWidth(30f)] + public GameObject baz; + } + + [ListViewSettings(ShowAlternatingRowBackgrounds = AlternatingRowBackground.All, ShowFoldoutHeader = false)] + public List items; + + [Button, HorizontalGroup] + public void Button1() { } + + [Button, HorizontalGroup] + public void Button2() { } + + [Button, HorizontalGroup] + public void Button3() { } +} +``` + +![img](../../images/img-editor-window.png) + +`AlchemyEditorWindow`を継承して作成したウィンドウのデータは、プロジェクトのProjectSettingsフォルダにjson形式で保存されます。詳細は[EditorWindowのデータを保存する](saving-editor-window-data.md)のページを参照してください。 \ No newline at end of file diff --git a/docs/articles/ja/alchemy-serialization-process.md b/docs/articles/ja/alchemy-serialization-process.md new file mode 100644 index 0000000..fecb178 --- /dev/null +++ b/docs/articles/ja/alchemy-serialization-process.md @@ -0,0 +1,80 @@ +# Alchemyのシリアル化プロセス + +Alchemyでは、対象の型に`[AlchemySerialize]`属性を付加することで専用のSource Generatorが`ISerializationCallbackReceiver`を自動で実装します。この処理の中で`[AlchemySerializeField]`属性が付加されたフィールドを全て取得し、Unity.Serializationパッケージを用いてJson形式に変換します。ただし、UnityEngine.Objectのフィールドに関してはJson形式で扱うことができないため、単一のListに実体を保存しJsonにはそのindexを書き込みます。 + +例えば、以下のようなクラスがあったとします。 + +```cs +using System; +using System.Collections.Generic; +using UnityEngine; +using Alchemy.Serialization; + +[AlchemySerialize] +public partial class AlchemySerializationExample : MonoBehaviour +{ + [AlchemySerializeField, NonSerialized] + public Dictionary dictionary = new(); +} +``` + +これに対し、Alchemyは以下のようなコードを生成します。 + +```cs +partial class AlchemySerializationExample : global::UnityEngine.ISerializationCallbackReceiver +{ + [global::System.Serializable] + sealed class AlchemySerializationData + { + [global::System.Serializable] + public sealed class Item + { + [global::UnityEngine.HideInInspector] public bool isCreated; + [global::UnityEngine.TextArea] public string data; + } + + public Item dictionary = new(); + + [global::UnityEngine.SerializeField] private global::System.Collections.Generic.List unityObjectReferences = new(); + + public global::System.Collections.Generic.IList UnityObjectReferences => unityObjectReferences; + } + + [global::UnityEngine.HideInInspector, global::UnityEngine.SerializeField] private AlchemySerializationData alchemySerializationData = new(); + + void global::UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize() + { + if (this is global::Alchemy.Serialization.IAlchemySerializationCallbackReceiver receiver) receiver.OnBeforeSerialize(); + alchemySerializationData.UnityObjectReferences.Clear(); + + try + { + alchemySerializationData.dictionary.data = global::Alchemy.Serialization.Internal.SerializationHelper.ToJson(this.dictionary , alchemySerializationData.UnityObjectReferences); + alchemySerializationData.dictionary.isCreated = true; + } + catch (global::System.Exception ex) + { + global::UnityEngine.Debug.LogException(ex); + } + } + + void global::UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() + { + try + { + if (alchemySerializationData.dictionary.isCreated) + { + this.dictionary = global::Alchemy.Serialization.Internal.SerializationHelper.FromJson>(alchemySerializationData.dictionary.data, alchemySerializationData.UnityObjectReferences); + } + } + catch (global::System.Exception ex) + { + global::UnityEngine.Debug.LogException(ex); + } + + if (this is global::Alchemy.Serialization.IAlchemySerializationCallbackReceiver receiver) receiver.OnAfterDeserialize(); + } +} +``` + +このような手法を取っているため`[AlchemySerializeField]`を使用するとシリアライズ/デシリアライズにかかる処理負荷が増加します。そのため可能な限り`[AlchemySerializeField]`の使用を避けることが推奨されます。 diff --git a/docs/articles/ja/attributes/assets-only.md b/docs/articles/ja/attributes/assets-only.md new file mode 100644 index 0000000..9721d6f --- /dev/null +++ b/docs/articles/ja/attributes/assets-only.md @@ -0,0 +1,13 @@ +# Assets Only Attribute + +オブジェクトのフィールドに入力可能な参照をアセットに限定します。 + +![img](../../../images/img-attribute-assets-only.png) + +```cs +[AssetsOnly] +public Object asset1; + +[AssetsOnly] +public GameObject asset2; +``` diff --git a/docs/articles/ja/attributes/blockquote.md b/docs/articles/ja/attributes/blockquote.md new file mode 100644 index 0000000..e264aa1 --- /dev/null +++ b/docs/articles/ja/attributes/blockquote.md @@ -0,0 +1,14 @@ +# Blockquote Attribute + +Inspector上に引用句を表示します。 + +![img](../../../images/img-attribute-blockquote.png) + +```cs +[Blockquote("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")] +public float foo; +``` + +| パラメータ | 説明 | +| - | - | +| Text | 引用句に表示するテキスト | diff --git a/docs/articles/ja/attributes/box-group.md b/docs/articles/ja/attributes/box-group.md new file mode 100644 index 0000000..b4c514f --- /dev/null +++ b/docs/articles/ja/attributes/box-group.md @@ -0,0 +1,29 @@ +# Box Group Attribute + +複数のメンバーをボックスにまとめて表示するグループを作成します。 + +![img](../../../images/img-attribute-box-group.png) + +```cs +[BoxGroup("Group1")] +public float foo; + +[BoxGroup("Group1")] +public Vector3 bar; + +[BoxGroup("Group1")] +public GameObject baz; + +[BoxGroup("Group1/Group2")] +public float alpha; + +[BoxGroup("Group1/Group2")] +public Vector3 beta; + +[BoxGroup("Group1/Group2")] +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| GroupPath | グループのパスを指定します。グループは`/`で区切ることでネストすることが可能です。 | diff --git a/docs/articles/ja/attributes/button.md b/docs/articles/ja/attributes/button.md new file mode 100644 index 0000000..4ddea59 --- /dev/null +++ b/docs/articles/ja/attributes/button.md @@ -0,0 +1,30 @@ +# Button Attribute + +メソッドを実行可能なボタンをInspectorに表示します。メソッドが引数を持つ場合には、引数を入力可能なフィールドが追加されます。 + +![img](../../../images/img-attribute-button.png) + +```cs +[Button] +public void Foo() +{ + Debug.Log("Foo"); +} + +[Button] +public void Foo(int parameter) +{ + Debug.Log("Foo: " + parameter); +} + +[Button] +public void Foo(SampleClass parameter) +{ + var builder = new StringBuilder(); + builder.AppendLine(); + builder.Append("foo = ").AppendLine(parameter.foo.ToString()); + builder.Append("bar = ").AppendLine(parameter.bar.ToString()); + builder.Append("baz = ").Append(parameter.baz == null ? "Null" : parameter.baz.ToString()); + Debug.Log("Foo: " + builder.ToString()); +} +``` diff --git a/docs/articles/ja/attributes/disable-alchemy-editor.md b/docs/articles/ja/attributes/disable-alchemy-editor.md new file mode 100644 index 0000000..2bca4d5 --- /dev/null +++ b/docs/articles/ja/attributes/disable-alchemy-editor.md @@ -0,0 +1,15 @@ +# Disable Alchemy Editor Attribute + +対象のクラスのAlchemyEditorを無効化し、デフォルトのInspectorを使用して描画します。フィールドにこの属性を追加した場合、そのフィールドのみをデフォルトのPropertyFieldを用いて描画するように変更します。 + +![img](../../../images/img-attribute-disable-alchemy-editor.png) + +```cs +[DisableAlchemyEditor] +public class DisableAlchemyEditorExample : MonoBehaviour +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} +``` \ No newline at end of file diff --git a/docs/articles/ja/attributes/disable-if.md b/docs/articles/ja/attributes/disable-if.md new file mode 100644 index 0000000..946f869 --- /dev/null +++ b/docs/articles/ja/attributes/disable-if.md @@ -0,0 +1,27 @@ +# Disable If Attribute + +対象のメンバーのbool値がtrueの場合、フィールドが編集不可能になります。 + +![img](../../../images/img-attribute-disable-if-false.png) + +![img](../../../images/img-attribute-disable-if-true.png) + +```cs +public bool isDisabled; + +public bool IsDisabled => isDisabled; +public bool IsDisabledMethod() => isDisabled; + +[DisableIf("isDisabled")] +public int disableIfField; + +[DisableIf("IsDisabled")] +public int disableIfProperty; + +[DisableIf("IsDisabledMethod")] +public int disableIfMethod; +``` + +| パラメータ | 説明 | +| - | - | +| Condition | 条件の判定に使用するフィールド、プロパティまたはメソッドの名前 | diff --git a/docs/articles/ja/attributes/disable-in-edit-mode.md b/docs/articles/ja/attributes/disable-in-edit-mode.md new file mode 100644 index 0000000..3150f96 --- /dev/null +++ b/docs/articles/ja/attributes/disable-in-edit-mode.md @@ -0,0 +1,12 @@ +# Disable In Edit Mode Attribute + +Edit Mode中はフィールドが編集不可能になります。 + +![img](../../../images/img-attribute-disable-in-edit-mode-editor.png) + +![img](../../../images/img-attribute-disable-in-edit-mode-player.png) + +```cs +[DisableInEditMode] +public float foo; +``` diff --git a/docs/articles/ja/attributes/disable-in-play-mode.md b/docs/articles/ja/attributes/disable-in-play-mode.md new file mode 100644 index 0000000..e110053 --- /dev/null +++ b/docs/articles/ja/attributes/disable-in-play-mode.md @@ -0,0 +1,12 @@ +# Disable In Play Mode Attribute + +Play Mode中はフィールドが編集不可能になります。 + +![img](../../../images/img-attribute-disable-in-play-mode-editor.png) + +![img](../../../images/img-attribute-disable-in-play-mode-player.png) + +```cs +[DisableInPlayMode] +public float foo; +``` diff --git a/docs/articles/ja/attributes/enable-if.md b/docs/articles/ja/attributes/enable-if.md new file mode 100644 index 0000000..220a7de --- /dev/null +++ b/docs/articles/ja/attributes/enable-if.md @@ -0,0 +1,27 @@ +# Enable If Attribute + +対象のメンバーのbool値がtrueの場合にのみフィールドを編集可能になります。 + +![img](../../../images/img-attribute-enable-if-false.png) + +![img](../../../images/img-attribute-enable-if-true.png) + +```cs +public bool isEnabled; + +public bool IsEnabled => isEnabled; +public bool IsEnabledMethod() => isEnabled; + +[EnableIf("isEnabled")] +public int enableIfField; + +[EnableIf("IsEnabled")] +public int enableIfProperty; + +[EnableIf("IsEnabledMethod")] +public int enableIfMethod; +``` + +| パラメータ | 説明 | +| - | - | +| Condition | 条件の判定に使用するフィールド、プロパティまたはメソッドの名前 | diff --git a/docs/articles/ja/attributes/foldout-group.md b/docs/articles/ja/attributes/foldout-group.md new file mode 100644 index 0000000..fc263cc --- /dev/null +++ b/docs/articles/ja/attributes/foldout-group.md @@ -0,0 +1,29 @@ +# Foldout Group Attribute + +複数のメンバーを折りたたみ可能なグループを作成します。 + +![img](../../../images/img-attribute-foldout-group.png) + +```cs +[FoldoutGroup("Group1")] +public float foo; + +[FoldoutGroup("Group1")] +public Vector3 bar; + +[FoldoutGroup("Group1")] +public GameObject baz; + +[FoldoutGroup("Group2")] +public float alpha; + +[FoldoutGroup("Group2")] +public Vector3 beta; + +[FoldoutGroup("Group2")] +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| GroupPath | グループのパスを指定します。グループは`/`で区切ることでネストすることが可能です。 | diff --git a/docs/articles/ja/attributes/group.md b/docs/articles/ja/attributes/group.md new file mode 100644 index 0000000..7e515d6 --- /dev/null +++ b/docs/articles/ja/attributes/group.md @@ -0,0 +1,29 @@ +# Group Attribute + +複数のメンバーをまとめて表示するグループを作成します。 + +![img](../../../images/img-attribute-group.png) + +```cs +[Group("Group1")] +public float foo; + +[Group("Group1")] +public Vector3 bar; + +[Group("Group1")] +public GameObject baz; + +[Group("Group2")] +public float alpha; + +[Group("Group2")] +public Vector3 beta; + +[Group("Group2")] +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| GroupPath | グループのパスを指定します。グループは`/`で区切ることでネストすることが可能です。 | diff --git a/docs/articles/ja/attributes/help-box.md b/docs/articles/ja/attributes/help-box.md new file mode 100644 index 0000000..a69ba5b --- /dev/null +++ b/docs/articles/ja/attributes/help-box.md @@ -0,0 +1,21 @@ +# Help Box Attribute + +フィールドの上にメモや警告を追加します。 + +![img](../../../images/img-attribute-help-box.png) + +```cs +[HelpBox("Custom Info")] +public float foo; + +[HelpBox("Custom Warning", HelpBoxMessageType.Warning)] +public Vector2 bar; + +[HelpBox("Custom Error", HelpBoxMessageType.Error)] +public GameObject baz; +``` + +| パラメータ | 説明 | +| - | - | +| Message | ボックス内に表示するテキスト | +| MessageType | メッセージの種類 | \ No newline at end of file diff --git a/docs/articles/ja/attributes/hide-if.md b/docs/articles/ja/attributes/hide-if.md new file mode 100644 index 0000000..a2a6f5f --- /dev/null +++ b/docs/articles/ja/attributes/hide-if.md @@ -0,0 +1,28 @@ +# Hide If Attribute + +対象のメンバーのbool値がtrueの場合はInspectorに表示されなくなります。 + +![img](../../../images/img-attribute-hide-if-false.png) + +![img](../../../images/img-attribute-hide-if-true.png) + +```cs +public bool hide; + +public bool Hide => hide; +public bool IsHideTrue() => hide; + +[HideIf("hide")] +public int hideIfField; + +[HideIf("Hide")] +public int hideIfProperty; + +[HideIf("IsHideTrue")] +public int hideIfMethod; +``` + + +| パラメータ | 説明 | +| - | - | +| Condition | 条件の判定に使用するフィールド、プロパティまたはメソッドの名前 | diff --git a/docs/articles/ja/attributes/hide-in-edit-mode.md b/docs/articles/ja/attributes/hide-in-edit-mode.md new file mode 100644 index 0000000..e2bc4e9 --- /dev/null +++ b/docs/articles/ja/attributes/hide-in-edit-mode.md @@ -0,0 +1,12 @@ +# Hide In Edit Mode Attribute + +Edit Mode中はフィールドが非表示になります。 + +![img](../../../images/img-attribute-hide-in-edit-mode-editor.png) + +![img](../../../images/img-attribute-hide-in-edit-mode-player.png) + +```cs +[HideInEditMode] +public float foo; +``` diff --git a/docs/articles/ja/attributes/hide-in-play-mode.md b/docs/articles/ja/attributes/hide-in-play-mode.md new file mode 100644 index 0000000..9fb9492 --- /dev/null +++ b/docs/articles/ja/attributes/hide-in-play-mode.md @@ -0,0 +1,12 @@ +# Hide In Play Mode Attribute + +Play Mode中はフィールドが非表示になります。 + +![img](../../../images/img-attribute-hide-in-play-mode-editor.png) + +![img](../../../images/img-attribute-hide-in-play-mode-player.png) + +```cs +[HideInPlayMode] +public float foo; +``` diff --git a/docs/articles/ja/attributes/hide-label.md b/docs/articles/ja/attributes/hide-label.md new file mode 100644 index 0000000..84b355a --- /dev/null +++ b/docs/articles/ja/attributes/hide-label.md @@ -0,0 +1,16 @@ +# Hide Label Attribute + +フィールドのラベルを非表示にします。 + +![img](../../../images/img-attribute-hide-label.png) + +```cs +[HideLabel] +public float foo; + +[HideLabel] +public Vector3 bar; + +[HideLabel] +public GameObject baz; +``` \ No newline at end of file diff --git a/docs/articles/ja/attributes/hide-script-field.md b/docs/articles/ja/attributes/hide-script-field.md new file mode 100644 index 0000000..05e4c58 --- /dev/null +++ b/docs/articles/ja/attributes/hide-script-field.md @@ -0,0 +1,15 @@ +# Hide Script Field Attribute + +対象のScriptフィールドを非表示にします。 + +![img](../../../images/img-attribute-hide-script-field.png) + +```cs +[HideScriptField] +public class HideScriptFieldSample : MonoBehaviour +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} +``` diff --git a/docs/articles/ja/attributes/horizontal-group.md b/docs/articles/ja/attributes/horizontal-group.md new file mode 100644 index 0000000..20d5beb --- /dev/null +++ b/docs/articles/ja/attributes/horizontal-group.md @@ -0,0 +1,44 @@ +# Horizontal Attribute + +複数のメンバーを水平方向に並べて表示するグループを作成します。 + +![img](../../../images/img-attribute-horizontal-group.png) + +```cs +[HorizontalGroup("Group1")] +public int a; + +[HorizontalGroup("Group1")] +public int b; + +[HorizontalGroup("Group1")] +public int c; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box1")] +public float foo; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box1")] +public Vector3 bar; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box1")] +public GameObject baz; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box2")] +public float alpha; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box2")] +public Vector3 beta; + +[HorizontalGroup("Group2")] +[BoxGroup("Group2/Box2")] +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| GroupPath | グループのパスを指定します。グループは`/`で区切ることでネストすることが可能です。 | diff --git a/docs/articles/ja/attributes/horizontal-line.md b/docs/articles/ja/attributes/horizontal-line.md new file mode 100644 index 0000000..cd144a9 --- /dev/null +++ b/docs/articles/ja/attributes/horizontal-line.md @@ -0,0 +1,23 @@ +# Horizontal Line Attribute + +Inspectorに仕切り線を追加します。 + +![img](../../../images/img-attribute-horizontal-line.png) + +```cs +[HorizontalLine] +public float foo; + +[HorizontalLine(1f, 0f, 0f)] +public Vector2 bar; + +[HorizontalLine(1f, 0.5f, 0f, 0.5f)] +public GameObject baz; +``` + +| パラメータ | 説明 | +| - | - | +| r | 線の色の赤成分 | +| g | 線の色の緑成分 | +| b | 線の色の青成分 | +| a | 線の色のアルファ値 | \ No newline at end of file diff --git a/docs/articles/ja/attributes/indent.md b/docs/articles/ja/attributes/indent.md new file mode 100644 index 0000000..39e1001 --- /dev/null +++ b/docs/articles/ja/attributes/indent.md @@ -0,0 +1,20 @@ +# Indent Attribute + +フィールドにインデントを追加します。 + +![img](../../../images/img-attribute-indent.png) + +```cs +[Indent] +public float foo; + +[Indent(2)] +public Vector2 bar; + +[Indent(3)] +public GameObject baz; +``` + +| パラメータ | 説明 | +| - | - | +| Indent | インデントの数 | diff --git a/docs/articles/ja/attributes/inline-editor.md b/docs/articles/ja/attributes/inline-editor.md new file mode 100644 index 0000000..03d1064 --- /dev/null +++ b/docs/articles/ja/attributes/inline-editor.md @@ -0,0 +1,10 @@ +# Inline Editor Attribute + +対象のScriptableObjectやコンポーネントのInspectorをインラインで表示し、編集が可能になります。 + +![img](../../../images/img-attribute-inline-editor.png) + +```cs +[InlineEditor] +public SampleScriptableObject sample; +``` diff --git a/docs/articles/ja/attributes/label-text.md b/docs/articles/ja/attributes/label-text.md new file mode 100644 index 0000000..ce766f2 --- /dev/null +++ b/docs/articles/ja/attributes/label-text.md @@ -0,0 +1,30 @@ +# Label Text Attribute + +フィールドのラベルのテキストを上書きします。 + +![img](../../../images/img-attribute-label-text.png) + +```cs +[LabelText("FOO!")] +public float foo; + +[LabelText("BAR!")] +public Vector3 bar; + +[LabelText("BAZ!")] +public GameObject baz; + +[Space] +[LabelText("α")] +public float alpha; + +[LabelText("β")] +public Vector3 beta; + +[LabelText("γ")] +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| Text | フィールドのラベルに表示するテキスト | \ No newline at end of file diff --git a/docs/articles/ja/attributes/list-view-settings.md b/docs/articles/ja/attributes/list-view-settings.md new file mode 100644 index 0000000..41b9dd0 --- /dev/null +++ b/docs/articles/ja/attributes/list-view-settings.md @@ -0,0 +1,28 @@ +# List View Settings Attribute + +コレクションの表示に関する設定を変更します。この属性を用いることで行を見やすくしたり、要素数/要素順をInspectorから変更不可能な配列を作成したりすることが可能になります。 + +![img](../../../images/img-attribute-list-view-settings.png) + +```cs +[ListViewSettings(ShowAlternatingRowBackgrounds = AlternatingRowBackground.All, ShowFoldoutHeader = false)] +public int[] array1; + +[ListViewSettings(Reorderable = false, ShowAddRemoveFooter = false, ShowBorder = false, ShowBoundCollectionSize = false)] +public Vector3[] array2 = new Vector3[] +{ + Vector3.zero, + Vector3.one +}; +``` + +| パラメータ | 説明 | +| - | - | +| ShowAddRemoveFooter | 要素の追加/削除を行うフッターを表示するか | +| ShowAlternatingRowBackgrounds | 一行ごとに背景色を変更するかどうか | +| ShowBorder | 境界線を表示するか | +| ShowBoundCollectionSize | 要素数を変更するフィールドを表示するか | +| ShowFoldoutHeader | 折りたたみ可能なヘッダーを表示するか | +| SelectionType | 要素の選択に関する設定 | +| Reorderable | 要素を並び替え可能か | +| ReorderMode | 並び替えの表示に関する設定 | diff --git a/docs/articles/ja/attributes/on-inspector-destroy.md b/docs/articles/ja/attributes/on-inspector-destroy.md new file mode 100644 index 0000000..cf11021 --- /dev/null +++ b/docs/articles/ja/attributes/on-inspector-destroy.md @@ -0,0 +1,11 @@ +# On Inspector Destroy Attribute + +Inspectorが破棄された際にメソッドを実行します。 + +```cs +[OnInspectorDestroy] +void OnInspectorDestroy() +{ + Debug.Log("Destroy"); +} +``` \ No newline at end of file diff --git a/docs/articles/ja/attributes/on-inspector-disable.md b/docs/articles/ja/attributes/on-inspector-disable.md new file mode 100644 index 0000000..895d566 --- /dev/null +++ b/docs/articles/ja/attributes/on-inspector-disable.md @@ -0,0 +1,11 @@ +# On Inspector Disable Attribute + +Inspectorが無効化された際にメソッドを実行します。 + +```cs +[OnInspectorDisable] +void OnInspectorDisable() +{ + Debug.Log("Disable"); +} +``` \ No newline at end of file diff --git a/docs/articles/ja/attributes/on-inspector-enable.md b/docs/articles/ja/attributes/on-inspector-enable.md new file mode 100644 index 0000000..f455cce --- /dev/null +++ b/docs/articles/ja/attributes/on-inspector-enable.md @@ -0,0 +1,11 @@ +# On Inspector Enable Attribute + +Inspectorが有効化された際にメソッドを実行します。 + +```cs +[OnInspectorEnable] +void OnInspectorEnable() +{ + Debug.Log("Enable"); +} +``` \ No newline at end of file diff --git a/docs/articles/ja/attributes/on-value-changed.md b/docs/articles/ja/attributes/on-value-changed.md new file mode 100644 index 0000000..045c86f --- /dev/null +++ b/docs/articles/ja/attributes/on-value-changed.md @@ -0,0 +1,17 @@ +# On Value Changed Attribute + +フィールドの値が変更された際に、指定された名前のメソッドを実行します。 + +```cs +[OnValueChanged("OnValueChanged")] +public int foo; + +void OnValueChanged(int value) +{ + Debug.Log(value); +} +``` + +| パラメータ | 説明 | +| - | - | +| MethodName | 値の変更時に呼ばれるメソッドの名前 | \ No newline at end of file diff --git a/docs/articles/ja/attributes/order.md b/docs/articles/ja/attributes/order.md new file mode 100644 index 0000000..aaa8ebf --- /dev/null +++ b/docs/articles/ja/attributes/order.md @@ -0,0 +1,20 @@ +# Order Attribute + +フィールドの表示順を変更します。Orderのデフォルト値は0で、メンバーは昇順に表示されます。 + +![img](../../../images/img-attribute-order.png) + +```cs +[Order(2)] +public float foo; + +[Order(1)] +public Vector3 bar; + +[Order(0)] +public GameObject baz; +``` + +| パラメータ | 説明 | +| - | - | +| Order | メンバーの表示順 | diff --git a/docs/articles/ja/attributes/read-only.md b/docs/articles/ja/attributes/read-only.md new file mode 100644 index 0000000..cf1ee2a --- /dev/null +++ b/docs/articles/ja/attributes/read-only.md @@ -0,0 +1,19 @@ +# Read Only Attribute + +フィールドを編集不可能にします。 + +![img](../../../images/img-attribute-read-only.png) + +```cs +[ReadOnly] +public float field = 2.5f; + +[ReadOnly] +public int[] array = new int[5]; + +[ReadOnly] +public SampleClass classField; + +[ReadOnly] +public SampleClass[] classArray = new SampleClass[3]; +``` diff --git a/docs/articles/ja/attributes/required.md b/docs/articles/ja/attributes/required.md new file mode 100644 index 0000000..3a5a44c --- /dev/null +++ b/docs/articles/ja/attributes/required.md @@ -0,0 +1,17 @@ +# Required Attribute + +フィールドにオブジェクトの参照が割り当てられていない場合に警告を表示します。 + +![img](../../../images/img-attribute-required.png) + +```cs +[Required] +public GameObject requiredField1; + +[Required("Custom message")] +public Material requiredField2; +``` + +| パラメータ | 説明 | +| - | - | +| Message | 警告に表示するテキスト | \ No newline at end of file diff --git a/docs/articles/ja/attributes/show-if.md b/docs/articles/ja/attributes/show-if.md new file mode 100644 index 0000000..bc62d54 --- /dev/null +++ b/docs/articles/ja/attributes/show-if.md @@ -0,0 +1,28 @@ +# Show If Attribute + +対象のメンバーのbool値がtrueの場合にのみInspectorに表示されます。 + +![img](../../../images/img-attribute-show-if-false.png) + +![img](../../../images/img-attribute-show-if-true.png) + +```cs +public bool show; + +public bool Show => show; +public bool IsShowTrue() => show; + +[ShowIf("show")] +public int showIfField; + +[ShowIf("Show")] +public int showIfProperty; + +[ShowIf("IsShowTrue")] +public int showIfMethod; +``` + + +| パラメータ | 説明 | +| - | - | +| Condition | 条件の判定に使用するフィールド、プロパティまたはメソッドの名前 | diff --git a/docs/articles/ja/attributes/show-in-inspector.md b/docs/articles/ja/attributes/show-in-inspector.md new file mode 100644 index 0000000..e8369b1 --- /dev/null +++ b/docs/articles/ja/attributes/show-in-inspector.md @@ -0,0 +1,19 @@ +# Show In Inspector Attribute + +シリアライズされていないフィールドやプロパティをInspectorから編集可能にします。これらの値はシリアライズされず、変更は保存されないことに留意してください。 + +![img](../../../images/img-attribute-show-in-inspector.png) + +```cs +[NonSerialized, ShowInInspector] +public int field; + +[NonSerialized, ShowInInspector] +public SampleClass classField = new(); + +[ShowInInspector] +public int Getter => 10; + +[field: NonSerialized, ShowInInspector] +public string Property { get; set; } = string.Empty; +``` diff --git a/docs/articles/ja/attributes/tab-group.md b/docs/articles/ja/attributes/tab-group.md new file mode 100644 index 0000000..2287896 --- /dev/null +++ b/docs/articles/ja/attributes/tab-group.md @@ -0,0 +1,30 @@ +# Tab Group Attribute + +複数のメンバーをタブに分割するグループを作成します。 + +![img](../../../images/img-attribute-tab-group.png) + +```cs +[TabGroup("Group1", "Tab1")] +public float foo; + +[TabGroup("Group1", "Tab2")] +public Vector3 bar; + +[TabGroup("Group1", "Tab3")] +public GameObject baz; + +[TabGroup("Group1", "Tab1")] +public float alpha; + +[TabGroup("Group1", "Tab2")] +public Vector3 beta; + +[TabGroup("Group1", "Tab3")] +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| GroupPath | グループのパスを指定します。グループは`/`で区切ることでネストすることが可能です。 | +| TabName | メンバーが所属するタブの名前を指定します。 | diff --git a/docs/articles/ja/attributes/title.md b/docs/articles/ja/attributes/title.md new file mode 100644 index 0000000..f628bab --- /dev/null +++ b/docs/articles/ja/attributes/title.md @@ -0,0 +1,22 @@ +# Title Attribute + +Inspector上に区切り線付きのヘッダーを表示します。 + +![img](../../../images/img-attribute-title.png) + +```cs +[Title("Title1")] +public float foo; +public Vector3 bar; +public GameObject baz; + +[Title("Title2", "Subtitle")] +public float alpha; +public Vector3 beta; +public GameObject gamma; +``` + +| パラメータ | 説明 | +| - | - | +| Title | ヘッダーに表示するテキスト | +| Subtitle | タイトルの下に小さく表示されるテキスト | \ No newline at end of file diff --git a/docs/articles/ja/attributes/validate-input.md b/docs/articles/ja/attributes/validate-input.md new file mode 100644 index 0000000..d4f7470 --- /dev/null +++ b/docs/articles/ja/attributes/validate-input.md @@ -0,0 +1,28 @@ +# Validate Input Attribute + +指定された名前のメンバーの値がfalseである場合に警告を表示します。 + +![img](../../../images/img-attribute-validate-input.png) + +```cs +[ValidateInput("IsNotNull")] +public GameObject obj; + +[ValidateInput("IsZeroOrGreater", "foo must be 0 or greater.")] +public int foo = -1; + +static bool IsNotNull(GameObject go) +{ + return go != null; +} + +static bool IsZeroOrGreater(int a) +{ + return a >= 0; +} +``` + +| パラメータ | 説明 | +| - | - | +| Condition | 値の検証に使用するフィールド、プロパティまたはメソッドの名前 | +| Message | 警告に表示するテキスト | \ No newline at end of file diff --git a/docs/articles/ja/button-attribute.md b/docs/articles/ja/button-attribute.md new file mode 100644 index 0000000..4e715ce --- /dev/null +++ b/docs/articles/ja/button-attribute.md @@ -0,0 +1,46 @@ +# Button属性 + +メソッドに`[Button]`属性を追加することで、Inspector上にメソッドを実行するボタンを表示できます。 + +```cs +using System; +using System.Text; +using UnityEngine; +using Alchemy.Inspector; + +[Serializable] +public sealed class Example +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} + +public class ButtonAttributeExample : MonoBehaviour +{ + [Button] + public void Foo() + { + Debug.Log("Foo"); + } + + [Button] + public void Foo(int parameter) + { + Debug.Log("Foo: " + parameter); + } + + [Button] + public void Foo(Example parameter) + { + var builder = new StringBuilder(); + builder.AppendLine(); + builder.Append("foo = ").AppendLine(parameter.foo.ToString()); + builder.Append("bar = ").AppendLine(parameter.bar.ToString()); + builder.Append("baz = ").Append(parameter.baz == null ? "Null" : parameter.baz.ToString()); + Debug.Log("Foo: " + builder.ToString()); + } +} +``` + +![img](../../images/img-button.png) \ No newline at end of file diff --git a/docs/articles/ja/comparison-with-other-libraries.md b/docs/articles/ja/comparison-with-other-libraries.md new file mode 100644 index 0000000..324db84 --- /dev/null +++ b/docs/articles/ja/comparison-with-other-libraries.md @@ -0,0 +1,16 @@ +# 他ライブラリとの比較 + +Alchemyは他のエディタ拡張用のアセットと同等、またはそれ以上の非常に豊富な機能を搭載しています。ここではAlchemyと他のアセット/ライブラリの機能の比較を示します。 + +| | Alchemy | [Odin Inspector & Serializer](https://odininspector.com/) | [NaughtyAttributes](https://github.com/dbrizov/NaughtyAttributes) | [Tri Inspector](https://github.com/codewriter-packages/Tri-Inspector) | [Unity Editor Toolbox](https://github.com/arimger/Unity-Editor-Toolbox) | +| - | - | - | - | - | - | +| オープンソース | ✔︎ | ❌ | ✔︎ | ✔︎ | ✔︎ | +| グループ化属性 | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | +| Button属性 | ✔︎ | ✔︎ | ✔︎
(引数なし) | ✔︎ | ✔︎
(引数なし) | +| NonSerializedメンバーの編集 | ✔︎ | ✔︎ | ❌ | ✔︎ | ❌ | +| SerializeReference対応 | ✔︎ | ✔︎ | ❌ | ✔︎ | ✔︎ | +| シリアル化拡張 | ✔︎
(partialが必要) | ✔︎
(専用型を継承) | ❌ | ❌ | ❌
(シリアル化可能な型の提供) | +| UI Toolkit対応 | ✔︎ | ✔︎ | ❌ | ✔︎ | ❌ | +| EditorWindow拡張 | ✔︎ | ✔︎ | ❌ | ❌ | ❌ | +| Hierarchy拡張 | ✔︎ | ❌ | ❌ | ❌ | ✔︎ | + diff --git a/docs/articles/ja/creating-custom-attribute.md b/docs/articles/ja/creating-custom-attribute.md new file mode 100644 index 0000000..182d53f --- /dev/null +++ b/docs/articles/ja/creating-custom-attribute.md @@ -0,0 +1,48 @@ +# カスタム属性を作成する + +`AlchemyAttributeDrawer`を使用することで、Alchemy上で動作する独自の属性を作成することが可能です。ここでは例として`HelpBoxAttribute`とそのDrawerの実装を示します。 + +まずは、フィールドやプロパティに追加する属性を定義します。 + +```cs +using System; +using UnityEngine.UIElements; + +public sealed class HelpBoxAttribute : Attribute +{ + public HelpBoxAttribute(string message, HelpBoxMessageType messageType = HelpBoxMessageType.Info) + { + Message = message; + MessageType = messageType; + } + + public string Message { get; } + public HelpBoxMessageType MessageType { get; } +} +``` + +次に、定義した属性に対応するDrawerを作成します。Drawerを定義したcsファイルはEditorフォルダ以下に配置する必要があります。 + +```cs +using UnityEngine.UIElements; +using Alchemy.Editor; + +[CustomAttributeDrawer(typeof(HelpBoxAttribute))] +public sealed class HelpBoxDrawer : AlchemyAttributeDrawer +{ + HelpBox helpBox; + + public override void OnCreateElement() + { + var att = (HelpBoxAttribute)Attribute; + helpBox = new HelpBox(att.Message, att.MessageType); + + var parent = TargetElement.parent; + parent.Insert(parent.IndexOf(TargetElement), helpBox); + } +} +``` + +`OnCreateElement()`メソッドを実装することで、対象のメンバーに対応したVisualElementを作成した際に処理を追加することができます。描画処理を上書きする通常の`PropertyDrawer`とは異なり、こちらはVisual Elementの作成後に後処理を追加する動作であることに注意してください。この仕組みによってAlchemyは複数のDrawerを組み合わせることを可能にしています。 + +また、定義したDrawerには`CustomAttributeDrawer`属性を追加し、引数に定義した属性の型を追加する必要があります。この属性をもとにAlchemyは要素の描画に必要なDrawerの検索を行います。 \ No newline at end of file diff --git a/docs/articles/ja/creating-custom-group-attribute.md b/docs/articles/ja/creating-custom-group-attribute.md new file mode 100644 index 0000000..6eef23e --- /dev/null +++ b/docs/articles/ja/creating-custom-group-attribute.md @@ -0,0 +1,44 @@ +# カスタムグループ属性を作成する + +`AlchemyGroupDrawer`を使用することで、フィールドをグループ化するための独自の属性を作成することが可能です。ここでは例として`FoldoutGroupAttribute`のそのDrawerの実装を示します。(説明のため実際に使用されている実装から省略した部分があります。) + +まずは、グループの定義に使用する属性を定義します。この属性は`PropertyGroupAttribute`を継承する必要があります。 + +```cs +using Alchemy.Inspector; + +public sealed class FoldoutGroupAttribute : PropertyGroupAttribute +{ + public FoldoutGroupAttribute() : base() { } + public FoldoutGroupAttribute(string groupPath) : base(groupPath) { } +} +``` + +次に、定義した属性に対応するDrawerを作成します。Drawerを定義したcsファイルはEditorフォルダ以下に配置する必要があります。 + +```cs +using UnityEngine.UIElements; +using Alchemy.Editor; + +[CustomGroupDrawer(typeof(FoldoutGroupAttribute))] +public sealed class FoldoutGroupDrawer : AlchemyGroupDrawer +{ + public override VisualElement CreateRootElement(string label) + { + var foldout = new Foldout() + { + style = { + width = Length.Percent(100f) + }, + text = label + }; + + return foldout; + } +} +``` + +`CreateRootElement(string label)`メソッドを実装することで、各グループの親要素となるVisualElementの作成を行います。 + +また、定義したDrawerには`CustomGroupDrawer`属性を追加し、引数に定義した属性の型を追加する必要があります。この属性をもとにAlchemyはグループの描画に必要なDrawerの検索を行います。 + diff --git a/docs/articles/ja/debugging-serialized-data.md b/docs/articles/ja/debugging-serialized-data.md new file mode 100644 index 0000000..76c24cc --- /dev/null +++ b/docs/articles/ja/debugging-serialized-data.md @@ -0,0 +1,21 @@ +# シリアル化データのデバッグ + +`[AlchemySerialize]`と同時に`[ShowAlchemySerializationData]`属性を付加することで、Inspector上からシリアル化されたデータを確認することができるようになります。 + +```cs +using System; +using System.Collections.Generic; +using UnityEngine; +using Alchemy.Serialization; + +[AlchemySerialize] +[ShowAlchemySerializationData] +public partial class AlchemySerializationExample : MonoBehaviour +{ + [AlchemySerializeField, NonSerialized] + public Dictionary dictionary = new(); +} +``` + +![img](../../images/img-show-serialization-data.png) + diff --git a/docs/articles/ja/decorating-hierarchy.md b/docs/articles/ja/decorating-hierarchy.md new file mode 100644 index 0000000..44bc7ff --- /dev/null +++ b/docs/articles/ja/decorating-hierarchy.md @@ -0,0 +1,19 @@ +# Hierarchyの装飾 + +AlchemyではHierarchyにヘッダーや仕切り線を追加することで、Hierarchyをより見やすく、扱いやすいように装飾することが可能になっています。 + +![img](../../images/img-hierarchy.png) + +ヘッダーや仕切り線を追加するには、Hierarchyの「+」ボタンから`Alchemy > Header/Separator`を選択します。 + +![img](../../images/img-create-hierarchy-object.png) + +また、これらの装飾に使われるオブジェクトのことをAlchemyでは`HierarchyObject`と呼び、これらのオブジェクトはビルドからは除外されます。(子オブジェクトが存在する場合は`transform.DetachChildren()`を呼んで全ての子オブジェクトを解除した後に削除されます。) + +`HierarchyObject`の扱いについては`Project Settings > Alchemy`から変更が可能です。 + +![img](../../images/img-project-settings.png) + +個別の`HierarchyObject`の扱いを変更したい際には、各オブジェクトのInspectorから変更できます。 + +![img](../../images/img-hierarchy-header-inspector.png) diff --git a/docs/articles/ja/disable-default-editor.md b/docs/articles/ja/disable-default-editor.md new file mode 100644 index 0000000..c921617 --- /dev/null +++ b/docs/articles/ja/disable-default-editor.md @@ -0,0 +1,5 @@ +# デフォルトのエディタを無効化する + +デフォルトではAlchemyでは独自のEditorクラスを使用して全ての型の描画を行います。ただし、他ライブラリやアセットとの競合を避けるためこれを無効化することもできます。 + +デフォルトのエディタを無効化するには、`Project Settings > Player > Scripting Define Symbols`の項目に`ALCHEMY_DISABLE_DEFAULT_EDITOR`を追加します。これを追加した状態でAlchemyの機能を使用したい場合には、`AlchemyEditor`を継承した独自のEditorクラスを定義する必要があります。 diff --git a/docs/articles/ja/extending-alchemy-editor.md b/docs/articles/ja/extending-alchemy-editor.md new file mode 100644 index 0000000..c9a8ca1 --- /dev/null +++ b/docs/articles/ja/extending-alchemy-editor.md @@ -0,0 +1,21 @@ +# AlchemyEditorを拡張する + +対象のMonoBehaviourやScriptableObjectが独自のEditorクラスを持つ場合、Alchemyの属性は動作しません。 +独自のエディタ拡張とAlchemyを組み合わせたい場合には、通常の`Editor`クラスではなく`AlchemyEditor`クラスを継承する必要があります。 + +```cs +using UnityEditor; +using Alchemy.Editor; + +[CustomEditor(typeof(Example))] +public class EditorExample : AlchemyEditor +{ + public override VisualElement CreateInspectorGUI() + { + // 必ず継承元のCreateInspectorGUIを呼び出す + base.CreateInspectorGUI(); + + // ここに独自の処理を記述する + } +} +``` \ No newline at end of file diff --git a/docs/articles/ja/group-attributes.md b/docs/articles/ja/group-attributes.md new file mode 100644 index 0000000..dcb5653 --- /dev/null +++ b/docs/articles/ja/group-attributes.md @@ -0,0 +1,86 @@ +# グループ属性 + +Alchemyでは、フィールドをグループ化する属性が提供されています。 + +```cs +using UnityEngine; +using Alchemy.Inspector; + +public class GroupAttributesExample : MonoBehaviour +{ + [FoldoutGroup("Foldout")] + public int a; + + [FoldoutGroup("Foldout")] + public int b; + + [FoldoutGroup("Foldout")] + public int c; + + [TabGroup("Tab", "Tab1")] + public int x; + + [TabGroup("Tab", "Tab2")] + public string y; + + [TabGroup("Tab", "Tab3")] + public Vector3 z; +} +``` + +![img](../../images/img-group-1.png) + +各グループはスラッシュで区切ることでネストできます。 + +```cs +using UnityEngine; +using Alchemy.Inspector; + +public class GroupAttributesExample : MonoBehaviour +{ + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box1")] + public float foo; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box1")] + public Vector3 bar; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box1")] + public GameObject baz; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box2")] + public float alpha; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box2")] + public Vector3 beta; + + [HorizontalGroup("Horizontal"), BoxGroup("Horizontal/Box2")] + public GameObject gamma; +} +``` + +![img](../../images/img-group-2.png) + +また、定義したSerializableなクラスにグループ属性を追加することで、メンバーの表示を対応するグループに変更することも可能です。 + +```cs +using System; +using UnityEngine; +using Alchemy.Inspector; + +[Serializable] +[BoxGroup] +public sealed class Example +{ + public float foo; + public Vector3 bar; + public GameObject baz; +} + +public class GroupAttributeExample : MonoBehaviour +{ + public Example example; +} + +``` + +![img](../../images/img-group-3.png) \ No newline at end of file diff --git a/docs/articles/ja/hierarchy-toggles-and-icons.md b/docs/articles/ja/hierarchy-toggles-and-icons.md new file mode 100644 index 0000000..9be7b35 --- /dev/null +++ b/docs/articles/ja/hierarchy-toggles-and-icons.md @@ -0,0 +1,9 @@ +# トグルとアイコン + +Alchemyを導入することで、Hierarchyにオブジェクトのアクティブ/非アクティブを切り替え可能にするトグルや、各コンポーネントのアイコンを追加することができます。 + +![gif](../../images/gif-hierarchy-toggle.gif) + +これらの機能はデフォルトではオフになっています。Hierarchyの表示の設定は`Project Settings > Alchemy`から行うことが可能です。 + +![img](../../images/img-project-settings.png) diff --git a/docs/articles/ja/inspector-extension-with-attributes.md b/docs/articles/ja/inspector-extension-with-attributes.md new file mode 100644 index 0000000..e44f108 --- /dev/null +++ b/docs/articles/ja/inspector-extension-with-attributes.md @@ -0,0 +1,28 @@ +# 属性を用いたInspector拡張 + +Alchemyでは属性を用いてInspectorを拡張することが可能です。Inspectorの表示をカスタマイズしたい場合には、クラスが持つフィールドに属性を付加します。 + +```cs +using UnityEngine; +using UnityEngine.UIElements; +using Alchemy.Inspector; // Alchemy.Inspector名前空間をusingに追加 + +public class AttributesExample : MonoBehaviour +{ + [LabelText("Custom Label")] + public float foo; + + [HideLabel] + public Vector3 bar; + + [AssetsOnly] + public GameObject baz; + + [Title("Title")] + [HelpBox("HelpBox", HelpBoxMessageType.Info)] + [ReadOnly] + public string message = "Read Only"; +} +``` + +![img](../../images/img-attributes-example.png) diff --git a/docs/articles/ja/installation.md b/docs/articles/ja/installation.md new file mode 100644 index 0000000..c84a86e --- /dev/null +++ b/docs/articles/ja/installation.md @@ -0,0 +1,40 @@ +# インストール + +プロジェクトにAlchemyをインストールして使用を開始しましょう。 + +### 要件 + +* Unity 2021.2 以上 (シリアル化拡張を使用する場合、2022.1以上を推奨) +* Serialization 2.0 以上 (シリアル化拡張を使用する場合) + +### Package Manager経由でインストール (推奨) + +Package Managerを利用してAlchemyをインストールできます。 + +1. Window > Package ManagerからPackage Managerを開く +2. 「+」ボタン > Add package from git URL +3. 以下のURLを入力する + +```text +https://github.com/AnnulusGames/Alchemy.git?path=/Alchemy/Assets/Alchemy +``` + +![img1](../../images/img-setup-1.png) + +あるいはPackages/manifest.jsonを開き、dependenciesブロックに以下を追記します。 + +```json +{ + "dependencies": { + "com.annulusgames.alchemy": "https://github.com/AnnulusGames/Alchemy.git?path=/Alchemy/Assets/Alchemy" + } +} +``` + +### unitypackageからインストール + +配布されているunitypackageファイルからAlchemyをインストールすることも可能です。 + +1. Releasesから最新のリリースに移動 +2. unitypackageファイルをダウンロード +3. ファイルを開き、プロジェクトにインポートする \ No newline at end of file diff --git a/docs/articles/ja/saving-editor-window-data.md b/docs/articles/ja/saving-editor-window-data.md new file mode 100644 index 0000000..46da1a5 --- /dev/null +++ b/docs/articles/ja/saving-editor-window-data.md @@ -0,0 +1,39 @@ +# EditorWindowのデータを保存する + +`AlchemyEditorWindow`を継承して作成したエディタウィンドウのフィールドのデータは、自動的にプロジェクトのProjectSettingsフォルダ内にjson形式で保存されます。 + +`SaveWindowData()`, `LoadWindowData()`, `GetWindowDataPath()`をオーバーライドすることで、データの保存/読み込みの処理、保存先のパスを変更することができます。 + +```cs +using UnityEditor; +using UnityEngine; +using Alchemy.Editor; + +public class EditorWindowExample : AlchemyEditorWindow +{ + [MenuItem("Window/Example")] + static void Open() + { + var window = GetWindow("Example"); + window.Show(); + } + + protected override string GetWindowDataPath() + { + // データの保存先のパスを返す + return ... + } + + protected override void LoadWindowData(string dataPath) + { + // データの読み込み処理を記述 + ... + } + + protected override void SaveWindowData(string dataPath) + { + // データの保存処理を記述 + ... + } +} +``` \ No newline at end of file diff --git a/docs/articles/ja/serialization-callback.md b/docs/articles/ja/serialization-callback.md new file mode 100644 index 0000000..b1236e8 --- /dev/null +++ b/docs/articles/ja/serialization-callback.md @@ -0,0 +1,21 @@ +# シリアル化コールバック + +`[AlchemySerialize]`属性を使用するとSource Generatorが`ISerializationCallbackReceiver`を実装するため、通常通り`ISerializationCallbackReceiver`を使用してコールバックを追加することができません。 + +そのため、Alchemyでは代替となるインターフェースとして`IAlchemySerializationCallbackReceiver`を提供しています。`[AlchemySerialize]`を使用する際には`ISerializationCallbackReceiver`の代わりにこちらを利用してください。 + +```cs +[AlchemySerialize] +public partial class AlchemySerializationSample : MonoBehaviour, IAlchemySerializationCallbackReceiver +{ + public void OnAfterDeserialize() + { + Debug.Log("OnAfterDeserialize"); + } + + public void OnBeforeSerialize() + { + Debug.Log("OnBeforeSerialize"); + } +} +``` \ No newline at end of file diff --git a/docs/articles/ja/serialization-extension.md b/docs/articles/ja/serialization-extension.md new file mode 100644 index 0000000..140dc5a --- /dev/null +++ b/docs/articles/ja/serialization-extension.md @@ -0,0 +1,51 @@ +# シリアル化拡張 + +Dictionaryなどの通常のUnityがシリアル化できない型を編集したい場合、`[AlchemySerialize]`属性を使用してシリアル化を行うことができます。 + +シリアル化拡張を使用したい場合、[Unity.Serialization](https://docs.unity3d.com/Packages/com.unity.serialization@3.1/manual/index.html)パッケージが必要になります。また、リフレクションを用いたUnity.Serializationのシリアル化はUnity2022.1以前のAOT環境で動作しない可能性があります。詳細はパッケージのマニュアルを確認してください。 + +以下はAlchemyのシリアル化拡張を用いて様々な型をシリアル化し、Inspectorで編集可能にするサンプルです。 + +```cs +using System; +using System.Collections.Generic; +using UnityEngine; +using Alchemy.Serialization; // Alchemy.Serialization名前空間をusingに追加 + +// [AlchemySerialize]属性を付加することでAlchemyのシリアル化拡張が有効化されます。 +// 任意の基底クラスを持つ型に使用できますが、SourceGeneratorがコード生成を行うため対象型はpartialである必要があります。 +[AlchemySerialize] +public partial class AlchemySerializationExample : MonoBehaviour +{ + // 対象のフィールドに[AlchemySerializeField]属性と[NonSerialized]属性を付加します。 + [AlchemySerializeField, NonSerialized] + public HashSet hashSet = new(); + + [AlchemySerializeField, NonSerialized] + public Dictionary dictionary = new(); + + [AlchemySerializeField, NonSerialized] + public (int, int) tuple; + + [AlchemySerializeField, NonSerialized] + public Vector3? nullable = null; +} +``` + +![img](../../images/img-serialization-sample.png) + +現在Inspectorで編集可能な型は以下の通りです。 + +* プリミティブ型 +* UnityEngine.Object +* AnimationCurve +* Gradient +* 配列 +* List<> +* HashSet<> +* Dictionary<,> +* ValueTuple<> +* Nullable<> +* 以上の型のフィールドで構成されるclass/struct + +シリアル化の技術的な詳細については[Alchemyのシリアル化プロセス](alchemy-serialization-process.md)を参照してください。 \ No newline at end of file diff --git a/docs/articles/ja/serialize-reference.md b/docs/articles/ja/serialize-reference.md new file mode 100644 index 0000000..98d145c --- /dev/null +++ b/docs/articles/ja/serialize-reference.md @@ -0,0 +1,40 @@ +# SerializeReference + +AlchemyはUnityの`[SerializeReference]`に対応しています。`[SerializeReference]`属性を付加することで、インターフェースや抽象クラスをInspector上で編集できるようになります。 + +```cs +using System; +using UnityEngine; + +public interface IExample { } + +[Serializable] +public sealed class ExampleA : IExample +{ + public float alpha; +} + +[Serializable] +public sealed class ExampleB : IExample +{ + public Vector3 beta; +} + +[Serializable] +public sealed class ExampleC : IExample +{ + public GameObject gamma; +} + +public class SerializeReferenceExample : MonoBehaviour +{ + [SerializeReference] public IExample example; + [SerializeReference] public IExample[] exampleArray; +} +``` + +![img](../../images/img-serialize-reference.png) + +インターフェース・抽象クラスは上のように表示され、ドロップダウンから子クラスを選択して生成することができます。 + +SerializeReferenceのシリアル化については[Unityの公式マニュアル](https://docs.unity3d.com/ja/2020.3/ScriptReference/SerializeReference.html)を参照してください。 \ No newline at end of file diff --git a/docs/articles/ja/toc.yml b/docs/articles/ja/toc.yml new file mode 100644 index 0000000..58b3324 --- /dev/null +++ b/docs/articles/ja/toc.yml @@ -0,0 +1,134 @@ +- name: Get Started +- name: Alchemyとは + href: about.md +- name: インストール + href: installation.md + +- name: Inspector +- name: 属性を用いたInspector拡張 + href: inspector-extension-with-attributes.md +- name: グループ属性 + href: group-attributes.md +- name: Button属性 + href: button-attribute.md +- name: SerializeReference + href: serialize-reference.md +- name: 属性一覧 + items: + - name: General + - name: Assets Only + href: attributes/assets-only.md + - name: Button + href: attributes/button.md + - name: Disable Alchemy Editor + href: attributes/disable-alchemy-editor.md + - name: Hide Script Field + href: attributes/hide-script-field.md + - name: Indent + href: attributes/indent.md + - name: Inline Editor + href: attributes/inline-editor.md + - name: List View Settings + href: attributes/list-view-settings.md + - name: Order + href: attributes/order.md + - name: Read Only + href: attributes/read-only.md + - name: Show In Inspector + href: attributes/show-in-inspector.md + + - name: Conditionals + - name: Disable If + href: attributes/disable-if.md + - name: Disable In Edit Mode + href: attributes/disable-in-edit-mode.md + - name: Disable In Play Mode + href: attributes/disable-in-play-mode.md + - name: Enable If + href: attributes/enable-if.md + - name: Hide If + href: attributes/hide-if.md + - name: Hide In Edit Mode + href: attributes/hide-in-edit-mode.md + - name: Hide In Play Mode + href: attributes/hide-in-play-mode.md + - name: Show If + href: attributes/show-if.md + + - name: Decoration + - name: Blockquote + href: attributes/blockquote.md + - name: Help Box + href: attributes/help-box.md + - name: Hide Label + href: attributes/hide-label.md + - name: Horizontal Line + href: attributes/horizontal-line.md + - name: Label Text + href: attributes/label-text.md + - name: Title + href: attributes/title.md + + - name: Validation + - name: Required + href: attributes/required.md + - name: Validate Input + href: attributes/validate-input.md + + - name: Events + - name: On Inspector Destroy + href: attributes/on-inspector-destroy.md + - name: On Inspector Disable + href: attributes/on-inspector-disable.md + - name: On Inspector Enable + href: attributes/on-inspector-enable.md + - name: On Value Changed + href: attributes/on-value-changed.md + + - name: Groups + - name: Box Group + href: attributes/box-group.md + - name: Foldout Group + href: attributes/foldout-group.md + - name: Group + href: attributes/group.md + - name: Horizontal Group + href: attributes/horizontal-group.md + - name: Tab Group + href: attributes/tab-group.md + +- name: Hierarchy +- name: トグルとアイコン + href: hierarchy-toggles-and-icons.md +- name: Hierarchyの装飾 + href: decorating-hierarchy.md + +- name: Editor Window +- name: AlchemyEditorWindow + href: alchemy-editor-window.md +- name: EditorWindowのデータを保存する + href: saving-editor-window-data.md + +- name: Serialization +- name: シリアル化拡張 + href: serialization-extension.md +- name: Alchemyのシリアル化プロセス + href: alchemy-serialization-process.md +- name: シリアル化データのデバッグ + href: debugging-serialized-data.md +- name: シリアル化コールバック + href: serialization-callback.md + +- name: Extensions +- name: AlchemyEditorを拡張する + href: extending-alchemy-editor.md +- name: カスタム属性を作成する + href: creating-custom-attribute.md +- name: カスタムグループ属性を作成する + href: creating-custom-group-attribute.md + +- name: Others +- name: デフォルトのエディタを無効化する + href: disable-default-editor.md +- name: 他ライブラリとの比較 + href: comparison-with-other-libraries.md \ No newline at end of file diff --git a/docs/docfx.json b/docs/docfx.json new file mode 100644 index 0000000..d3e2a00 --- /dev/null +++ b/docs/docfx.json @@ -0,0 +1,72 @@ +{ + "metadata": [ + { + "src": [ + { + "files": [ + "Alchemy/Assets/Alchemy/Runtime/**/*.cs", + "Alchemy/Assets/Alchemy/Editor/**/*.cs" + ], + "src": "../" + } + ], + "properties": { + "AllowUnsafeBlocks": true + }, + "dest": "api", + "disableGitFeatures": false, + "disableDefaultFilter": false, + "allowCompilationErrors": true + } + ], + "build": { + "content": [ + { + "files": "**/*.{md,yml}", + "src": "api", + "dest": "api" + }, + { + "files": [ + "articles/en/**.md", + "articles/en/toc.yml", + "articles/ja/**.md", + "articles/ja/toc.yml", + "toc.yml", + "*.md" + ] + } + ], + "resource": [ + { + "files": [ + "images/**" + ] + } + ], + "output": "_site", + "template": [ + "default", + "modern" + ], + "globalMetadata": { + "_appName": "Alchemy", + "_appTitle": "Alchemy", + "_appFooter": "Copyright © 2024 Annulus Games. Generated with DocFX", + "_enableSearch": true, + "pdf": false, + "_appLogoPath": "images/icon.svg", + "_appFaviconPath": "images/favicon.svg", + "_gitContribute": { + "repo": "https://github.com/AnnulusGames/Alchemy" + }, + "_gitUrlPattern": "github" + }, + "xrefService": [ + "https://xref.docs.microsoft.com/query?uid={uid}" + ], + "sitemap": { + "baseUrl": "https://AnnulusGames.github.io/Alchemy" + } + } +} \ No newline at end of file diff --git a/docs/images/favicon.svg b/docs/images/favicon.svg new file mode 100644 index 0000000..3ba5762 --- /dev/null +++ b/docs/images/favicon.svg @@ -0,0 +1,3 @@ + + + diff --git a/docs/images/gif-hierarchy-toggle.gif b/docs/images/gif-hierarchy-toggle.gif new file mode 100644 index 0000000..4312cf8 Binary files /dev/null and b/docs/images/gif-hierarchy-toggle.gif differ diff --git a/docs/images/header.png b/docs/images/header.png new file mode 100644 index 0000000..2052d84 Binary files /dev/null and b/docs/images/header.png differ diff --git a/docs/images/icon.svg b/docs/images/icon.svg new file mode 100644 index 0000000..376859e --- /dev/null +++ b/docs/images/icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/docs/images/img-attribute-assets-only.png b/docs/images/img-attribute-assets-only.png new file mode 100644 index 0000000..ec497b9 Binary files /dev/null and b/docs/images/img-attribute-assets-only.png differ diff --git a/docs/images/img-attribute-blockquote.png b/docs/images/img-attribute-blockquote.png new file mode 100644 index 0000000..a34a081 Binary files /dev/null and b/docs/images/img-attribute-blockquote.png differ diff --git a/docs/images/img-attribute-box-group.png b/docs/images/img-attribute-box-group.png new file mode 100644 index 0000000..acb5390 Binary files /dev/null and b/docs/images/img-attribute-box-group.png differ diff --git a/docs/images/img-attribute-button.png b/docs/images/img-attribute-button.png new file mode 100644 index 0000000..dd4a513 Binary files /dev/null and b/docs/images/img-attribute-button.png differ diff --git a/docs/images/img-attribute-disable-alchemy-editor.png b/docs/images/img-attribute-disable-alchemy-editor.png new file mode 100644 index 0000000..8d1907d Binary files /dev/null and b/docs/images/img-attribute-disable-alchemy-editor.png differ diff --git a/docs/images/img-attribute-disable-if-false.png b/docs/images/img-attribute-disable-if-false.png new file mode 100644 index 0000000..9f1c9c9 Binary files /dev/null and b/docs/images/img-attribute-disable-if-false.png differ diff --git a/docs/images/img-attribute-disable-if-true.png b/docs/images/img-attribute-disable-if-true.png new file mode 100644 index 0000000..9adb9b8 Binary files /dev/null and b/docs/images/img-attribute-disable-if-true.png differ diff --git a/docs/images/img-attribute-disable-in-edit-mode-editor.png b/docs/images/img-attribute-disable-in-edit-mode-editor.png new file mode 100644 index 0000000..fc8acbc Binary files /dev/null and b/docs/images/img-attribute-disable-in-edit-mode-editor.png differ diff --git a/docs/images/img-attribute-disable-in-edit-mode-player.png b/docs/images/img-attribute-disable-in-edit-mode-player.png new file mode 100644 index 0000000..0d75347 Binary files /dev/null and b/docs/images/img-attribute-disable-in-edit-mode-player.png differ diff --git a/docs/images/img-attribute-disable-in-play-mode-editor.png b/docs/images/img-attribute-disable-in-play-mode-editor.png new file mode 100644 index 0000000..3b37d21 Binary files /dev/null and b/docs/images/img-attribute-disable-in-play-mode-editor.png differ diff --git a/docs/images/img-attribute-disable-in-play-mode-player.png b/docs/images/img-attribute-disable-in-play-mode-player.png new file mode 100644 index 0000000..bf16687 Binary files /dev/null and b/docs/images/img-attribute-disable-in-play-mode-player.png differ diff --git a/docs/images/img-attribute-enable-if-false.png b/docs/images/img-attribute-enable-if-false.png new file mode 100644 index 0000000..84fd49a Binary files /dev/null and b/docs/images/img-attribute-enable-if-false.png differ diff --git a/docs/images/img-attribute-enable-if-true.png b/docs/images/img-attribute-enable-if-true.png new file mode 100644 index 0000000..f0db04e Binary files /dev/null and b/docs/images/img-attribute-enable-if-true.png differ diff --git a/docs/images/img-attribute-foldout-group.png b/docs/images/img-attribute-foldout-group.png new file mode 100644 index 0000000..f04e497 Binary files /dev/null and b/docs/images/img-attribute-foldout-group.png differ diff --git a/docs/images/img-attribute-group.png b/docs/images/img-attribute-group.png new file mode 100644 index 0000000..56802d6 Binary files /dev/null and b/docs/images/img-attribute-group.png differ diff --git a/docs/images/img-attribute-help-box.png b/docs/images/img-attribute-help-box.png new file mode 100644 index 0000000..5d4020d Binary files /dev/null and b/docs/images/img-attribute-help-box.png differ diff --git a/docs/images/img-attribute-hide-if-false.png b/docs/images/img-attribute-hide-if-false.png new file mode 100644 index 0000000..c7d8e67 Binary files /dev/null and b/docs/images/img-attribute-hide-if-false.png differ diff --git a/docs/images/img-attribute-hide-if-true.png b/docs/images/img-attribute-hide-if-true.png new file mode 100644 index 0000000..7290a02 Binary files /dev/null and b/docs/images/img-attribute-hide-if-true.png differ diff --git a/docs/images/img-attribute-hide-in-edit-mode-editor.png b/docs/images/img-attribute-hide-in-edit-mode-editor.png new file mode 100644 index 0000000..c055f0c Binary files /dev/null and b/docs/images/img-attribute-hide-in-edit-mode-editor.png differ diff --git a/docs/images/img-attribute-hide-in-edit-mode-player.png b/docs/images/img-attribute-hide-in-edit-mode-player.png new file mode 100644 index 0000000..37cafd6 Binary files /dev/null and b/docs/images/img-attribute-hide-in-edit-mode-player.png differ diff --git a/docs/images/img-attribute-hide-in-play-mode-editor.png b/docs/images/img-attribute-hide-in-play-mode-editor.png new file mode 100644 index 0000000..e9ad9e9 Binary files /dev/null and b/docs/images/img-attribute-hide-in-play-mode-editor.png differ diff --git a/docs/images/img-attribute-hide-in-play-mode-player.png b/docs/images/img-attribute-hide-in-play-mode-player.png new file mode 100644 index 0000000..5ab68d5 Binary files /dev/null and b/docs/images/img-attribute-hide-in-play-mode-player.png differ diff --git a/docs/images/img-attribute-hide-label.png b/docs/images/img-attribute-hide-label.png new file mode 100644 index 0000000..e1ac471 Binary files /dev/null and b/docs/images/img-attribute-hide-label.png differ diff --git a/docs/images/img-attribute-hide-script-field.png b/docs/images/img-attribute-hide-script-field.png new file mode 100644 index 0000000..2232929 Binary files /dev/null and b/docs/images/img-attribute-hide-script-field.png differ diff --git a/docs/images/img-attribute-horizontal-group.png b/docs/images/img-attribute-horizontal-group.png new file mode 100644 index 0000000..1379d17 Binary files /dev/null and b/docs/images/img-attribute-horizontal-group.png differ diff --git a/docs/images/img-attribute-horizontal-line.png b/docs/images/img-attribute-horizontal-line.png new file mode 100644 index 0000000..3657ac9 Binary files /dev/null and b/docs/images/img-attribute-horizontal-line.png differ diff --git a/docs/images/img-attribute-indent.png b/docs/images/img-attribute-indent.png new file mode 100644 index 0000000..1003965 Binary files /dev/null and b/docs/images/img-attribute-indent.png differ diff --git a/docs/images/img-attribute-inline-editor.png b/docs/images/img-attribute-inline-editor.png new file mode 100644 index 0000000..e53ba56 Binary files /dev/null and b/docs/images/img-attribute-inline-editor.png differ diff --git a/docs/images/img-attribute-label-text.png b/docs/images/img-attribute-label-text.png new file mode 100644 index 0000000..e0285fb Binary files /dev/null and b/docs/images/img-attribute-label-text.png differ diff --git a/docs/images/img-attribute-list-view-settings.png b/docs/images/img-attribute-list-view-settings.png new file mode 100644 index 0000000..7ba2ba2 Binary files /dev/null and b/docs/images/img-attribute-list-view-settings.png differ diff --git a/docs/images/img-attribute-order.png b/docs/images/img-attribute-order.png new file mode 100644 index 0000000..3d94a50 Binary files /dev/null and b/docs/images/img-attribute-order.png differ diff --git a/docs/images/img-attribute-read-only.png b/docs/images/img-attribute-read-only.png new file mode 100644 index 0000000..d626f28 Binary files /dev/null and b/docs/images/img-attribute-read-only.png differ diff --git a/docs/images/img-attribute-required.png b/docs/images/img-attribute-required.png new file mode 100644 index 0000000..f38e2ab Binary files /dev/null and b/docs/images/img-attribute-required.png differ diff --git a/docs/images/img-attribute-show-if-false.png b/docs/images/img-attribute-show-if-false.png new file mode 100644 index 0000000..0791736 Binary files /dev/null and b/docs/images/img-attribute-show-if-false.png differ diff --git a/docs/images/img-attribute-show-if-true.png b/docs/images/img-attribute-show-if-true.png new file mode 100644 index 0000000..4ea12c4 Binary files /dev/null and b/docs/images/img-attribute-show-if-true.png differ diff --git a/docs/images/img-attribute-show-in-inspector.png b/docs/images/img-attribute-show-in-inspector.png new file mode 100644 index 0000000..c42540e Binary files /dev/null and b/docs/images/img-attribute-show-in-inspector.png differ diff --git a/docs/images/img-attribute-tab-group.png b/docs/images/img-attribute-tab-group.png new file mode 100644 index 0000000..9b5dd75 Binary files /dev/null and b/docs/images/img-attribute-tab-group.png differ diff --git a/docs/images/img-attribute-title.png b/docs/images/img-attribute-title.png new file mode 100644 index 0000000..862b8af Binary files /dev/null and b/docs/images/img-attribute-title.png differ diff --git a/docs/images/img-attribute-validate-input.png b/docs/images/img-attribute-validate-input.png new file mode 100644 index 0000000..ed6eeae Binary files /dev/null and b/docs/images/img-attribute-validate-input.png differ diff --git a/docs/images/img-attributes-example.png b/docs/images/img-attributes-example.png new file mode 100644 index 0000000..dafe840 Binary files /dev/null and b/docs/images/img-attributes-example.png differ diff --git a/docs/images/img-button.png b/docs/images/img-button.png new file mode 100644 index 0000000..3fa5384 Binary files /dev/null and b/docs/images/img-button.png differ diff --git a/docs/images/img-create-hierarchy-object.png b/docs/images/img-create-hierarchy-object.png new file mode 100644 index 0000000..de512c6 Binary files /dev/null and b/docs/images/img-create-hierarchy-object.png differ diff --git a/docs/images/img-editor-window.png b/docs/images/img-editor-window.png new file mode 100644 index 0000000..4dfeec1 Binary files /dev/null and b/docs/images/img-editor-window.png differ diff --git a/docs/images/img-group-1.png b/docs/images/img-group-1.png new file mode 100644 index 0000000..e191897 Binary files /dev/null and b/docs/images/img-group-1.png differ diff --git a/docs/images/img-group-2.png b/docs/images/img-group-2.png new file mode 100644 index 0000000..f8b6816 Binary files /dev/null and b/docs/images/img-group-2.png differ diff --git a/docs/images/img-group-3.png b/docs/images/img-group-3.png new file mode 100644 index 0000000..6388bad Binary files /dev/null and b/docs/images/img-group-3.png differ diff --git a/docs/images/img-hierarchy-header-inspector.png b/docs/images/img-hierarchy-header-inspector.png new file mode 100644 index 0000000..2153eaf Binary files /dev/null and b/docs/images/img-hierarchy-header-inspector.png differ diff --git a/docs/images/img-hierarchy.png b/docs/images/img-hierarchy.png new file mode 100644 index 0000000..5f767eb Binary files /dev/null and b/docs/images/img-hierarchy.png differ diff --git a/docs/images/img-project-settings.png b/docs/images/img-project-settings.png new file mode 100644 index 0000000..82251c7 Binary files /dev/null and b/docs/images/img-project-settings.png differ diff --git a/docs/images/img-serialization-sample.png b/docs/images/img-serialization-sample.png new file mode 100644 index 0000000..d8db710 Binary files /dev/null and b/docs/images/img-serialization-sample.png differ diff --git a/docs/images/img-serialize-reference.png b/docs/images/img-serialize-reference.png new file mode 100644 index 0000000..fc66d75 Binary files /dev/null and b/docs/images/img-serialize-reference.png differ diff --git a/docs/images/img-setup-1.png b/docs/images/img-setup-1.png new file mode 100644 index 0000000..b63ff75 Binary files /dev/null and b/docs/images/img-setup-1.png differ diff --git a/docs/images/img-show-serialization-data.png b/docs/images/img-show-serialization-data.png new file mode 100644 index 0000000..bf1dfb1 Binary files /dev/null and b/docs/images/img-show-serialization-data.png differ diff --git a/docs/images/img-v2.0.png b/docs/images/img-v2.0.png new file mode 100644 index 0000000..b976a01 Binary files /dev/null and b/docs/images/img-v2.0.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..fa5fb3b --- /dev/null +++ b/docs/index.md @@ -0,0 +1,11 @@ +# Alchemy + +![header](images/header.png) + +Alchemy is a library that adds a rich set of editor extensions for Unity. It provides inspector attributes, hierarchy extensions, editor window extensions, serialization extensions using source generators, and more. + +https://github.com/AnnulusGames/Alchemy + +### License + +This library is under the [MIT License](https://github.com/AnnulusGames/Alchemy/LICENSE). \ No newline at end of file diff --git a/docs/toc.yml b/docs/toc.yml new file mode 100644 index 0000000..523038f --- /dev/null +++ b/docs/toc.yml @@ -0,0 +1,6 @@ +- name: Docs + href: articles/en/ +- name: Docs (日本語) + href: articles/ja/ +- name: API + href: api/ \ No newline at end of file