{"id":14960900,"url":"https://github.com/ycarowr/unityhexagonlibrary2d","last_synced_at":"2025-09-15T12:42:20.231Z","repository":{"id":159107815,"uuid":"228105718","full_name":"ycarowr/UnityHexagonLibrary2d","owner":"ycarowr","description":"A library to manage 2D hexagonal tiles in Unity.","archived":false,"fork":false,"pushed_at":"2021-04-17T11:53:36.000Z","size":20010,"stargazers_count":74,"open_issues_count":0,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-25T13:46:04.688Z","etag":null,"topics":["board","hexagon","hexagonal","hexagonal-board","hexagonal-grid-library","hexagonal-grids","hexagonal-tiles","hexagons","tile","tiled-map-editor","tilemap","tilemaps","tiles","unity","unity-3d","unity-asset","unity-scripts","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/ycarowr.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}},"created_at":"2019-12-14T23:57:59.000Z","updated_at":"2024-11-20T23:30:28.000Z","dependencies_parsed_at":"2023-05-06T20:32:46.843Z","dependency_job_id":null,"html_url":"https://github.com/ycarowr/UnityHexagonLibrary2d","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ycarowr/UnityHexagonLibrary2d","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycarowr%2FUnityHexagonLibrary2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycarowr%2FUnityHexagonLibrary2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycarowr%2FUnityHexagonLibrary2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycarowr%2FUnityHexagonLibrary2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ycarowr","download_url":"https://codeload.github.com/ycarowr/UnityHexagonLibrary2d/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycarowr%2FUnityHexagonLibrary2d/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275260466,"owners_count":25433378,"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","status":"online","status_checked_at":"2025-09-15T02:00:09.272Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["board","hexagon","hexagonal","hexagonal-board","hexagonal-grid-library","hexagonal-grids","hexagonal-tiles","hexagons","tile","tiled-map-editor","tilemap","tilemaps","tiles","unity","unity-3d","unity-asset","unity-scripts","unity2d","unity3d","unity3d-plugin"],"created_at":"2024-09-24T13:23:23.802Z","updated_at":"2025-09-15T12:42:20.200Z","avatar_url":"https://github.com/ycarowr.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Unity Version](https://img.shields.io/badge/Unity-2019.2.7f2%2B-blue.svg)](https://unity3d.com/get-unity/download)\n[![Twitter](https://img.shields.io/twitter/follow/ycarowr.svg?label=Follow@ycarowr\u0026style=social)](https://twitter.com/intent/follow?screen_name=ycarowr)\n\n# A hexagonal board implementation in Unity\n\u003cimg src=\"https://media.istockphoto.com/vectors/polygon-background-for-christmas-vector-id619411136\"\u003e\n\nThe repository contains an API to create, find and store data inside a hexagonal board using Unity [Tile Maps](https://docs.unity3d.com/Manual/class-Tilemap.html) and the math described by [redblob](https://www.redblobgames.com/grids/hexagons/) \u0026 references. \n\nA few reasons why I made the project:\n1. I wanted a generic API that could be easily be extended or integrated into a secondary project;\n2. I wanted set of generic classes that manage hexagons and are able to store any kind of data. What I mean by data: creatures, pieces, itens or whatever a main project needs; \n3. I wanted to use the native Unity [TileMaps](https://docs.unity3d.com/Manual/class-Tilemap.html) components;\n \nYou can find below images that illustrate the functionalities and an overview of the system's implementation. \n\nFeel free to use this tool. Any kind of feedback or credit is well appreciated. \n\nPlayable demo [here](https://ycarowr.itch.io/hexagonal-board)\n \n## Functionalities\n\n|Diagonals|Horizontal|\n|------------|-------------|\n|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/diagonals.gif\"\u003e|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/horizontal.gif\"\u003e|\n|\u003cb\u003eNeighbours\u003c/b\u003e|\u003cb\u003eTile Orientation\u003c/b\u003e|\n|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/neighbours.gif\"\u003e|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/orientation.gif\"\u003e|\n|\u003cb\u003eAdd Objects\u003c/b\u003e|\u003cb\u003eRemove Objects\u003c/b\u003e|\n|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/apples.gif\"\u003e|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/remove.gif\"\u003e|\n\u003c!---|\u003cb\u003eHover\u003c/b\u003e|\u003cb\u003eZoom\u003c/b\u003e|\n|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/Hover.gif\"\u003e|\u003cimg width=\"382\" height=\"210\" src=\"/Assets/Textures/Gifs/zoom1.gif\"\u003e|---\u003e\n\n## Shapes \u0026 Sizes\n\u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/rectangle.GIF\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/triangle.gif\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/hexagon.GIF\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/parallelogram.gif\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/parallelogram.gif\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/parallelogram1.gif\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/triangle1.gif\"\u003e \u003cimg width=\"191\" height=\"105\" src=\"/Assets/Textures/Gifs/hexagon1.GIF\"\u003e  \n\n## Menu \u0026 Interface\n\nThe interface menu to interact with the board data and test the operations.\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"210\" height=\"210\" src=\"/Assets/Textures/Gifs/Sizes.GIF\"\u003e \u003cimg width=\"210\" height=\"250\" src=\"/Assets/Textures/Gifs/Menu.GIF\"\u003e\n\u003c/p\u003e\n\n# Implementation\n\n## MVC \n1. [Model](/Assets/Scripts/BoardSystem/Board)\n2. [Views](/Assets/Scripts/Ui)\n3. [Controller](/Assets/Scripts/BoardSystem/BoardController.cs)\n\n## Board\nI split the board implementation in three distinct parts:\n1. [Board](/Assets/Scripts/BoardSystem/Board/Board.cs) has a data shape that determines it's layout. Also holds a list of Positions that store the data elements on the board;\n2. [BoardManipulation](/Assets/Scripts/BoardSystem/Board/BoardManipulationOddR.cs) is resposible to implement the operations such as diagonals, neighbours or anything else that could come up in the future;\n3. [Position](/Assets/Scripts/BoardSystem/BoardController.cs) is the class that holds the elements placed in the board; Currently each position is able to hold one single object, however it can be extended to an array;\n\n## Coordinates\nThere are two different [Coordinates](/Assets/Scripts/BoardSystem/Board/Coordinates) to manage, the Hex and Offset.\n1. [Hex](Assets/Scripts/BoardSystem/Board/Coordinates/Hex.cs) is used internally by the Manipulation to figure out the necessary points to include in each operation. Operations using this type of coordinate system have simpler algorithms.\n2. [Offset](/Assets/Scripts/BoardSystem/Board/Coordinates/OffsetCoord.cs) is used by Unity [TileMaps](https://docs.unity3d.com/Manual/class-Tilemap.html) native component, in other words, we can't change it; \n3. [OffsetCoordHelper](Assets/Scripts/BoardSystem/Board/Coordinates/OffsetCoordHelper.cs) is the class that manages the convertion from Hex -\u003e Offset or Offset -\u003e Hex;\n\n### TODO\n1. How to use the tool;\n2. How to define your own data;\n3. How to change tiles;\n ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycarowr%2Funityhexagonlibrary2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fycarowr%2Funityhexagonlibrary2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycarowr%2Funityhexagonlibrary2d/lists"}