{"id":13717142,"url":"https://github.com/AnnulusGames/Alchemy","last_synced_at":"2025-05-07T06:32:01.274Z","repository":{"id":210372652,"uuid":"726303852","full_name":"annulusgames/Alchemy","owner":"annulusgames","description":"Provides a rich set of editor extensions and serialization extensions for Unity.","archived":false,"fork":false,"pushed_at":"2025-03-02T02:51:32.000Z","size":3798,"stargazers_count":710,"open_issues_count":26,"forks_count":42,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-14T15:01:31.197Z","etag":null,"topics":["editor-extension","hierarchy","inspector","serialization","sourcegenerator","unity","unity-editor"],"latest_commit_sha":null,"homepage":"https://annulusgames.github.io/Alchemy/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/annulusgames.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-02T01:54:51.000Z","updated_at":"2025-04-14T14:28:21.000Z","dependencies_parsed_at":"2024-01-16T11:15:54.166Z","dependency_job_id":"ee485da1-63c3-45e3-a47a-5274b3bd2d2d","html_url":"https://github.com/annulusgames/Alchemy","commit_stats":{"total_commits":163,"total_committers":9,"mean_commits":18.11111111111111,"dds":"0.19631901840490795","last_synced_commit":"84fb71550bf28d2b5250adafac948e802ddd4b51"},"previous_names":["annulusgames/alchemy","yn01dev/alchemy","yn01-dev/alchemy","nuskey8/alchemy"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FAlchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FAlchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FAlchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/annulusgames%2FAlchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/annulusgames","download_url":"https://codeload.github.com/annulusgames/Alchemy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252826900,"owners_count":21810201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editor-extension","hierarchy","inspector","serialization","sourcegenerator","unity","unity-editor"],"created_at":"2024-08-03T00:01:18.366Z","updated_at":"2025-05-07T06:32:01.261Z","avatar_url":"https://github.com/annulusgames.png","language":"C#","readme":"# Alchemy\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/header.png\" width=\"800\"\u003e\n\n[![license](https://img.shields.io/badge/LICENSE-MIT-green.svg)](LICENSE)\n\n[日本語版READMEはこちら](README_JA.md)\n\n## Overview\n\nAlchemy is a library that provides inspector extensions using attributes.\n\nIn addition to adding easy and powerful editor extensions based on attributes, it allows serialization of any type (Dictionary, Hashset, Nullable, Tuple, etc...) through its own serialization process, making it possible to edit them in the inspector. By using Source Generator to dynamically generate the necessary code, it works simply by adding attributes to the target type marked as partial. There is no need to inherit from dedicated classes as with Odin.\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-v2.0.png\" width=\"800\"\u003e\n\nAdditionally, with the new features of v2.0, EditorWindow extensions and Hierarchy extensions have been added. These make it easy to create tools that streamline the development workflow in the editor.\n\n## Features\n\n* Adds over 30 attributes to extend the Inspector\n* Supports SerializeReference, allowing selection of types from a dropdown\n* Serialize any type (Dictionary, Hashset, Nullable, Tuple, etc...) / Editable in Inspector\n* Creation of EditorWindow using attributes\n* Provides features to improve usability of the Hierarchy\n* Creation of custom attributes that work with Alchemy\n\n## Setup\n\n### Requirements\n\n* Unity 2021.2 or higher (Recommended: 2022.1 or higher for serialization extensions)\n* Serialization 2.0 or higher (for serialization extensions)\n\n### Installation\n\n1. Open Package Manager from Window \u003e Package Manager\n2. Click on the \"+\" button \u003e Add package from git URL\n3. Enter the following URL:\n\n```\nhttps://github.com/annulusgames/Alchemy.git?path=/Alchemy/Assets/Alchemy\n```\n\nOr open Packages/manifest.json and add the following to the dependencies block:\n\n```json\n{\n    \"dependencies\": {\n        \"com.annulusgames.alchemy\": \"https://github.com/annulusgames/Alchemy.git?path=/Alchemy/Assets/Alchemy\"\n    }\n}\n```\n\n## Documentation\n\nThe full version of the documentation can be found [here](https://annulusgames.github.io/Alchemy/).\n\n## Basic Usage\n\nTo customize the display in the Inspector, add attributes to the fields of the class.\n\n```cs\nusing UnityEngine;\nusing UnityEngine.UIElements;\nusing Alchemy.Inspector;\n\npublic class AttributesExample : MonoBehaviour\n{\n    [LabelText(\"Custom Label\")]\n    public float foo;\n\n    [HideLabel]\n    public Vector3 bar;\n    \n    [AssetsOnly]\n    public GameObject baz;\n\n    [Title(\"Title\")]\n    [HelpBox(\"HelpBox\", HelpBoxMessageType.Info)]\n    [ReadOnly]\n    public string message = \"Read Only\";\n}\n```\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-attributes-example.png\" width=\"600\"\u003e\n\nVarious attributes for grouping each field are also provided. Each group can be nested by separating with a slash `/`.\n\n```cs\nusing UnityEngine;\nusing Alchemy.Inspector;\n\npublic class GroupAttributesExample : MonoBehaviour\n{\n    [FoldoutGroup(\"Foldout\")]\n    public int a;\n\n    [FoldoutGroup(\"Foldout\")]\n    public int b;\n\n    [FoldoutGroup(\"Foldout\")]\n    public int c;\n\n    [TabGroup(\"Tab\", \"Tab1\")]\n    public int x;\n\n    [TabGroup(\"Tab\", \"Tab2\")]\n    public string y;\n\n    [TabGroup(\"Tab\", \"Tab3\")]\n    public Vector3 z;\n}\n```\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-group-1.png\" width=\"600\"\u003e\n\nBy adding the `[Button]` attribute to a method, the method can be executed from the Inspector.\n\n```cs\nusing System.Text;\nusing UnityEngine;\nusing Alchemy.Inspector;\n\n[Serializable]\npublic sealed class Example : IExample\n{\n    public float foo;\n    public Vector3 bar;\n    public GameObject baz;\n}\n\npublic class ButtonExample : MonoBehaviour\n{\n    [Button]\n    public void Foo()\n    {\n        Debug.Log(\"Foo\");\n    }\n\n    [Button]\n    public void Foo(int parameter)\n    {\n        Debug.Log(\"Foo: \" + parameter);\n    }\n\n    [Button]\n    public void Foo(Example parameter)\n    {\n        var builder = new StringBuilder();\n        builder.AppendLine();\n        builder.Append(\"foo = \").AppendLine(parameter.foo.ToString());\n        builder.Append(\"bar = \").AppendLine(parameter.bar.ToString());\n        builder.Append(\"baz = \").Append(parameter.baz == null ? \"Null\" : parameter.baz.ToString());\n        Debug.Log(\"Foo: \" + builder.ToString());\n    }\n}\n```\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-button.png\" width=\"600\"\u003e\n\nAlchemy provides many other attributes. The list of available attributes can be found in the [documentation](https://annulusgames.github.io/Alchemy/articles/en/inspector-extension-with-attributes.html).\n\n## Editing Interfaces/Abstract Classes\n\nAlchemy supports Unity's SerializeReference. By adding the `[SerializeReference]` attribute, interfaces and abstract classes can be edited in the Inspector.\n\n```cs\nusing UnityEngine;\n\npublic interface IExample { }\n\n[Serializable]\npublic sealed class ExampleA : IExample\n{\n    public float alpha;\n}\n\n[Serializable]\npublic sealed class ExampleB : IExample\n{\n    public Vector3 beta;\n}\n\n[Serializable]\npublic sealed class ExampleC : IExample\n{\n    public GameObject gamma;\n}\n\npublic class SerializeReferenceExample : MonoBehaviour\n{\n    [SerializeReference] public IExample Example;\n    [SerializeReference] public IExample[] ExampleArray;\n}\n```\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-serialize-reference.png\" width=\"600\"\u003e\n\nInterfaces/abstract classes are displayed as shown above, and you can select child classes from the dropdown to instantiate them.\n\nFor more details, refer to [SerializeReference](https://annulusgames.github.io/Alchemy/articles/en/serialize-reference.html).\n\n## Hierarchy\n\nBy introducing Alchemy, several features are added to extend the Hierarchy.\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-hierarchy.png\" width=\"600\"\u003e\n\n### Toggles and Icons\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/gif-hierarchy-toggle.gif\" width=\"600\"\u003e\n\nToggles to switch between active/inactive states of objects and icons to display the components of objects can be added to the Hierarchy. These can be configured from ProjectSettings.\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-project-settings.png\" width=\"600\"\u003e\n\n### Decoration\n\nAdditionally, objects to decorate the Hierarchy can be created from the Create menu.\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-create-hierarchy-object.png\" width=\"600\"\u003e\n\nThese objects are automatically excluded in build. (If they have child objects, all child objects are detached before deletion.)\nFor more details, refer to [Decorating Hierarchy](https://annulusgames.github.io/Alchemy/articles/en/decorating-hierarchy.html).\n\n## AlchemyEditorWindow\n\nBy inheriting from the `AlchemyEditorWindow` class instead of the usual `Editor` class, you can create editor windows using Alchemy attributes.\n\n```cs\nusing System;\nusing System.Collections.Generic;\nusing UnityEditor;\nusing UnityEngine;\nusing UnityEngine.UIElements;\nusing Alchemy.Editor;\nusing Alchemy.Inspector;\n\npublic class EditorWindowExample : AlchemyEditorWindow\n{\n    [MenuItem(\"Window/Example\")]\n    static void Open()\n    {\n        var window = GetWindow\u003cEditorWindowExample\u003e(\"Example\");\n        window.Show();\n    }\n    \n    [Serializable]\n    [HorizontalGroup]\n    public class DatabaseItem\n    {\n        [LabelWidth(30f)]\n        public float foo;\n\n        [LabelWidth(30f)]\n        public Vector3 bar;\n        \n        [LabelWidth(30f)]\n        public GameObject baz;\n    }\n\n    [ListViewSettings(ShowAlternatingRowBackgrounds = AlternatingRowBackground.All, ShowFoldoutHeader = false)]\n    public List\u003cDatabaseItem\u003e items;\n\n    [Button, HorizontalGroup]\n    public void Button1() { }\n\n    [Button, HorizontalGroup]\n    public void Button2() { }\n\n    [Button, HorizontalGroup]\n    public void Button3() { }\n}\n```\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-editor-window.png\" width=\"600\"\u003e\n\nThe data of windows created by inheriting from `AlchemyEditorWindow` is saved in json format in the ProjectSettings folder of the project. For more details, refer to [Saving Editor Window Data](https://annulusgames.github.io/Alchemy/articles/en/saving-editor-window-data.html).\n\n## Using Serialization Extensions\n\nIf you want to edit types that Unity cannot serialize, such as Dictionary, you can use the `[AlchemySerialize]` attribute to perform serialization.\n\nIf you want to use serialization extensions, you will need the [Unity.Serialization](https://docs.unity3d.com/Packages/com.unity.serialization@3.1/manual/index.html) package. Additionally, reflection-based serialization using Unity.Serialization may not work in AOT environments prior to Unity 2022.1. Check the package manual for details.\n\nBelow is a sample using Alchemy's serialization extension to make various types serializable/editable in the Inspector.\n\n```cs\nusing System;\nusing System.Collections.Generic;\nusing UnityEngine;\nusing Alchemy.Serialization;\n\n// By adding the [AlchemySerialize] attribute, Alchemy's serialization extension is enabled.\n// It can be used with any type that has an optional base class, but the target type must be partial for the Source Generator to generate code.\n[AlchemySerialize]\npublic partial class AlchemySerializationExample : MonoBehaviour\n{\n    // Add [AlchemySerializeField] and [NonSerialized] attributes to the target fields.\n    [AlchemySerializeField, NonSerialized]\n    public HashSet\u003cGameObject\u003e hashset = new();\n\n    [AlchemySerializeField, NonSerialized]\n    public Dictionary\u003cstring, GameObject\u003e dictionary = new();\n\n    [AlchemySerializeField, NonSerialized]\n    public (int, int) tuple;\n\n    [AlchemySerializeField, NonSerialized]\n    public Vector3? nullable = null;\n}\n```\n\n\u003cimg src=\"https://github.com/annulusgames/Alchemy/blob/main/docs/images/img-serialization-sample.png\" width=\"600\"\u003e\n\nFor technical details of the serialization process, refer to [Alchemy Serialization Process](https://annulusgames.github.io/Alchemy/articles/en/alchemy-serialization-process.html) in the documentation.\n\n## Help\n\nUnity forum: https://forum.unity.com/threads/released-alchemy-inspector-serialization-extensions.1523665/\n\n## License\n\n[MIT License](LICENSE)\n","funding_links":[],"categories":["Open Source Packages"],"sub_categories":["Editor"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnnulusGames%2FAlchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAnnulusGames%2FAlchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnnulusGames%2FAlchemy/lists"}