{"id":2786247,"url":"https://github.com/AnisimovArthur/UnityTools","last_synced_at":"2025-08-06T04:32:23.926Z","repository":{"id":219731267,"uuid":"272061241","full_name":"AnisimovArthur/UnityTools","owner":"AnisimovArthur","description":"Editor and Runtime tools for Unity.","archived":false,"fork":false,"pushed_at":"2024-09-09T22:10:22.000Z","size":95,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-10T02:51:34.537Z","etag":null,"topics":["asset","csharp","package","tool","unity","unity-asset","unity-editor","unity-scripts","unity-tool","unity2d","unity3d","unity3d-plugin"],"latest_commit_sha":null,"homepage":"","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/AnisimovArthur.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":"2020-06-13T18:06:40.000Z","updated_at":"2024-09-09T22:08:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f3ce6eb-361a-4454-8f08-d52c86324bab","html_url":"https://github.com/AnisimovArthur/UnityTools","commit_stats":null,"previous_names":["anisimovarthur/unitytools"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnisimovArthur%2FUnityTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnisimovArthur%2FUnityTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnisimovArthur%2FUnityTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnisimovArthur%2FUnityTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnisimovArthur","download_url":"https://codeload.github.com/AnisimovArthur/UnityTools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228840624,"owners_count":17980041,"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":["asset","csharp","package","tool","unity","unity-asset","unity-editor","unity-scripts","unity-tool","unity2d","unity3d","unity3d-plugin"],"created_at":"2024-01-29T12:52:46.090Z","updated_at":"2024-12-09T05:30:58.232Z","avatar_url":"https://github.com/AnisimovArthur.png","language":"C#","readme":"# Summary\nUnity package with Editor and Runtime tools.\n\n# Table of contents\n\n### Getting started\n* [Install (Package Manager)](#gs-install-pm)\n* [Install (Manifest)](#gs-install-manifest)\n* [Update](#gs-update)\n\n### Runtime Tools\n   * [Scheduler](#rt-scheduler)\n   * [Event Handler](#rt-eventhandler)\n   * [Object Pool](#rt-objectpool)\n   * [Extensions](#rt-extensions) \n     * [GizmosPro](#rt-extensions-gizmospro)   \n     * [PlayerPrefs](#rt-extensions-playerprefs)     \n     * UI Extensions\n     * Transform (RectTransform) Extensions   \n   * [Utils](#rt-utils)      \n      * [Patterns](#rt-utils-patterns)\n          * [Singleton](#rt-utils-patterns-singleton)\n\n### Editor Tools\n   * [Toolbar](#et-toolbar)\n      * [Toolbar Button](#et-toolbar-button)\n      * [Toolbar Popup](#et-toolbar-popup)\n      * [Toolbar Label](#et-toolbar-label)\n   * [Toolbar Scene Loader](#et-toolbarsceneloader)\n   * [Inspector Button](#et-inspectorbutton)\n   * [Extensions](#et-extensions)      \n     * [EditorPrefs](#et-extensions-editorprefs)    \n   \n# Getting Started\n\n**Note:** If you use [**Assembly Definitions**](https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html) you have to add references to your Assembly Definition. \nAdd ```Archie.UnityTools.Editor.asmdef``` in order to use Editor Tools.\nAdd ```Archie.UnityTools.Runtime.asmdef``` in order to use Runtime Tools.\n\n## \u003ca id=\"gs-install-pm\"\u003e\u003c/a\u003eInstall package via Package Manager\nYou can add the package dependency via Unity's Package Manager .\n1. Open Package Manager: Window -\u003e Package Manager.\n2. From the top left, click on the \"+\" button.\n3. Input ```https://github.com/AnisimovArthur/UnityTools.git``` in the input field.\n4. Click Add.\n\n## \u003ca id=\"gs-install-manifest\"\u003e\u003c/a\u003eInstall package via Manifest\nThe second option is to install via the manifest.\n\nTo use the package you have to add the dependency to the project's Packages/manifest.json file.\n```json\n\"com.archie.unitytools\": \"https://github.com/AnisimovArthur/UnityTools.git#1.0.5\",\n```\n\n## \u003ca id=\"gs-update\"\u003e\u003c/a\u003eUpdate package\nTo update the package you have to update the dependency version in the project's Packages/manifest.json file.\n\nFor example:\n\nOld: ```#0.5.1-preview``` \nNew: ```#1.0.5```\n\n# Runtime Tools\n## \u003ca id=\"rt-scheduler\"\u003e\u003c/a\u003eScheduler\nTool for delayed event execution.\n\n```csharp\nusing UnityEngine;\nusing UnityTools;\n\npublic class SchedulerExample : MonoBehaviour\n{\n    private void Awake()\n    {\n        // Debug.Log should happens in 2 seconds.\n        var scheduled = Scheduler.Schedule(2.0f, () =\u003e Debug.Log(\"Hello World!\"));\n\n        // First option to cancel Debug.Log(\"Hello World!\") above\n        scheduled.Cancel();\n\n        // Second option to cancel Debug.Log(\"Hello World!\") above\n        // Scheduler.Cancel(scheduled);\n\n        // As a result, you will see only \"I'm a cat.\" in the console because \"scheduled\" was canceled above\n        Scheduler.Schedule(0.5f, delegate\n        {\n            Debug.Log(\"I'm a cat.\");\n        });\n    }\n}\n```\n\n## \u003ca id=\"rt-eventhandler\"\u003e\u003c/a\u003eEvent Handler\n\nGeneric Event System.\nThe Event System allows components to Subscribe, Unsubscribe, and Execute events.\n\n```csharp\nusing UnityEngine;\nusing UnityTools;\n\npublic class ExampleComponent : MonoBehaviour\n{\n    private void Awake()\n    {\n        EventHandler.Subscribe\u003cstring, GameObject\u003e(\"FirstEvent\", PrintMessage);\n        EventHandler.Subscribe(\"SecondEvent\", PrintHello);\n\n        EventHandler.Unsubscribe(\"SecondEvent\", PrintHello);\n\n        EventHandler.Execute(\"FirstEvent\", Time.time.ToString(), gameObject);\n        EventHandler.Execute(\"SecondEvent\");\n\n        EventHandler.Subscribe(gameObject, \"LocalEvent\", PrintName);\n        EventHandler.Execute(gameObject, \"LocalEvent\");\n    }\n\n    private void PrintHello()\n    {\n        Debug.Log(\"Hello\");\n    }\n    \n    private void PrintName()\n    {\n        Debug.Log(name);\n    }\n\n    private void PrintMessage(string message, GameObject obj)\n    {\n        Debug.Log(message + \" \" + obj.name);\n    }\n}\n```\nAs a result, you will see in the console\n\n1) 0 GameObject\n\nYou will not see \"Hello\" a second time because you are unsubscribing from this event in the code.\n \nThen you will see the names of the components as much as you have GameObjects with that component because, we are using \"LocalEvent\" to use the local Event system on the local object.\n\n## \u003ca id=\"rt-objectpool\"\u003e\u003c/a\u003eObject Pool\nTool to use Pooled GameObjects.\n\n```csharp\nusing System.Collections.Generic;\nusing UnityEngine;\nusing UnityTools;\n\npublic class Example : MonoBehaviour\n{\n    [SerializeField] private GameObject prefab;\n\n    void Start()\n    {\n        var pooledObjects = new List\u003cGameObject\u003e();\n        for (int i = 0; i \u003c 100; i++)\n            pooledObjects.Add(ObjectPool.Get(prefab));\n\n        for (int i = 0; i \u003c 100; i++)\n            ObjectPool.Return(pooledObjects[i]);\n    }\n}\n```\n\n## \u003ca id=\"rt-extensions\"\u003e\u003c/a\u003eExtensions\n### \u003ca id=\"rt-extensions-gizmospro\"\u003e\u003c/a\u003eGizmosPro\n\nExtra gizmos for default UnityEngine.Gizmos.\n\n```csharp\nusing UnityEngine;\nusing UnityTools;\n\nprivate void OnDrawGizmos()\n{\n    GizmosPro.DrawWireCylinder(transform.position, transform.up, 2.5f, 5, Color.green);\n    GizmosPro.DrawWireCircle(transform.position, transform.up, 2.5f, Color.red);\n}\n\n```\n\u003cimg src=\"https://i.imgur.com/C5TplrJ.png\" alt=\"alt text\" width=\"457\" height=\"255\"\u003e\n\n### \u003ca id=\"rt-extensions-playerprefs\"\u003e\u003c/a\u003ePlayerPrefs\n\nUsing PlayerPrefsPro to save/get a value of custom types from PlayerPrefs.\n\nSupported types:\n\n```csharp\nusing UnityTools;\n\n// Boolean\nPlayerPrefsPro.GetBool(\"BoolKey\");\n// System.DateTime\nPlayerPrefsPro.SetDateTime(\"DateTimeKey\", System.DateTime.Now);\n```\n\n## \u003ca id=\"rt-utils\"\u003e\u003c/a\u003eUtils\n### \u003ca id=\"rt-utils-patterns\"\u003e\u003c/a\u003ePatterns\n#### \u003ca id=\"rt-utils-patterns-singleton\"\u003e\u003c/a\u003eSingleton\n\nEasy-to-use Singleton implementation.\n\n```csharp\nusing UnityTools;\n\npublic class Example : Singleton\u003cExample\u003e\n{\n    \n}\n```\n\n# Editor Tools\n## \u003ca id=\"et-toolbar\"\u003e\u003c/a\u003eToolbar\n\nThe minimum code to add a custom tool to the toolbar:\n```csharp\nusing UnityEditor;\n\nusing UnityTools.Editor;\n\n[InitializeOnLoad]\npublic class ToolbarExample\n{\n    static ToolbarExample()\n    {\n        ToolbarTools.AddTool(new ToolbarButton(), ToolbarSide.Right);\n    }\n}\n```\n\n\u003cimg src=\"https://i.imgur.com/NZ54FqH.png\" width=\"478\" height=\"82\"\u003e\n\n###  \u003ca id=\"et-toolbar-button\"\u003e\u003c/a\u003eToolbar Button\n\n```csharp\nstatic ToolbarExample()\n{\n    ToolbarTools.AddTool(new ToolbarButton(\"Button\", PrintMessage), ToolbarSide.Left);\n}\n\nprivate static void PrintMessage()\n{\n    UnityEngine.Debug.Log(\"Editor button clicked.\");\n}\n```\n###  \u003ca id=\"et-toolbar-popup\"\u003e\u003c/a\u003eToolbar Popup\n```csharp\nstatic ToolbarExample()\n{\n    var genericMenu = new GenericMenu();\n    genericMenu.AddItem(new UnityEngine.GUIContent(\"Load scene Game\"), false, () =\u003e LoadSceneByName(\"Game\"));\n\n    ToolbarTools.AddTool(new ToolbaPopup(genericMenu, \"My Popup\"), ToolbarSide.Right);\n}\n\nprivate static void LoadSceneByName(string name)\n{\n    UnityEditor.SceneManagement.EditorSceneManager.LoadScene(name);\n}\n```\n###  \u003ca id=\"et-toolbar-label\"\u003e\u003c/a\u003eToolbar Label\n```csharp\nstatic ToolbarExample()\n{\n    ToolbarTools.AddTool(new ToolbarLabel(\"My Label\"), ToolbarSide.Left);\n}\n```\n\n#### Icon for toolbar items\nYou can provide a tool icon as shown below.\n\n```csharp\nstatic ToolbarExample()\n{\n    var icon = Resources.Load\u003cTexture\u003e($\"YOUR_PATH_TO_ICON\");\n    ToolbarTools.AddTool(new ToolbarButton(\"Button\", icon), ToolbarSide.Left);\n}\n```\n\n# \u003ca id=\"et-toolbarsceneloader\"\u003e\u003c/a\u003eToolbar Scene Loader\n\nThis tool is developed by [Toolbar](#et-toolbar) functionality. You can easily add quick access to your scenes.\n\n\u003cimg src=\"https://i.imgur.com/TtWOWmH.png\" width=\"451\" height=\"155\"\u003e\n\n```csharp\nusing UnityEditor;\n\nusing UnityTools.Editor;\n\n[InitializeOnLoad]\npublic static class ToolbarLoaderToolExample\n{\n    static ToolbarLoaderToolExample()\n    {\n        ToolbarSceneLoader.AddScene(\"Scene 1\", \"Content/Scenes/1.unity\");\n        ToolbarSceneLoader.AddSeparator(\"Other Scenes\");\n        ToolbarSceneLoader.AddScene(\"Test Scenes/Test Scene 1\", \"Content/Scenes/Test/Test 1\");\n    }\n}\n```\n\n# \u003ca id=\"et-inspectorbutton\"\u003e\u003c/a\u003eInspector Button\n\n```csharp\nusing UnityEngine;\n\n#if UNITY_EDITOR\nusing UnityTools.Editor;\n#endif\n\npublic class Example : MonoBehaviour\n{\n    private const string ExampleString = \"Example string\";\n\n#if UNITY_EDITOR\n    [Button(\"Do Log ExampleString\")]\n    private void DoSomething()\n    {\n        Debug.Log(ExampleString);\n    }\n#endif\n}\n```\n\n**Note:** you have to use [**Platform dependent compilation**](https://docs.unity3d.com/Manual/PlatformDependentCompilation.html)  in order to have an Inspector Button in Runtime code.\n\n\u003cimg src=\"https://i.imgur.com/mhfZAEz.png\" width=\"527\" height=\"432\"\u003e\n\n## \u003ca id=\"et-extensions\"\u003e\u003c/a\u003eExtensions\n### \u003ca id=\"et-extensions-editorprefs\"\u003e\u003c/a\u003eEditorPrefs\n\nUsing EditorPrefsPro to save/get a value of custom types from EditorPrefs.\n\nSupported types:\n\n```csharp\nusing UnityTools.Editor;\n\n// Bool\nEditorPrefsPro.SetBool(\"BoolKey\", true);\n// System.DateTime\nEditorPrefsPro.SetDateTime(\"DateTimeKey\", System.DateTime.Now);\n```\n\n# License\nThis package licensed under the [MIT license](https://github.com/AnisimovArthur/UnityTools/blob/master/LICENSE).\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnisimovArthur%2FUnityTools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAnisimovArthur%2FUnityTools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnisimovArthur%2FUnityTools/lists"}