text:
# Awesome opensource Unity packages
to make the Unity game-dev life happier and future proof, here is a full list of assets and packages.

[**Open Source Repositories**](#open-source-repositories)
- [Awesome opensource Unity packages](#awesome-opensource-unity-packages)
  - [Open Source Repositories](#open-source-repositories)
    - [2D](#2d)
    - [2D Bones](#2d-bones)
    - [AI](#ai)
    - [AR](#ar)
    - [Animation](#animation)
    - [Asset Bundle](#asset-bundle)
    - [Camera](#camera)
    - [Character Controllers 2D](#character-controllers-2d)
    - [Character Controllers 3D](#character-controllers-3d)
    - [Controller Mappings](#controller-mappings)
    - [Console](#console)
    - [Database](#database)
    - [DOTS](#dots)
    - [Editor](#editor)
    - [Effect and Shaders](#effect-and-shaders)
    - [Environment](#environment)
    - [Framework](#framework)
    - [Framework - visual](#framework---visual)
    - [Gameplay](#gameplay)
    - [Input](#input)
    - [Level Editor](#level-editor)
    - [Light](#light)
    - [Localization](#localization)
    - [Lua](#lua)
    - [Materials](#materials)
    - [Math](#math)
    - [Meshes](#meshes)
    - [Monetization](#monetization)
    - [Networking](#networking)
    - [Physic](#physic)
    - [Plugins](#plugins)
    - [Procedural Generation Systems](#procedural-generation-systems)
    - [Pooling System](#pooling-system)
    - [Profobuf](#profobuf)
    - [Scriptable Object](#scriptable-object)
    - [Scriptings](#scriptings)
    - [Services](#services)
    - [Sounds](#sounds)
    - [Timeline](#timeline)
    - [Tweening](#tweening)
    - [Vehicle](#vehicle)
    - [UI](#ui)
    - [Utilities](#utilities)
    - [Video](#video)
    - [Voxel](#voxel)
    - [VR](#vr)
  - [Assets](#assets)
    - [Icons](#icons)
    - [Collections / Forums / Shops](#collections--forums--shops)
    - [Creation Tools](#creation-tools)
    - [Audio](#audio)
  - [Articles](#articles)
  - [Books](#books)
  - [To Be organized](#to-be-organized)
  - [Game Based Learning](#game-based-learning)

[**Assets**](#assets)
- [Icons](#icons)
- [Collections / Forums](#collections--forums--shops)
- [Creation Tools](#creation-tools)
- [Audio](#audio)

[**Articles**](#articles)

[**Books**](#books)

## Open Source Repositories
### 2D
* [Unity2D-Components](https://github.com/cmilr/Unity2D-Components) - A constantly evolving array of Unity C# components for 2D games, including classes for pixel art cameras, events & messaging, saving & loading game data, collision handlers, object pools, and more.
* [DeadSimple-Pixel-Perfect-Camera](https://github.com/cmilr/DeadSimple-Pixel-Perfect-Camera) - An exceedingly easy-to-use pixel perfect orthographic camera script for 2D scenes in Unity. Punch in a few specs and you've got a working pixel perfect camera. It's that easy
* [StaticBluredScreen](https://github.com/mob-sakai/StaticBluredScreen) - Non-realtime (=static) screen blur for Unity. Easy to use background for dialogs
* [AtlasImage](https://github.com/mob-sakai/AtlasImage) - AtlasImage is a graphic component use SpriteAtlas for uGUI. In addition, add useful sprite selector and border editor to the inspector
* [SpriteDicing](https://github.com/Elringus/SpriteDicing) - Extension for Unity game engine to work with diced sprites
* [DataRenderer2D](https://github.com/geniikw/DataRenderer2D) - make mesh like line, polygon, etc in unity3d
* [UnitySpline2D](https://github.com/sinbad/UnitySpline2D) - 2D spline utility for Unity

### 2D Bones
* [DragonBonesCSharp](https://github.com/DragonBones/DragonBonesCSharp) - DragonBones C# Runtime
* [Spine Runtimes](https://github.com/EsotericSoftware/spine-runtimes) - Collection of Spine runtimes including with Unity3d version.

### AI
* [ML Agents](https://github.com/Unity-Technologies/ml-agents) - Unity Machine Learning Agents Toolkit
* [Unity Movement AI](https://github.com/antonpantev/unity-movement-ai) - A library of common movement AI scripts known as Steering Behaviors. You can use these scripts to help your NPCs move around your game.
* [Crystal AI](https://github.com/igiagkiozis/CrystalAI) - A Utility AI for C# and Unity
* [EpPathFinding.cs](https://github.com/juhgiyo/EpPathFinding.cs) - A jump point search algorithm for grid based games in C#
* [EpPathFinding3D.cs](https://github.com/juhgiyo/EpPathFinding3D.cs) - A 3D jump point search algorithm for cube based games in C#
* [goap](https://github.com/sploreg/goap) - Goal Oriented Action Planning AI in Unity
* [UnitySteer](https://github.com/ricardojmendez/UnitySteer) - Steering, obstacle avoidance and path following behaviors for the Unity Game Engine
* [A Star Pathfinding for Unity](https://github.com/sharpaccent/Astar-for-Unity) - A Star Pathfinder, 3 axis, multithreaded for Unity
* [openpath](https://github.com/mrzapp/openpath) - Open source pathfinding for Unity
* [unity-path-finding](https://github.com/mattatz/unity-path-finding) - Shortest path finding with Dijkstra's algorithm for Unity.
* [NPBehave](https://github.com/meniku/NPBehave) - Event Driven Behavior Trees for Unity 3D
* [fluid-behavior-tree](https://github.com/ashblue/fluid-behavior-tree) - A pure code behavior tree micro-framework built for Unity3D projects. Granting developers the power to dictate their GUI presentation
* [Unity3d-Finite-State-Machine](https://github.com/thefuntastic/Unity3d-Finite-State-Machine) -
An intuitive Unity3d finite state machine (FSM). Designed with an emphasis on usability, without sacrificing utility
* [Path-Creator](https://github.com/SebLague/Path-Creator) - Path creation asset for Unity game development
* [NavMeshPlus](https://github.com/h8man/NavMeshPlus) - Unity NavMesh 2D Pathfinding
* [NavMeshSurface2DBaker](https://github.com/SharlatanY/NavMeshSurface2DBaker) - NavMeshSurface2DBaker is a Unity Package that provides functionality to bake 2D colliders into NavMeshSurface components.
* [Brainiac](https://github.com/daemon3000/Brainiac) - Behaviour tree editor for Unity3D
* [behaviac](https://github.com/Tencent/behaviac) - behaviac is a framework of the game AI development, and it also can be used as a rapid game prototype design tool. behaviac supports the behavior tree, finite state machine and hierarchical task network(BT, FSM, HTN)

### AR
* [AR Foundation Essentials](https://github.com/dilmerv/UnityARFoundationEssentials) - AR Foundation examples created with AR Foundation
* [XRTK](https://github.com/XRTK/XRTK-Core) - The Official Mixed Reality Framework for Unity

### Animation
* [unity-animator-helpers](https://github.com/ashblue/unity-animator-helpers) - A micro-framework for changing Unity 3D's Animator parameters with ScriptableObject(s). Designed to make going from custom scripts to Animator parameters easy. Works with 2D or 3D projects

### Asset Bundle
* [AssetBundleManager](https://github.com/SadPandaStudios/AssetBundleManager) - An asset bundle manager for Unity

### Camera
* [Unity Pixel Camera](https://github.com/ChemiKhazi/UnityPixelCamera) - A resolution independent pixel perfect camera for Unity
* [DeadSimple Pixel-Perfect Camera](https://github.com/cmilr/DeadSimple-Pixel-Perfect-Camera) - An exceedingly easy-to-use pixel perfect orthographic camera script for 2D scenes in Unity. Punch in a few specs and you've got a working pixel perfect camera. It's that easy.
* [Dynamic Multi Target Camera for Unity](https://github.com/lopespm/unity-camera-multi-target) - Concise Unity library which dynamically keeps a set of objects (e.g. players and important objects) in view.
* [FulldomeCameraForUnity](https://github.com/rsodre/FulldomeCameraForUnity) - Fulldome Camera for Unity 2019

### Character Controllers 2D
* [Unity 2D Platformer Controller](https://github.com/cjddmut/Unity-2D-Platformer-Controller) - A customizable 2D platformer motor that handles mechanics such as double jumps, wall jumps, and corner grabs. Includes a player controlled prefab that can be dropped into any scene for immediate support.
* [CharacterController2D](https://github.com/prime31/CharacterController2D) - is similar to the built-in Unity CharacterController component. It has a similar API (mainly a move method that takes a delta movement) and provides a firm base with which to make a super solid controller using Unity's 2D system.
* [Unity 2D Platformer Controller](https://github.com/cjddmut/Unity-2D-Platformer-Controller) - A customizable 2D platformer motor that handles mechanics such as double jumps, wall jumps, and corner grabs. Includes a player controlled prefab that can be dropped into any scene for immediate support.

### Character Controllers 3D
* [SuperCharacterController](https://github.com/IronWarrior/SuperCharacterController) - Custom Character Controller for Unity. Fulfills all common character controller functions such as collision detection and pushback, slope limiting and collider ignoring.
* [NaughtyCharacter](https://github.com/dbrizov/NaughtyCharacter) - Third Person Controller for Unity
* [Advanced Rigidbody FirstPerson Controller](https://github.com/Moe-Baker/Advanced-Rigidbody-FirstPerson-Controller) - Rigidbody Based FirstPerson Controller

### Controller Mappings
* [Dualshock 3 (PS3)](https://forum.unity.com/threads/ps3-button-map.89288/)
* [Dualshock 4 (PS4)](https://twitter.com/erik_tellier/status/1071457079854944256)
* [Nintendo Joy Con](https://www.reddit.com/r/Unity3D/comments/60wh7g/nintendo_switch_joycon_controller_mapped_for_unity/)
* [Nintendo Pro Controller](https://answers.unity.com/questions/1419842/nintendo-switch-pro-controller-mapping.html)
* [Xbox 360](http://wiki.unity3d.com/index.php?title=Xbox360Controller)
* [Xbox One](https://answers.unity.com/questions/1350081/xbox-one-controller-mapping-solved.html)

### Console
* [Unity3d-BeastConsole](https://github.com/pointcache/Unity3d-BeastConsole) - Console for all your unity needs
* [consolation](https://github.com/mminer/consolation) - In-game debug console for Unity.
* [Lunar Unity Mobile Console](https://github.com/SpaceMadness/lunar-unity-console) - High-performance Unity iOS/Android logger built with native platform UI

### Database
* [SQLite4Unity3d](https://github.com/codecoding/SQLite4Unity3d) - SQLite made easy for Unity3d

### DOTS
* [unity-ecs-navmesh](https://github.com/zulfajuniadi/unity-ecs-navmesh) - A demo implementation of Unity Entity Component System with NavMesh
* [ECS-Tween](https://github.com/Xerios/ECS-Tween) - Simple Unity tweening system using ECS that works with GameObjects!
* [PlasticTween](https://github.com/PlasticApps/PlasticTween) - Tween Library for Unity3D(ECS+JOBS)
* [unity-jtween](https://github.com/jeffcampbellmakesgames/unity-jtween) - A job-based tween library for Unity
* [KNN](https://github.com/ArthurBrussee/KNN) - Fast K-Nearest Neighbour Library for Unity DOTS
* [SpriteSheetRenderer](https://github.com/fabriziospadaro/SpriteSheetRenderer) - A powerful Unity ECS system to render massive numbers of animated sprites
* [NativeCollections](https://github.com/jacksondunstan/NativeCollections) - Native Collection Types for Unity https://jacksondunstan.com/articles/tag/native-collection
* [EntitySelection](https://github.com/JonasDeM/EntitySelection) - A minimal solution for selecting entities in the unity sceneview.
* [Hydrogen.Entities](https://github.com/periodyctom/Hydrogen.Entities) - A collection of helpers for work with Unity's ECS framework, used in our games.
* [Unity-2D-Pathfinding-Grid-ECS-Job](https://github.com/Omniaffix-Dave/Unity-2D-Pathfinding-Grid-ECS-Job) - ECS Burst Job System 2D Pathfinding
* [EntitySelection](https://github.com/JonasDeM/EntitySelection) - A minimal solution for selecting entities in the unity sceneview
* [Easy-Road-3D-ECS-Traffic](https://github.com/Blissgig/Easy-Road-3D-ECS-Traffic) - Unity DOTS/ECS traffic using Easy Roads 3D for the data
* [IcSkillSystem](https://github.com/yika-aixi/IcSkillSystem) - A simple and reusable skill system
* [EntitiesBT](https://github.com/quabug/EntitiesBT) - Behavior Tree for Unity ECS (DOTS) framework
*
### Editor
* [Unity-QuickSheet](https://github.com/kimsama/Unity-QuickSheet) - Unity-QuickSheet enables you to use spreadsheet file data within Unity editor.
* [Unity3D Rainbow Folders](https://github.com/PhannGor/unity3d-rainbow-folders) - This asset allows you to set custom icons for any folder in unity project browser.
* [Reorderable List Editor Field for Unity](https://bitbucket.org/rotorz/reorderable-list-editor-field-for-unity) - Reorderable List Editor Field for Unity
* [Reorderable Inspector](https://github.com/ChemiKhazi/ReorderableInspector) - Automatic reorderable lists for Unity game engine components
* [Vexe Framework (VFW)](https://github.com/vexe/VFW) - an editor extension that offers much more advance editor extensibility features than what comes out of the box with Unity.
* [Tidy Up](https://github.com/Nutshell-Hack/Tidy-Up) - Neat little tool! to help you keep your Unity projects organised by throwing assets in their designated folders.
* [Unity Psd Importer](https://github.com/ChemiKhazi/UnityPsdImporter) - Advanced PSD importer for Unity3D
* [property-drawer-collection](https://github.com/anchan828/property-drawer-collection)
* [unity-symlink-utility](https://github.com/karl-/unity-symlink-utility) - A small extension that adds a menu item to add folders as symlinks in Unity
* [UnityDefineManager](https://github.com/karl-/UnityDefineManager) - Easily manage global defines in Unity
* [Texture3DPreview-for-Unity](https://github.com/raphael-ernaelsten/Texture3DPreview-for-Unity) - This package enables interactive previews of Texture3D assets in Unity's Inspector window.
* [unity-colourlovers-importer](https://github.com/shelleylowe/unity-colourlovers-importer) - Unity editor tool to load colours and palettes directly from COLOURlovers.com
* [shortcuter](https://github.com/intentor/shortcuter) - Shortcut utility for Unity
* [unity-editor-spotlight](https://github.com/marijnz/unity-editor-spotlight) - MacOS-like Spotlight file search in Unity
* [Unity-Reorderable-List](https://github.com/cfoulston/Unity-Reorderable-List) - Extended version of the Reorderable List in Unity
* [UnityEditorJunkie](https://github.com/roboryantron/UnityEditorJunkie) - Editor scripts to make working with the Unity Editor better
* [UniOmni](https://github.com/lochrist/UniOmni) - Global search for Unity
* [Readme](https://github.com/TinyPhoenix/Readme) - Readme component for Unity, attachable to any GameObject to document what you can't in a script or the file system
* [Unity-AssetDependencyGraph](https://github.com/Unity-Harry/Unity-AssetDependencyGraph) - An Asset Dependency Graph for Unity
* [MyBox](https://github.com/Deadcows/MyBox) - MyBox is a set of attributes, tools and extensions for Unity
* [Unity-Finder](https://github.com/litefeel/Unity-Finder) - Find Asset in Unity.
* [Unity-Editor-Toolbox](https://github.com/arimger/Unity-Editor-Toolbox) - Tools, custom attributes, drawers and extensions for Unity Editor.
* [enhancer](https://github.com/xeleh/enhancer) - A collection of utilities to enhance the Unity Editor

### Effect and Shaders
* [Unity 5 Effects](https://github.com/i-saint/Unity5Effects) - Effect storage space for Unity 5.
* [Outline-Effect](https://github.com/cakeslice/Outline-Effect) - Outline Image Effect for Unity
* [unity-frosted-glass](https://github.com/andydbc/unity-frosted-glass) - frosted glass material made in unity
* [unity-delaunay](https://github.com/OskarSigvardsson/unity-delaunay) - A Delaunay/Voronoi library for Unity, and a simple destruction effect
* [Helicopter effect](https://twitter.com/unity3dexpert/status/1050240849085431808)
* [SSMS](https://github.com/OCASM/SSMS) - Screen space multiple scattering for Unity
* [KinoGlitch](https://github.com/keijiro/KinoGlitch) - Video glitch effects for Unity
* [Temporal](https://github.com/playdeadgames/temporal) - Temporal Reprojection Anti-Aliasing for Unity 5.0+
* [SMAA](https://github.com/Chman/SMAA) - A highly customizable implementation of Subpixel Morphological Antialiasing for Unity
* [Typogenic](https://github.com/Chman/Typogenic) - Signed-distance field text rendering for Unity
* [AtmosphericScattering](https://github.com/SlightlyMad/AtmosphericScattering) - Atmospheric Scattering for Unity
* [Facepunch.Highlight](https://github.com/Facepunch/Facepunch.Highlight) - Mesh outline effect
* [crest-oceanrender](https://github.com/huwb/crest-oceanrender) - An advanced ocean system implemented in Unity3D
* [HologramShader](https://github.com/andydbc/HologramShader) - Hologram Shader and Material Editor for Unity
* [ShaderlabVS](https://github.com/wudixiaop/ShaderlabVS) - ShaderlabVS is a Visual Studio plugin for Unity Shaderlab programming
* [Kamakura Shaders](https://github.com/kayac/kamakura-shaders) - Kamakura Shaders is a collection of shaders and components focusing on Non-Photorealistic Rendering for Unity with a bunch of features and adjustable parameters in a user-friendly interface.
* [ShaderProject](https://github.com/ellioman/ShaderProject) - A container for all sorts of handy shaders.
* [ShaderForge](https://github.com/FreyaHolmer/ShaderForge) - Shader visual scripting
* [Ocean_Community_Next_Gen](https://github.com/eliasts/Ocean_Community_Next_Gen) - Next gen iteration of the unity community ocean shader
* [Texture Panner](https://github.com/AdultLink/TexturePanner) - Awesome shader collection
* [ToonShading](https://github.com/Kink3d/ToonShading) - A collection of "Toon" shaders for Unity based on a stepped PBR approximation.
* [AnisotropicStandardShader](https://github.com/Kink3d/AnisotropicStandardShader) - A modified version of Unity's Standard Shader using an Anisotropic GGX BRDF.
* [SpriteGlow](https://github.com/Elringus/SpriteGlow) - A sprite glow effect for Unity game engine
* [Mirror (Script)](https://github.com/nkjzm/Mirror) - A mirror script
* [HoloShield](https://github.com/AdultLink/HoloShield) - Highly customizable sci-fi shield / force field shader for Unity3D. Allows you to set edge power & color, inner texture scrolling, waviness, scale pulsation and procedural intensity noise. Implements tessellation for low-poly base meshes.
* [VerticalDissolve](https://github.com/AdultLink/VerticalDissolve) - Procedural vertical dissolve shader. Highly customizable. Tweak edge color, noisiness & waviness, rim light, emission scrolling and more.
* [SphereDissolve](https://github.com/AdultLink/SphereDissolve) - Customizable procedural spherical dissolve shader for Unity3D, for all your customizable procedural spherical dissolve needs!
* [TexturePanner](https://github.com/AdultLink/TexturePanner) - This repository hosts a shader for Unity3D whose main goal is to facilitate the creation of neon-like signs, conveyor belts and basically whatever based on scrolling textures
* [RadialProgressBar](https://github.com/AdultLink/RadialProgressBar) - Customizable radial progress bar shader for Unity3D. Allows you to set arc range, minimum and maximum colors, textures, radius, and a few more things. Create HP Bars, Speedometers, rank progress, etc!
* [Unity-ShaderSketches](https://github.com/setchi/Unity-ShaderSketches) - Sketches made with ShaderLab in Unity.
* [Arktoon-Shaders](https://github.com/synqark/Arktoon-Shaders) - Alternative Unity shaders made by synqark
* [Unity-Shaders](https://github.com/knapeczadam/Unity-Shaders) - Shader demo - More than 300 examples
* [UltimateOutline](https://github.com/Shrimpey/UltimateOutline) - The easiest way to achieve outlines in unity.
* [Outlined-Diffuse-Shader-Fixed](https://github.com/Shrimpey/Outlined-Diffuse-Shader-Fixed) - This is a fixed version of diffused outline shader from http://wiki.unity3d.com/index.php/Outlined_Diffuse_3
* [unity-delaunay](https://github.com/OskarSigvardsson/unity-delaunay) - A Delaunay/Voronoi library for Unity, and a simple destruction effect
* [BNAO](https://github.com/Fewes/BNAO) - A tiny, GPU-based Bent Normal and Ambient Occlusion baker for Unity.
* [ezy-slice](https://github.com/DavidArayan/ezy-slice) - An open source mesh slicer framework for Unity3D Game Engine. Written in C#.
* [UnityPCSS](https://github.com/TheMasonX/UnityPCSS) - Nvidia's PCSS soft shadow algorithm implemented in Unity
* [Ceto](https://github.com/Scrawk/Ceto) - Ceto: Ocean system for Unity

### Environment
* [roadbuilder](https://github.com/guotata1996/roadbuilder) - Easy-to-build realistic roads in Unity. Foundation of any simcity game
* [hedera](https://github.com/radiatoryang/hedera) - paint 3D ivy in the Unity Editor, watch procedurally generated meshes simulate growth and clinging in real-time
* [Photosynthesizer](https://github.com/alexismorin/Photosynthesizer) - Unity plugin to procedurally sprout foliage throughout your scene.

### Framework
* [Zenject](https://github.com/modesttree/Zenject) - Dependency Injection Framework for Unity3D
* [Entitas-CSharp](https://github.com/sschmid/Entitas-CSharp) - Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
* [adic](https://github.com/intentor/adic) - Lightweight dependency injection container for Unity
* [uFrame.Complete](https://github.com/uFrame/uFrame.Complete) - All in one repo, includes: Kernel, Designer, Architect, MVVM, ECS
* [QFramework](https://github.com/liangxiegame/QFramework) - Your first K.I.S.S Unity 3D Framework
* [ecsrx.unity](https://github.com/EcsRx/ecsrx.unity) - A simple framework for unity using the ECS paradigm but with unirx for fully reactive systems
* [GameFramework](https://github.com/FlipWebApps/GameFramework) - A free framework for Unity that will help drastically increase the development speed and feature set of your games.
* [gocs](https://github.com/lazlo-bonin/gocs) - GameObject Component System for Unity

### Framework - visual
* [xNode](https://github.com/Siccity/xNode) - Lets you view and edit node graphs inside Unity
* [Fungus](https://github.com/snozbot/fungus) - https://github.com/snozbot/fungus
* [BlueGraph](https://github.com/McManning/BlueGraph)-  like xNode, but on UIElements
* [Node_Editor_Framework](https://github.com/Seneral/Node_Editor_Framework) - Node Editor framework for Unity3D

### Gameplay
* [UnityArcRayCast](https://github.com/williamrjackson/UnityArcRayCast) - Arc raycast utility using projectile formulas
* [UnityGameplayAbilitySystem](https://github.com/sjai013/UnityGameplayAbilitySystem) - A unified framework for implementing ability systems in Unity
* [Inventory-Pro](https://github.com/devdogio/Inventory-Pro) - The best-selling Inventory System for Unity - now free and open-source!
* [Quest-System-Pro](https://github.com/devdogio/Quest-System-Pro) - The powerful Quest and Conversation Tree System for Unity - now free and open-source!
* [lospro](https://github.com/devdogio/lospro) - The Lightweigt Line-of-Sight & Hearing System for Unity - now free and open-source!
* [Inventory](https://github.com/FarrokhGames/Inventory) - A Diablo 2-style inventory system for Unity3D
* [RPGCore](https://github.com/Fydar/RPGCore) - RPGCore is a toolkit for producing RPG games and mechanics for Unity
* [SanAndreasUnity](https://github.com/GTA-ASM/SanAndreasUnity) - Open source reimplementation of GTA San Andreas game engine in Unity
* [NoteEditor](https://github.com/setchi/NoteEditor) - Note editor for rhythm games.

### Input
* [Lean Touch](https://assetstore.unity.com/packages/tools/input-management/lean-touch-30111) - Powerful and complete touch library. paid additional examples available
* [InputManager](https://github.com/daemon3000/InputManager) - Custom InputManager for Unity
* [InControl](https://github.com/pbhogan/InControl) - An input manager for Unity that tames the cross-platform controller beast.
* [InputBinder](https://github.com/RyanNielson/InputBinder) - Easily bind input events to methods in Unity.
* [TouchKit](https://github.com/prime31/TouchKit) - Gestures and input handling made sane for Unity
* [TouchScript (Recommend)](https://github.com/TouchScript/TouchScript) - Complete multitouch solution for Unity: Win8, TUIO, Mobile.

### Level Editor
* [Tiled2Unity](https://github.com/Seanba/Tiled2Unity) - Export Tiled Map Editor (TMX) files into Unity
* [UnityTile3D](https://github.com/NoelFB/UnityTile3D) - Simple 3D Tile Editor
* [2DTileMapLevelEditor](https://github.com/GracesGames/2DTileMapLevelEditor) - 2D Tile Map Level Editor for Unity
* [HexTiles](https://github.com/RoryDungan/HexTiles) - Unity Hex Tile Editor
* [giles](https://github.com/procore3d/giles) - GILES: A Runtime Level Editor for Unity3D
* [floorplan](https://github.com/alexismorin/floorplan) - A Sims-Like Unity Level Design Plugin
* [realtime-CSG-for-unity](https://github.com/LogicalError/realtime-CSG-for-unity) - Realtime-CSG, CSG level editor for Unity
* [RoadArchitect](https://github.com/MicroGSD/RoadArchitect) - Road Architect for Unity
* [PrefabPainter](https://github.com/AlexanderAmeye/PrefabPainter) - A basic prefab painter for the Unity3D game engine
* [roadbuilder](https://github.com/guotata1996/roadbuilder) - Easy-to-build realistic roads in Unity. Foundation of any simcity game
* [hedera](https://github.com/radiatoryang/hedera) - paint 3D ivy in the Unity Editor, watch procedurally generated meshes simulate growth and clinging in real-time
* [Photosynthesizer](https://github.com/alexismorin/Photosynthesizer) - Unity plugin to procedurally sprout foliage throughout your scene.
* [Terrain-Stamps](https://github.com/Roland09/Terrain-Stamps) - Stamps for the Unity Terrain Stamp Tool.
* [StampToolExtended](https://github.com/Roland09/StampToolExtended) - Extended version of the Unity Terrain Stamp Tool.
* [YAPP - Yet Another Prefab Painter](https://github.com/Roland09/PrefabPainter) - Tool for conveniently and flexibly adding huge amounts of prefabs to your Unity scene.

### Light
* [Aura](https://github.com/raphael-ernaelsten/Aura) - Volumetric Lighting for Unity
* [Simple Light Probe Placer](https://github.com/AlexanderVorobyov/simple-light-probe-placer) - it is simple tool for Unity3d and it help you easily place Light Probes in your scene
* [VolumetricLights](https://github.com/SlightlyMad/VolumetricLights) - Volumetric Lights for Unity
* [Rimlight](https://github.com/AdultLink/Rimlight) - Customizable rimlight shader for Unity that includes pulsation and noise scrolling. Give your scenes that extra oomph!

### Localization
* [Lean Localization](https://assetstore.unity.com/packages/tools/localization/lean-localization-28504) Quickly add multi-language support. text, sounds, load CSV

### Lua
* [slua (Recommend)](https://github.com/pangweiwei/slua) - Fastest lua binding via static code generating for Unity3D and mono.
* [xLua (Recommend)](https://github.com/Tencent/xLua) - xLua is a hot-fix solution plugin for Unity3D, it supports android, ios, windows, osx, etc.
* [UniLua](https://github.com/xebecnan/UniLua) - A pure C# implementation of Lua 5.2 focus on compatibility with Unity3D.
* [MoonSharp](https://github.com/xanathar/moonsharp/) - An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities
* [LuaProfiler-For-Unity](https://github.com/ElPsyCongree/LuaProfiler-For-Unity) - LuaProfiler-For-Unity

### Materials
* ** [Public Domain Textures](https://publicdomaintextures.com) tons of 8K PBR Materials under CC0 License

### Math
* *** [MathUtilities](https://github.com/zalo/MathUtilities) - A collection of some of the neat math and physics tricks that I've collected over the last few years.

### Meshes
* [UnityMeshSimplifier](https://github.com/Whinarn/UnityMeshSimplifier) - Mesh simplification for Unity.
* [MeshDecimator](https://github.com/Whinarn/MeshDecimator) - A mesh decimation library for .NET and Unity.
* [SplineMesh](https://github.com/benoit-dumas/SplineMesh) - A Unity plugin to create curved content in real-time with bézier curves
* [roadcreator](https://github.com/MCrafterzz/roadcreator) - A free road creation tool for unity

### Monetization
* [unity3d-levelup](https://github.com/soomla/unity3d-levelup) - Unity3D F2P game progression library - worlds, levels, missions, scores, records and more. Part of The SOOMLA Framework - for game design, economy modeling and faster development.
* [unity3d-store](https://github.com/soomla/unity3d-store) - Unity in-app purchase & virtual economy library. Part of The SOOMLA Framework - for game design, economy modeling and faster development.
* [Google Mobile Ads Unity Plugin](https://github.com/googleads/googleads-mobile-unity) - Official Unity Plugin for the Google Mobile Ads SDK

### Networking
* [UnitySocketIO](https://github.com/NetEase/UnitySocketIO) - socket.io client for unity3d.
* [websocket-sharp](https://github.com/sta/websocket-sharp) - A C# implementation of the WebSocket protocol client and server
* [Hazel-Networking](https://github.com/DarkRiftNetworking/Hazel-Networking) - A low level networking library for C# providing connection orientated, message based communication via TCP, UDP and RUDP.
* [MassiveNet](https://github.com/jakevn/MassiveNet) - Unity3d UDP networking library focused on high-CCU, multi-server architecture.
* [Nakama](https://github.com/heroiclabs/nakama) - An open-source distributed social and realtime server for games and apps by [Heroic Labs](https://heroiclabs.com). It includes a large set of services for users, data storage, and realtime client/server communication; as well as specialized APIs like realtime multiplayer, groups/guilds, and chat.
* [Barebones Master Server](https://github.com/alvyxaz/barebones-masterserver) - Master Server framework for Unity
* [Forge Networking Remastered](https://github.com/BeardedManStudios/ForgeNetworkingRemastered) - In short, Forge Networking is a free and open source multiplayer game (multi-user) networking system that has a very good integration with the Unity game engine. You wanna make a multiplayer game or real time multi-user application? This is the library for you.
* [Facepunch.Steamworks](https://github.com/Facepunch/Facepunch.Steamworks) - Another fucking c# Steamworks implementation
* [MagicOnion](https://github.com/neuecc/MagicOnion) - gRPC based HTTP/2 RPC Streaming Framework for .NET, .NET Core and Unity.
* [lidgren-network-gen3](https://github.com/lidgren/lidgren-network-gen3) - Lidgren.Network is a networking library for .NET framework, which uses a single UDP socket to deliver a simple API for connecting a client to a server, reading and sending messages.
* [LiteNetLib](https://github.com/RevenantX/LiteNetLib) - Lite reliable UDP library for Mono and .NET
* [LiteNetLibManager](https://github.com/insthync/LiteNetLibManager) - Higher level implementation for LiteNetLib
* [UNet-Controller](https://github.com/GreenByteSoftware/UNet-Controller) - A CharacterController based controller for Unity's new Networking system
* [Steamworks.NET](https://github.com/rlabrecque/Steamworks.NET) - Steamworks wrapper for Unity / C#
* [UnityHTTP](https://github.com/andyburke/UnityHTTP) - A TcpClient-based HTTP library for Unity
* [SocketIoClientDotNet](https://github.com/Quobject/SocketIoClientDotNet) - Socket.IO Client Library for .Net
* [MLAPI](https://github.com/MidLevel/MLAPI) - A game networking framework built for the Unity Engine to abstract game networking concepts
* [Networker](https://github.com/MarkioE/Networker) -
A simple to use TCP and UDP networking library for .NET. Compatible with Unity
* [SmartFoxServer 2X](http://docs2x.smartfoxserver.com/ExamplesUnity/introduction) - A comprehensive SDK for rapidly developing multiplayer games and applications with Adobe Flash/Flex/Air, Unity, HTML5, iOS, Windows Phone 8, Android, Java, Windows 8, C++ and more
* [Colyseus](http://colyseus.io/) - Multiplayer Game Server for Node.js. [Demo with Unity3D](https://github.com/gamestdio/colyseus-unity3d)
* [UnityWebSocket](https://github.com/Unity3dAzure/UnityWebSocket) - Web Socket client for Unity
* [RESTClient](https://github.com/Unity3dAzure/RESTClient) - REST Client for Unity with JSON and XML parsing. (Features JSON helper to handle nested arrays and deserializing abstract types)
* [SpeedDate](https://github.com/proepkes/SpeedDate) - SpeedDate Masterserver: Connecting Players
* [UnityLockstep](https://github.com/proepkes/UnityLockstep) - Deterministic Lockstep with serverside framerate for Unity
* [ET](https://github.com/egametang/ET) - Unity3D Client And C# Server Framework
* [unity-fastpacedmultiplayer](https://github.com/JoaoBorks/unity-fastpacedmultiplayer) - Features a Networking Framework to be used on top of Unity Networking, in order to implement an Authoritative Server with Lag Compensation, Client-Side Prediction/Server Reconciliation and Entity Interpolation
* [Entitas-Sync-Framework](https://github.com/RomanZhu/Entitas-Sync-Framework) - Networking framework for Entitas ECS. Targeted at turnbased games or other slow-paced genres

### Physic
* [BulletSharpUnity3d](https://github.com/Phong13/BulletSharpUnity3d) - A fork of the BulletSharp project to make the Bullet Physics Engine usable from C# code in Unity3d
* [Graphics-Raycast](https://github.com/Jonny10/Graphics-Raycast) - GPU-based raycaster for Unity

### Plugins
* [Reign Unity Plugin](https://github.com/reignstudios/Reign-Unity-Plugin5) - This Reign API is a cross-platform, unified API for the Unity game engine.
* [unity-webview](https://github.com/gree/unity-webview) - A plugin for Unity 5 that overlays WebView components on Unity view. It works on Android, iOS, Unity Web Player, and OS X (Windows is not supported for now).
* [google-analytics-plugin-for-unity](https://github.com/googleanalytics/google-analytics-plugin-for-unity) - Google Analytics plugin for the Unity game creation system
* [unity-native-sharing](https://github.com/ChrisMaire/unity-native-sharing) - A Unity plugin to open native sharing dialogs on iOS and Android, primarily for sharing screenshots.
* [Unity3D Android notification plugin](https://github.com/Agasper/unity-android-notifications) - Unity3D Plugin for Android local notifications with example project

### Procedural Generation Systems
* [DungeonGenerator](https://github.com/jongallant/DungeonGenerator) - A dungeon generator for Unity
* [Procedural-Cave-Generator](https://github.com/AK-Saigyouji/Procedural-Cave-Generator) - Unity scripts that procedurally generate ready-to-use cave meshes.
* [unity-procedural-tree](https://github.com/mattatz/unity-procedural-tree) - Procedural tree builder for Unity.
* [unity-procedural-flower](https://github.com/mattatz/unity-procedural-flower) - Procedural flower generator for Unity.
* [ProceduralToolkit](https://github.com/Syomus/ProceduralToolkit) - Procedural generation library for Unity
* [wavefunctioncollapse](https://github.com/marian42/wavefunctioncollapse/) - Walk through an infinite, procedurally generated city
* [ProceduralLevelGenerator-Unity](https://github.com/OndrejNepozitek/ProceduralLevelGenerator-Unity) - Unity plugin from procedural dungeon generation

### Pooling System
* [Unity-QuickPool](https://github.com/densylkin/QuickPool) - Simple pooling toolkit for Unity game engine
* [RecyclerKit](https://github.com/prime31/RecyclerKit) - Object pool manager for Unity
* [ObjectPool](https://github.com/UnityPatterns/ObjectPool) - Instead of creating and destroying new objects all the time, this script reduces garbage by pooling instances, allowing you to seemingly create hundreds of new objects while only actually using a recycled few.
* [unity-object-pool](https://github.com/thefuntastic/unity-object-pool) - An elegant object pool and manager implementation for Unity

### Profobuf
* [protobuf-net](https://github.com/mgravell/protobuf-net) - Protocol Buffers library for idiomatic .NET
* [protobuf-unity](https://github.com/5argon/protobuf-unity) - Automatic .proto files compilation in Unity project to C# as you edit them

### Scriptable Object
* [unity-atoms](https://github.com/AdamRamberg/unity-atoms) - Tiny modular pieces utilizing the power of Scriptable Objects
* [Scriptable-Framework](https://github.com/pablothedolphin/Scriptable-Framework) - A Unity Framework for modular app creation based on ScriptableObject architecture, data oriented design and event driven programming to help programmers and designers adhere to the 5 SOLID programming principals.
* [yaSingleton](https://github.com/jedybg/yaSingleton) - A singleton pattern implementation for Unity3d. Based on ScriptableObjects instead of the conventional MonoBehaviour approach.
* [SOFlow](https://github.com/BLUDRAG/SOFlow) - A ScriptableObject oriented design SDK.
* [ScriptableObject-Architecture](https://github.com/DanielEverland/ScriptableObject-Architecture) - Makes using Scriptable Objects as a fundamental part of your architecture in Unity super easy

### Scriptings
* [UnityNativeScripting](https://github.com/jacksondunstan/UnityNativeScripting) - Unity Scripting in C++
* [unity-python](https://github.com/exodrifter/unity-python) - Python plugin for Unity3D
* [YarnSpinner](https://github.com/YarnSpinnerTool/YarnSpinner) - Yarn Spinner is a tool for building interactive dialogue in games!
* [UniScript](https://github.com/pjc0247/UniScript) - Brings C# scripting into Unity which acts as native code.
* [SlowSharp](https://github.com/pjc0247/SlowSharp) - C# interpreter written in C#

### Services
* [Google Play Games plugin for Unity](https://github.com/playgameservices/play-games-plugin-for-unity) - Google Play Games plugin for Unity
* [line-sdk-unity](https://github.com/line/line-sdk-unity) - Provides a modern way of implementing LINE APIs in Unity games, for iOS and Android.

### Sounds
* [usfxr](https://github.com/zeh/usfxr) - a C# library used to generate and play game-like procedural audio effects inside Unity. With usfxr, one can easily design and synthesize original sound in real time for actions such as item pickups, jumps, lasers, hits, explosions, and more, without ever leaving the Unity editor.
* [Unity-Beat-Detection](https://github.com/allanpichardo/Unity-Beat-Detection) - Musical beat detection and audio spectrum analysis for use with the Unity game engine.
* [LibNoise.Unity](https://github.com/ricardojmendez/LibNoise.Unity) - Coherent noise library for Unity, a port of LibNoise
* [Reaktion](https://github.com/keijiro/Reaktion) - Audio reactive animation toolkit for Unity
* [MusicEngine](https://github.com/geekdrums/MusicEngine) - make music synced game with Unity / ADX2 / Wwise

### Timeline
* [SpineTimeline](https://github.com/5argon/SpineTimeline) - Animate SkeletonAnimation or SkeletonGraphic with Unity's Timeline

### Tweening
* [DOTween (Recommend)](https://github.com/Demigiant/dotween) - A Unity C# animation engine. HOTween v2
* [LeanTween](https://github.com/dentedpixel/LeanTween) - LeanTween is an efficient animation engine for Unity
* [GoKit](https://github.com/prime31/GoKit) - Lightweight tween library for Unity
* [Uween](https://github.com/beinteractive/Uween) - Lightweight tween library for Unity
* [ZestKit](https://github.com/prime31/ZestKit) - Tween library for Unity. The best of GoKit and GoKitLite combined in an easy to use API

### Vehicle
* [Tork](https://github.com/adrenak/Tork) - Vehicle system for Unity

### UI
* [FairyGUI-unity](https://github.com/fairygui/FairyGUI-unity) - A flexible UI framework for Unity
* [MiniMap](https://github.com/Area730/MiniMap) - Unity3D mini map (radar) system (Asset Store link - https://www.assetstore.unity3d.com/en/#!/content/33729 )
* [LoopScrollRect](https://github.com/qiankanglai/LoopScrollRect) - UGUI ScrollRect reusing cells, to improve performance, loading time and draw calls.
* [MaterialUI](https://github.com/InvexGames/MaterialUI) - MaterialUI is a UI kit for Unity that follows Google's official material design guidelines.
* [Unity-UI-Extensions](https://bitbucket.org/UnityUIExtensions/unity-ui-extensions)
* [EnhancedScrollView](https://github.com/tinyantstudio/EnhancedScrollView) - Cool 3d scoll view for Unity(NGUI 3D UGUI support)
* [Beautiful Text Outline for Unity UI](https://github.com/n-yoda/unity-vertex-effects) - Beautiful text outline for Unity UI.
* [uGUI-Effect-Tool](https://github.com/WestHillApps/uGUI-Effect-Tool) - Vertex color UI Effect for Unity UI (uGUI).
* [Unity-UI-Polygon](https://github.com/CiaccoDavide/Unity-UI-Polygon) - Polygon renderer for the new Unity UI
* [muip](https://github.com/Michsky/muip) - Modern UI Pack for Unity engine
* [lomenui](https://github.com/Michsky/lomenui) - Stylish UI package for Unity engine
* [ultimatehudskins](https://github.com/Michsky/ultimatehudskins) - Stylish HUD layouts for Unity engine
* [looader](https://github.com/Michsky/looader) - Loading screen solution for Unity engine
* [UIEffect](https://github.com/mob-sakai/UIEffect) - UIEffect is an effect component for uGUI element in Unity. Let's decorate your UI with effects!
* [ParticleEffectForUGUI](https://github.com/mob-sakai/ParticleEffectForUGUI) - This plugin provide a component to render particle effect for uGUI in Unity 2018.2+. The particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas
* [ShinyEffectForUGUI](https://github.com/mob-sakai/ShinyEffectForUGUI) - Shiny effect of uGUI, which does not need mask or normal map
* [FancyScrollView](https://github.com/setchi/FancyScrollView) - A scrollview component that can be implemented flexible flexible animation
* [Juicy Healthbar](https://twitter.com/AntonPantev/status/1140063685655826432) - "I made the Juicy Health Bar from @reuno’s Unite LA talk. It’s pretty great!"
* [UIWidgets](https://github.com/UnityTech/UIWidgets) - UIWidget is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
* [PageTurningUIEffect](https://github.com/lobeyjon/PageTurningUIEffect) - A page turning UI effect made with unity, the paper deformation is determined by the pins' position on it
* [Unity-WinForms](https://github.com/Meragon/Unity-WinForms) - Windows Forms wrapper for Unity
* [Delight](https://github.com/delight-dev/Delight) - Component-oriented UI framework for Unity https://delight-dev.github.io/
* [CharTweener](https://github.com/mdechatech/CharTweener) - Unity3D - DOTween extensions for tweening TextMeshPro characters
* [UnityRecyclingListView](https://github.com/sinbad/UnityRecyclingListView) - A fast scrolling list component for Unity UI which recycles its child elements
* [sci-fi-ui](https://github.com/devdogio/sci-fi-ui) - The uGUI Sci-Fi UI Design for Unity - now free and open-source!
* [LiquidSwipeUnity](https://github.com/FaizanDurrani/LiquidSwipeUnity) - Butter smooth full page swiping animation with a masked wave effect in Unity
* [Unity-UI-Rounded-Corners](https://github.com/Nobinator/Unity-UI-Rounded-Corners) - This components and shaders allows you to add rounded corners to UI element
* [RapidGUI](https://github.com/fuqunaga/RapidGUI) - Unity OnGUI(IMGUI) extensions for Rapid prototyping/development
* [ugui-mvvm](https://github.com/jbruening/ugui-mvvm) - Unity3D uGUI mvvm databinding via the standard IXChanged interfaces used in wpf (INotifyPropertyChanged, INotifyCollectionChanged, etc)
* [Recyclable-Scroll-Rect](https://github.com/MdIqubal/Recyclable-Scroll-Rect) - Recyclable Scroll Rect reuses or recycles the least number of cells required to fill the viewport. As a result a huge number of items can be shown in the list without any performance hit.
* [UnityGUI](https://github.com/coryleach/UnityGUI) - UGUI Panel Systems for navigation, animation and more
* [UGUIExtend](https://github.com/L-Lawliet/UGUIExtend)

### Utilities
* [LINQ to GameObject](https://github.com/neuecc/LINQ-to-GameObject-for-Unity) - Traverse GameObject Hierarchy by LINQ
* [Moments](https://github.com/Chman/Moments) - A quick GIF replay recorder for Unity
* [FrameCapture](https://github.com/Chman/FrameCapture) - A simple frame-by-frame capture tool for Unity to record perfectly smooth, supersampled replays or cinematics.
* [UniGif](https://github.com/WestHillApps/UniGif) - GIF image decoder for Unity.
* [unityassets](https://github.com/fholm/unityassets) - Assorted assets previously on sale on the Unity Asset Store, now free on github.
* [UnityToolbag](https://github.com/nickgravelyn/UnityToolbag) - Variety of Unity scripts and tools.
* [C-Sharp-Promise](https://github.com/Real-Serious-Games/C-Sharp-Promise) - Promises library for C# for management of asynchronous operations.
* [3DMath](https://github.com/GregLukosek/3DMath) - Unity C# 3D Math methods library.
* [Projeny](https://github.com/modesttree/Projeny) - A project and package manager for Unity.
* [Unity Size Explorer](https://github.com/aschearer/unitysizeexplorer) - Visualize how much space each asset in your Unity game takes and quickly optimize your game's file size.
* [UnityStudio](https://github.com/RaduMC/UnityStudio) - Unity Studio is a tool for exploring, extracting and exporting assets from Unity games and apps.
* [InGameReplay](https://github.com/FeNo/InGameReplay) - Allow you to record the transform of any objects to replay it
* [UniRx](https://github.com/neuecc/UniRx) - Reactive Extensions for Unity
* [UnityMainThreadDispatcher](https://github.com/PimDeWitte/UnityMainThreadDispatcher) - A simple, thread-safe way of executing actions (Such as UI manipulations) on the Unity Main Thread
* [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) - A NuGet Package Manager for Unity
* [UnityPSDLayoutTool](https://github.com/GlitchEnzo/UnityPSDLayoutTool) - A tool used to import a Photoshop Documents (.psd files) into the Unity Game Engine.
* [Rant](https://github.com/TheBerkin/rant) - Robust text engine for procedural generation and postprocessing
* [E7Unity](https://github.com/5argon/E7Unity) - Common Unity resources
* [mmd-for-unity](https://github.com/mmd-for-unity-proj/mmd-for-unity) - MikuMikuDance for Unity
* [Unity.Library.eppz](https://github.com/eppz/Unity.Library.eppz) - Collection of libraries for Unity
* [yaSingleton](https://github.com/jedybg/yaSingleton) - A singleton pattern implementation for Unity3d. Based on ScriptableObjects instead of the conventional MonoBehaviour approach.
* [Alchemy-Circles-Generator](https://github.com/CiaccoDavide/Alchemy-Circles-Generator) - A simple procedural generator of alchemy circles
* [odin-serializer](https://github.com/TeamSirenix/odin-serializer) - Fast, robust, powerful and extendible .NET serializer built for Unity
* [UnityAsyncRoutines](https://github.com/TorVestergaard/UnityAsyncRoutines) - An extremely lightweight Unity library for creating and managing asynchronous coroutines for easy, straight-forward multi-threading and parallellism
* [fullserializer](https://github.com/jacobdufault/fullserializer) - A robust JSON serialization framework that just works with support for all major Unity export platforms
* [IMP](https://github.com/xraxra/IMP) - billboard imposter baking for Unity
* [UDBase](https://github.com/KonH/UDBase) - module-based game template for Unity. Modules in UDBase are called Controllers, their implementation can be replaced without changing your project source code
* [graphy](https://github.com/Tayx94/graphy) - Graphy is the ultimate, easy to use, feature packed stats monitor and debugger for your Unity project
* [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) - A NuGet Package Manager for Unity
* [GoogleSheetsUnity](https://github.com/5argon/GoogleSheetsUnity) - Get data from your private Google Sheets to Unity!! (Read-only)
* [unity-routines](https://github.com/tomblind/unity-routines) - Replacement for Unity coroutines that supports hierarchical routines and pooling
* [CropTexture](https://github.com/natsupy/CropTexture) - Crop and resize texture in unity editor! Open it: Press F1
* [demilib](https://github.com/Demigiant/demilib) - A library of various utilities and tools for Unity (alpha)
* [SerializableCallback](https://github.com/Siccity/SerializableCallback) - UnityEvent and System.Func had a child
* [bitstrap](https://github.com/bitcake/bitstrap) - BitStrap is BitCake's collection of Unity tools that improve our workflow
* [NaughtyAttributes](https://github.com/dbrizov/NaughtyAttributes) - Attribute Extensions for Unity
* [Unity3DRuntimeTransformGizmo](https://github.com/HiddenMonk/Unity3DRuntimeTransformGizmo) - A runtime transform gizmo similar to unitys editor so you can translate (move, rotate, scale) objects at runtime
* [UnityPack](https://github.com/HearthSim/UnityPack) - Python deserialization library for Unity3D Asset format
* [UnityOctree](https://github.com/Nition/UnityOctree) - A dynamic, loose octree implementation for Unity written in C#
* [CoroutineChain](https://github.com/geniikw/CoroutineChain) - Unity3d, Coroutine, scripting
* [disruptor-unity3d](https://github.com/dave-hillier/disruptor-unity3d) - Basic implementation of Disruptor for Unity3d
* [uREPL](https://github.com/hecomi/uREPL) - In-game powerful REPL environment for Unity3D
* [RuntimeUnityEditor](https://github.com/ManlyMarco/RuntimeUnityEditor) - In-game inspector and debugging tools for applications made with Unity3D game engine
* [Deform](https://github.com/keenanwoodall/Deform) - A fully-featured deformer system for Unity
* [OnionRingUnity](https://github.com/kyubuns/OnionRingUnity) - Auto 9 slice sprite generator
* [UnityMultiBuild](https://github.com/sinbad/UnityMultiBuild) - Batch build for multiple platforms from within the Unity editor
* [UnityCsvUtil](https://github.com/sinbad/UnityCsvUtil) - Lightweight but type safe CSV serialise/deserialise of objects
* [InkPainter](https://github.com/EsProgram/InkPainter) - Texture-Paint on Unity
* [WaveformProvider](https://github.com/EsProgram/WaveformProvider) - Provide a texture to simulate waves with Unity. Require InkPainter.
* [DataBind](https://github.com/tinrab/DataBind) - Simple data binding for Unity
* [GradientGenerator](https://github.com/5argon/GradientGenerator) - A Unity script to generate multiple variants of evenly distributed `Gradient` based on input `AnimationCurve`.
* [Dialogue](https://github.com/Siccity/Dialogue) - Node based dialogue system
* [Unity-EasingLibraryVisualisation](https://github.com/noisecrime/Unity-EasingLibraryVisualisation) - Front end visualisation of 40 common easing equations.
* [UnityGoogleDrive](https://github.com/Elringus/UnityGoogleDrive) - Google Drive SDK for Unity game engine
* [unity-mulligan-renamer](https://github.com/redbluegames/unity-mulligan-renamer) - Mulligan Renamer tool for the Unity Editor allows for quick and safe renaming of many assets and gameobjects at once
* [Xamarin.Forms.Unity](https://github.com/aosoft/Xamarin.Forms.Unity) - Xamarin.Forms for Unity (Platform implementation for Unity Game Engine)
* [WhatUsesThis](https://github.com/Facepunch/WhatUsesThis) - Right click an asset and get a list of assets that use it
* [UnityTimer](https://github.com/akbiggs/UnityTimer) - Powerful and convenient library for running actions after a delay in Unity3D
* [PixelSpriteGenerator-Unity](https://github.com/Shogan/PixelSpriteGenerator-Unity) - A port of the PixelSpriteGenerator to C# for use with the Unity3D game engine
* [WeightedRandomSelector](https://github.com/viliwonka/WeightedRandomSelector) - Very fast C# class for weighted random picking.
* [SmartAssembler](https://github.com/Electronic-Brain/SmartAssembler) - Smartly Assembly your Project
* [ScriptableObject-Architecture](https://github.com/DanielEverland/ScriptableObject-Architecture) - Makes using Scriptable Objects as a fundamental part of your architecture in Unity super easy
* [GetComponentAttribute](https://github.com/m3rt32/GetComponentAttribute) - A simple DI plugin for getting MonoBehaviour components just with an attribute over fields.
* [unity-utils](https://github.com/nubick/unity-utils) - Different help scripts for Unity engine.

### Video
* [Vimeo Unity SDK](https://github.com/vimeo/vimeo-unity-sdk) - Easily stream your Vimeo videos into Unity or record and publish out to Vimeo

### Voxel
* [MagicaVoxel](https://ephtracy.github.io/) Free to use Voxel editor (even for commercial).
* [UnityVoxelTools](https://github.com/meniku/UnityVoxelTools) - Collection of Voxel Utilities for Unity

### VR
* [VRTK](https://github.com/thestonefox/VRTK) - A productive VR Toolkit for rapidly building VR solutions in Unity3d.
* [NewtonVR](https://github.com/TomorrowTodayLabs/NewtonVR) - A virtual reality interaction system for unity based on physics.
* [MixedRealityToolkit-Unity](https://github.com/Microsoft/MixedRealityToolkit-Unity) - MixedRealityToolkit-Unity uses code from the base MixedRealityToolkit repository and makes it easier to consume in Unity.
* [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk) - Google VR SDK for Unity http://developers.google.com/vr/unity/
* [TButt](https://github.com/turbobutton/tbutt-vr) - A lightweight multiplatform VR interface for Unity
* [VRWorksAudio-Unity](https://github.com/Andy260/VRWorksAudio-Unity) - Unofficial implementation of NVIDIA's VRWorks - Audio for Unity3D
* [Lightweight-VR](https://github.com/Spatial-Cinematics/Lightweight-VR) - An open sourced, light weight, VR input framework. This is basically an empty Unity project that's been setup for easy VR integration without having to pull down any packages. No need for Steam VR or OVR plugins.

## Assets

### Icons

* [I made 700+ RPG icons free for use for your game](https://www.reddit.com/r/IndieGaming/comments/ifmie/i_made_700_rpg_icons_free_for_use_/) - 700+ RPG Icons(The _filesonic_ URL ending with "Lorc_RPG_icons.zip" still works)
* [game-icons.net](https://game-icons.net) 3443+ Game Icons licensed under CC BY 3.0
* [EffectCore's VFX Packs](https://assetstore.unity.com/publishers/25749) - Paid AAA visual effects.

### Collections / Forums / Shops

* [Unitylist](https://unitylist.com/) - the best GitHub Unity repositories search engine
* [Armedunity](https://armedunity.com/) - Shooter focused forum
* [itch.io](https://itch.io/game-assets)
* [Game Assets](https://game-asset.net/)
* [Game Dev Market](https://www.gamedevmarket.net/)
* [Open Game Art](https://opengameart.org/)
* [Unity Assetstore](https://assetstore.unity.com/) - Official asset store for unity.

### Creation Tools

* [Aseprite](https://www.aseprite.org/) - Animated sprite editor & pixel art tool.
* [AssetForge](https://kenney.itch.io/assetforge) - Easily create simple assets in seconds (Paid).
* [BFXR](https://www.bfxr.net/) - Make sound effects for computer games (Flash required)
* [Mixamo](https://www.mixamo.com/) - Free to use animation mixing tool with free animations. Not allowed to use in open source projects.

### Audio

* [Sonniss GDC 2018 Pack](https://sonniss.com/gameaudiogdc18/) - Free to use 30GB worth of audio files

## Articles
* [50 Tips and Best Practices for Unity (2016 Edition)](https://www.gamasutra.com/blogs/HermanTulleken/20160812/279100/50_Tips_and_Best_Practices_for_Unity_2016_Edition.php)
* [Unity Package Manager 2018.3+](https://blogs.unity3d.com/2018/05/09/unity-packages-life-cycle/)
* [Cracked Ice Shader](https://80.lv/articles/how-to-build-cracked-ice-in-material-editor/)

## Books
* [Game Programming Patterns](http://gameprogrammingpatterns.com/) Free and Paid available

---
## To Be organized

## Game Based Learning
- [RAGE ecosystem](http://rageproject.eu)
- [uAdventure](https://github.com/e-ucm/uAdventure) Serious game editor for Unity based on eAdventure.
- [Unity Tracker](https://github.com/e-ucm/unity-tracker) Unity gleaner tracker that uses csharp-tracker / RAGE

repo_name: StefanoCecere/awesome-opensource-unity

mime_type: text/plain


text:
/*	Norman.h - Library for climatic simulation.
  	Created by 934Virginia, 2019-07-08.
	Released into the public domain.
	Dusk2Dawn library, NOAA Solar Calculator, and DayofYear function are the property of their respective authors.
*/
#ifndef Norman_h
#define Norman_h

	#include "Arduino.h"
	#include "Dusk2Dawn.h"
	#include <time.h>

	struct SetTarget_Origin {
		float Lat;
		float Lon;
		int TZ;
		time_t StartDT;
		int SLength;
	};
	struct SetRangeTDP {
		time_t xminL;
		time_t xmaxL;
		float minlow;
		float minhigh;
		float maxlow;
		float maxhigh;
	};

	//Norman();
	//struct SetTarget_Origin(float, float, int, time_t, int);
	//struct SetRangeTDP(time_t, time_t, float, float, float, float);
	time_t getTime(int, byte, byte, byte, byte, byte);
	bool DSTCheck(time_t);
	float RHtoDP(float, float, String);
	time_t getSun(time_t, struct SetTarget_Origin, struct SetTarget_Origin, String);
	float getTDP(time_t, struct SetTarget_Origin, struct SetTarget_Origin, struct SetRangeTDP, int);
	float getRH(float, float, String);

	int getYear(time_t);
	byte getMonth(time_t);
	byte getDay(time_t);
	byte getHour(time_t);
	byte getMinute(time_t);
	byte getSecond(time_t);
	float cosTDP(float, float, float, float, float);
	float polyTDP(float, float, float, float, float);
	int DayofYear(int, int, int);
	time_t halfTime(time_t, time_t);
	time_t getRiseSet(float, float, int, float, float, int, time_t, time_t, int, int, String, int);
	float baseD(float, float, float, float, time_t, time_t, time_t, time_t, int, long, int, int, float, int);
	float baseN(float, float, float, float, time_t, time_t, time_t, time_t, int, long, int, int, time_t, int);
	long getTPeak(time_t, time_t, int);
	int getDOYRange(int, int, time_t);
	time_t calcSun(time_t, float, float, int, float, float, int, time_t, time_t, int, String);
	float calcTDP(time_t, float, float, int, float, float, int, time_t, time_t, int, time_t, time_t, float, float, float, float, int);

#endif

mime_type: text/x-c


text:
#include "Arduino.h"
#include <time.h>
#include "Norman.h"
#include "Dusk2Dawn.h"

//Unused as of now, but included in case someone needs to interact with syncprovider
/*
time_t syncProvider() {
  DateTime x = rtc.now();

  int yearx = x.year();
  byte monthx = x.month();
  byte dayx = x.day();
  byte hourx = x.hour();
  byte minutex = x.minute();
  byte secondx = x.second();

  struct tm tmSet;
  tmSet.tm_year = yearx - 1900;
  tmSet.tm_mon = monthx - 1;
  tmSet.tm_mday = dayx;
  tmSet.tm_hour = hourx;
  tmSet.tm_min = minutex;
  tmSet.tm_sec = secondx;
  return mk_gmtime(&tmSet) + UNIX_OFFSET;
}
*/

//creates time_t object
time_t getTime(int yearx, byte monthx, byte dayx, byte hourx, byte minutex, byte secondx)  {

  struct tm tmSet;
  tmSet.tm_year = yearx - 1900;
  tmSet.tm_mon = monthx - 1;
  tmSet.tm_mday = dayx;
  tmSet.tm_hour = hourx;
  tmSet.tm_min = minutex;
  tmSet.tm_sec = secondx;
  return mk_gmtime(&tmSet) + UNIX_OFFSET;
}

int getYear(time_t timeIn) {
  timeIn -= UNIX_OFFSET;
  struct tm * getStruct;
  getStruct = gmtime(&timeIn);

  return (getStruct->tm_year) + 1900;
}

byte getMonth(time_t timeIn) {
  timeIn -= UNIX_OFFSET;
  struct tm * getStruct;
  getStruct = gmtime(&timeIn);

  return (getStruct->tm_mon) + 1;
}

byte getDay(time_t timeIn) {
  timeIn -= UNIX_OFFSET;
  struct tm * getStruct;
  getStruct = gmtime(&timeIn);

  return (getStruct->tm_mday);
}

byte getHour(time_t timeIn) {
  timeIn -= UNIX_OFFSET;
  struct tm * getStruct;
  getStruct = gmtime(&timeIn);

  return (getStruct->tm_hour);
}

byte getMinute(time_t timeIn) {
  timeIn -= UNIX_OFFSET;
  struct tm * getStruct;
  getStruct = gmtime(&timeIn);

  return (getStruct->tm_min);
}

byte getSecond(time_t timeIn) {
  timeIn -= UNIX_OFFSET;
  struct tm * getStruct;
  getStruct = gmtime(&timeIn);

  return (getStruct->tm_sec);
}

//used to get daily lows and highs from lows and highs of hottest and coldest days of the year
float cosTDP(float x, float ymin, float ymax, float xmin, float cycle) {
  return (((ymax + ymin) / 2) - (((ymax - ymin) / 2) * cos((((2 * PI) / cycle) * x) - (((2 * PI) / cycle) * xmin))));
}

//our base function for the daytime temperature and dewpoint shifts
float polyTDP(float x, float ymin, float ymax, float xmin, float cycle) {
  return ((pow((x - xmin), 2)) * ((1 / (pow((cycle / 2), 4) / (ymax - ymin))) * (pow((x - cycle), 2))) + ymin);
}

//alternate daytime function-- the curvature is a bit closer to raw data, but there's no exponential ramp up from dawn doing it this way. Also throws baseN off.
//worth playing with if you want to rework things.
/*float paraTDP(float x, float ymin, float ymax, float xmin, float cycle) {
  return (ymax - (((ymax - ymin) / (cycle / 2)) / (cycle / 2)) * pow((((x - xmin) - (cycle / 2))), 2));
}*/

//"toDayOfYear.ino" function swiped from jrleeman. Returns numerical day of calendar year.
int DayofYear(int dayx, int monthx, int yearx) {

  int daysInMonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};

  // Verify we got a 4-digit year
  if (yearx < 1000 || dayx < 1 || dayx > daysInMonth[monthx-1]) {
    return 999;
  }

  if (yearx%4  == 0) {
    if (yearx%100 != 0) {
      daysInMonth[1] = 29;
    }
    else {
      if (yearx%400 == 0) {
        daysInMonth[1] = 29;
      }
    }
   }

  int doy = 0;
  for (int i = 0; i < monthx - 1; i++) {
    doy += daysInMonth[i];
  }

  doy += dayx;
  return doy;
}

//Some of this stuff is probably super redundant.

time_t halfTime(time_t one, time_t two) {
  if (two > one)  {
    return one + (long (two - one) / 2);
  }
  else  {
    return two + (long (one - two) / 2);
  }
}

//Quick and dirty DST check for flash time.
bool DSTCheck(time_t flash)  {
  int DSTy = 8;
  int DSTx = 13 - ((((getYear(flash) - 2016) / 4) * 2) + ((getYear(flash) - 2016) - ((getYear(flash) - 2016) / 4)));
  if (DSTx >= 8)  {
    DSTy = DSTx;
  }
  else if (DSTx == 1) {
    DSTy = (DSTx + 7);
  }
  else  {
    DSTy = (((((8 - DSTx) / 7) + 1) * 7) + DSTx);
  }
  if (flash < getTime(getYear(flash), 11, (DSTy - 7), 2, 0, 0) || flash >= getTime(getYear(flash), 3, DSTy, 2, 0, 0)) {
    return true;
  }
  else  {
    return false;
  }
}

//jenkball method to anchor target daylight hours to Origin hours, centered on Origin's solar noon. If Target = Origin, it does nothing.
time_t getRiseSet(float tLat, float tLon, int tTZ, float oLat, float oLon, int oTZ, time_t startDTTar, time_t startDTOrig, int SPosition, int ODiff, String RiseOrSet, int adj)  {

  Dusk2Dawn target(tLat, tLon, tTZ);
  Dusk2Dawn origin(oLat, oLon, oTZ);

  startDTTar = startDTTar + ((SPosition + adj) * 86400L);
  startDTOrig = startDTOrig + ((ODiff + adj) * 86400L);

  int targetSunrise = target.sunrise(getYear(startDTTar), getMonth(startDTTar), getDay(startDTTar), false);
  int targetSunset = target.sunset(getYear(startDTTar), getMonth(startDTTar), getDay(startDTTar), false);

  int originSunrise = origin.sunrise(getYear(startDTOrig), getMonth(startDTOrig), getDay(startDTOrig), false);
  int originSunset = origin.sunset(getYear(startDTOrig), getMonth(startDTOrig), getDay(startDTOrig), false);

  time_t LStartTar = getTime(getYear(startDTTar), getMonth(startDTTar), getDay(startDTTar), int((targetSunrise) / 60), int((targetSunrise) % 60), 0);
  time_t LEndTar = getTime(getYear(startDTTar), getMonth(startDTTar), getDay(startDTTar), int((targetSunset) / 60), int((targetSunset) % 60), 0);
  time_t LStartOrig = getTime(getYear(startDTOrig), getMonth(startDTOrig), getDay(startDTOrig), int((originSunrise) / 60), int((originSunrise) % 60), 0);
  time_t LEndOrig = getTime(getYear(startDTOrig), getMonth(startDTOrig), getDay(startDTOrig), int((originSunset) / 60), int((originSunset) % 60), 0);

  if (RiseOrSet == "Rise") {
    return (halfTime(LEndOrig, LStartOrig)) - (difftime(LEndTar, LStartTar) / 2);
  }
  else if (RiseOrSet == "Set") {
    return (halfTime(LEndOrig, LStartOrig)) + (difftime(LEndTar, LStartTar) / 2);
  }

}

//The giant, disgusting basic function of daily temperature and humidity cycles. Sunrise to TPeak is anchored to the previous night's baseN value at sunrise.
//TPeak to sunset is bound to the cosTDP-derived daily maximum value.
float baseD(float minlow, float maxlow, float minhigh, float maxhigh, time_t currentTime, time_t LStart, time_t LEnd, time_t StartDT, int SPositionx, long TPeak, int xmin, int xmax, float baseNMinus, int adj) {

  int SPosition = SPositionx;
  int currentTimex = DayofYear(getDay(currentTime), getMonth(currentTime), getYear(currentTime));
  int xminx = xmin;
  time_t StartDTadj = StartDT + ((SPosition + adj) * 86400L);
  int TarTimex = DayofYear(getDay(StartDTadj), getMonth(StartDTadj), getYear(StartDTadj));

    if (xmax > xmin) {
      if (TarTimex >= xmax && xmax < 354)  {
        xminx += 365;
      }
      else if (xmax >= 354)  {
        if  (TarTimex >= xmax)  {
          xminx += 365;
        }
        else if (TarTimex < xmin)  {
          xminx += 0;
        }
      }
    }

    else if (xmin > xmax)  {
      if (TarTimex >= xmin && xmin < 354) {
        xminx -= 365;
      }
      else if (xmin >= 354)  {
        if  (TarTimex >= xmin)  {
          xminx += 0;
        }
        else if (TarTimex < xmax)  {
          xminx -= 365;
        }
      }
    }

  int AdjDOY = DayofYear(getDay(StartDTadj), getMonth(StartDTadj), getYear(StartDTadj));
  if (AdjDOY >= 365 && DayofYear(getDay(StartDT), getMonth(StartDT), getYear(StartDT)) <= 1) {
    if (getYear(StartDTadj) < getYear(StartDT)) {
      AdjDOY -= 365;
    }
  }

  float ymin = cosTDP(AdjDOY, minlow, maxlow, xminx, (getDOYRange(xmin, xmax, StartDTadj)));

  if (currentTime < (LStart + TPeak))  {
    ymin = baseNMinus;
  }

  float currentX = (((currentTime - LStart) / 3600) + (float((currentTime - LStart) % 3600) / 3600));
  float ymax = cosTDP(AdjDOY, minhigh, maxhigh, xminx, (getDOYRange(xmin, xmax, StartDTadj)));
  float cycleX = ((((LStart + TPeak) - LStart) / 3600) + (float(((LStart + TPeak) - LStart) % 3600) / 3600)) * 2;

  return polyTDP(currentX, ymin, ymax, 0, cycleX);
  //return paraTDP(currentX, ymin, ymax, 0, cycleX);
}

//Calculations for nighttime temperature and humidity. Starting point derived regressively from BaseD values at sunset.
float baseN(float minlow, float maxlow, float minhigh, float maxhigh, time_t currentTime, time_t LStart, time_t LEnd, time_t StartDT, int SPosition, long TPeak, int xmin, int xmax, time_t LStartN, int adj) {
  int SPosS, SPosE = 0;
  time_t StartDTadj = StartDT + ((SPosition + adj)* 86400L);
  int AdjDOY = DayofYear(getDay(StartDTadj), getMonth(StartDTadj), getYear(StartDTadj));
  if (AdjDOY >= 365 && DayofYear(getDay(StartDT), getMonth(StartDT), getYear(StartDT)) <= 1) {
    if (getYear(StartDTadj) < getYear(StartDT)) {
      AdjDOY -= 365;
    }
  }
  float x = ((currentTime - LEnd) / 3600) + (float((currentTime - LEnd) % 3600) / 3600);
  int currentTimex = DayofYear(getDay(currentTime), getMonth(currentTime), getYear(currentTime));
  int xminx = xmin;
  int TarTimex = DayofYear(getDay(StartDTadj), getMonth(StartDTadj), getYear(StartDTadj));

  if (xmax > xmin) {
    if (TarTimex >= xmax && xmax < 354)  {
      xminx += 365;
    }
    else if (xmax >= 354)  {
      if  (TarTimex >= xmax)  {
        xminx += 365;
      }
      else if (TarTimex < xmin)  {
        xminx += 0;
      }
    }
  }

  else if (xmin > xmax)  {
    if (TarTimex >= xmin && xmin < 354) {
      xminx -= 365;
    }
    else if (xmin >= 354)  {
      if  (TarTimex >= xmin)  {
        xminx += 0;
      }
      else if (TarTimex < xmax)  {
        xminx -= 365;
      }
    }
  }

  if ((getDay(LStart) != getDay(LEnd))) {
    if (getDay(currentTime) == getDay(LEnd)) {
      SPosS += 1;
    }
    else if (getDay(currentTime) == getDay(LStart)) {
      SPosE-=1;
    }

    float LEndVal = baseD(minlow, maxlow, minhigh, maxhigh, LEnd, LStartN, LEnd, StartDT, SPosition, TPeak, xminx, xmax, 0, (SPosE + adj));
    float LStartVal = cosTDP(AdjDOY, minlow, maxlow, xminx, (getDOYRange(xmin, xmax, StartDTadj)));

    //the .8 constant wasn't really derived from any legit calculations, it was just the product of a lot of fiddling to see what came closest. Tinker with it as you see fit.
    return ((LEndVal - LStartVal) * (pow(.8, x))) + LStartVal;
  }
}

//Convert Relative Humidity to Dewpoint. Included because why not. Requires RH and Temperature at a given point in time.
//If you cant's get dewpoint in your weather data, but you have RH and Temperature at the low and high points of the hottest and coldest days, it should serve just fine.
float RHtoDP(float Temp, float RH, String CorF) {
  if (CorF == "F") {
    Temp -=  32;
    Temp /= 1.8;
    return ((243.04 * (log(RH / 100) + ((17.625 * Temp) / (243.04 + Temp))) / (17.625 - log(RH / 100) - ((17.625 * Temp)/(243.04 + Temp)))) * (1.8)) + 32;
  }
  else if (CorF == "C") {
    return 243.04 * (log(RH / 100) + ((17.625 * Temp) / (243.04 + Temp))) / (17.625 - log(RH / 100) - ((17.625 * Temp)/(243.04 + Temp)));
  }
}

//returns the number of seconds past dawn that thermal peak occurs. Necessary for getting cycle length in baseD.
long getTPeak(time_t LStart, time_t LEnd, int TPeakDelay) {
  return(difftime((halfTime(LEnd, LStart) + (TPeakDelay * 60)), LStart));
}

//returns number of days between hottest and coldest day of the year for whenever currentTime is relative to those days.
//Creates a reasonable facsimile of seasonal lag without diving into complex calculations of solar irradiance.
int getDOYRange(int xmin, int xmax, time_t currentTimex) {
  int currentTime = (DayofYear(getDay(currentTimex), getMonth(currentTimex), getYear(currentTimex)));
  if (xmin < xmax)  {
    if ((xmin <= currentTime) && (currentTime < xmax)) {
      return (xmax - xmin) * 2;
    }
    else  {
      return ((xmin - xmax) + 365) * 2;
    }
  }
  else if (xmax < xmin)  {
    if ((xmax <= currentTime) && (currentTime < xmin)) {
      return (xmin - xmax) * 2;
    }
    else  {
      return ((xmax - xmin) + 365) * 2;
    }
  }
}

time_t calcSun(time_t currentTime, float tLat, float tLon, int tTZ, float oLat, float oLon, int oTZ, time_t startDTTar, time_t startDTOrig, int SLength, String RiseOrSet) {

  //Total time from season start and position within the seasonal loop, respectively//
  int ODiff = (difftime(currentTime, startDTOrig) / 86400L);
  int SPosition = ODiff % SLength;

  //sets adjusted sunrise and sunset values based on Target and Origin astronomical calculations
  time_t LStart = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, startDTTar, startDTOrig, SPosition, ODiff, "Rise", 0);
  time_t LEnd = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, startDTTar, startDTOrig, SPosition, ODiff, "Set", 0);

  /////////////////Contextually adjusts sunrise and sunset and regressive values, sets TPeak accordingly/////////////////
  if (LStart > LEnd)  {
    if (currentTime >= LStart) {
      LEnd = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, startDTTar, startDTOrig, SPosition, ODiff, "Set", 1);
    }
    else if (currentTime < LEnd) {
      LStart = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, startDTTar, startDTOrig, SPosition, ODiff, "Rise", -1);
    }
  }
  else if (LEnd > LStart)  {
    if (currentTime < LStart) {
      LEnd = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, startDTTar, startDTOrig, SPosition, ODiff, "Set", -1);
    }
    else if (currentTime >= LEnd) {
      LStart = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, startDTTar, startDTOrig, SPosition, ODiff, "Rise", 1);

    }
  }

  if (RiseOrSet == "Rise") {
    return LStart;
  }
  else if (RiseOrSet == "Set")  {
    return LEnd;
  }
}

time_t getSun(time_t currentTime, struct SetTarget_Origin Tar, struct SetTarget_Origin Orig, String RiseOrSet)  {
  return calcSun(currentTime, Tar.Lat, Tar.Lon, Tar.TZ, Orig.Lat, Orig.Lon, Orig.TZ, Tar.StartDT, Orig.StartDT, Tar.SLength, RiseOrSet);
}

float calcTDP (time_t currentTime, float tLat, float tLon, int tTZ, float oLat, float oLon, int oTZ, time_t StartDT, time_t StartDTO, int SLength, time_t xminL, time_t xmaxL, float TDPminlow, float TDPminhigh, float TDPmaxlow, float TDPmaxhigh, int TPeakDelay) {

  int xmin = DayofYear(getDay(xminL), getMonth(xminL), getYear(xminL));
  int xmax = DayofYear(getDay(xmaxL), getMonth(xmaxL), getYear(xmaxL));

  //Total time from season start and position within the seasonal loop, respectively//
  int ODiff = (difftime(currentTime, StartDTO) / 86400L);
  int SPosition = ODiff % SLength;

  //sets adjusted sunrise and sunset values based on Target and Origin astronomical calculations
  time_t LStart = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Rise", 0);
  time_t LEnd = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Set", 0);
  //Sets regressive sunrise and sunset values
  time_t LStartN = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Rise", -1);
  time_t LEndN = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Set", -1);

  //Defines the thermal peak of a day's cycle based on start and end times; "TPeakDelay" is set to 150 minutes after solar noon by default on the front end in getTDP function; feel free to play with that based on local conditions
  long TPeak = getTPeak(LStart, LEnd, TPeakDelay);

  /////////////////Contextually adjusts sunrise and sunset and regressive values, sets TPeak accordingly/////////////////
  if (LStart > LEnd)  {
    if (currentTime >= LStart) {
      LEndN = LEnd;
      LEnd = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Set", 1);
      TPeak = getTPeak(LStart, LEnd, TPeakDelay);
    }
    else if (currentTime < LEnd) {
      LStart = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Rise", -1);
      LEndN = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Set", -1);
      TPeak = getTPeak(LStart, LEnd, TPeakDelay);
    }
  }
  else if (LEnd > LStart)  {
    if (currentTime < LStart) {
      LEnd = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Set", -1);
      TPeak = getTPeak((getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Rise", -1)), LEnd, TPeakDelay);
    }
    else if (currentTime >= LEnd) {
      LStartN = LStart;
      LStart = getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Rise", 1);
      LEndN = LEnd;
      TPeak = getTPeak((getRiseSet(tLat, tLon, tTZ, oLat, oLon, oTZ, StartDT, StartDTO, SPosition, ODiff, "Rise", 0)), LEnd, TPeakDelay);
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  //Daytime logic. If this is true, the sun is up.
  if (LStart <= currentTime && currentTime < LEnd) {
    int SPositionx = SPosition - 1;

    if ((getDay(LStart) != getDay(LEnd)) && (getDay(currentTime) == getDay(LEnd))) {
      SPosition = SPositionx;
    }
   //Gets regressive projected values for temperature and dewpoint using baseN at dawn. Necessary for everything up to TPeak.
    float baseNMinusTDP = baseN(TDPminlow, TDPmaxlow, TDPminhigh, TDPmaxhigh, LStart, LStart, LEndN, StartDT, SPosition, TPeak, xmin, xmax, LStartN, -1);
    return baseD(TDPminlow, TDPmaxlow, TDPminhigh, TDPmaxhigh, currentTime, LStart, LEnd, StartDT, SPosition, TPeak, xmin, xmax, baseNMinusTDP, 0);
    }

  //nighttime logic. If this is true, the sun isn't up. No defining regressive values necessary here; built into baseN.
  else {
    return baseN(TDPminlow, TDPmaxlow, TDPminhigh, TDPmaxhigh, currentTime, LStart, LEnd, StartDT, SPosition, TPeak, xmin, xmax, LStartN, 0);
  }
}

float getTDP (time_t currentTime, struct SetTarget_Origin Tar, struct SetTarget_Origin Orig, struct SetRangeTDP Range, int TPeakDelay) {
  return calcTDP(currentTime, Tar.Lat, Tar.Lon, Tar.TZ, Orig.Lat, Orig.Lon, Orig.TZ, Tar.StartDT, Orig.StartDT, Tar.SLength, Range.xminL, Range.xmaxL, Range.minlow, Range.minhigh, Range.maxlow, Range.maxhigh, TPeakDelay);
}

//Convert Dewpoint and Temperature to Relative Humidity. Necessary for sensor readings. Requires Temperature, Dewpoint, and system of measurement.
float getRH(float Tempx, float DPx, String CorF) {
  float Temp = Tempx;
  float DP = DPx;
  if (CorF == "F") {
    Temp = (Tempx - 32) / 1.8;
    DP = (DPx - 32) / 1.8;
  }
  return 100 * (exp((17.625 * DP)/(243.04 + DP)) / exp((17.625 * Temp)/(243.04 + Temp)));
}


text:
name=Norman
version=1.0.0
author=934Virginia <934Virginia@gmail.com>
maintainer=934Virginia <934Virginia@gmail.com>
sentence=Mathematically simulate natural cycles of daylight, temperature, and humidity for remote locations using minimal data sets.
paragraph=Given target coordinates, specified date ranges, and minimum/maximum values for temperature and humidity at target's annual extremes, generate time_t values for sunrise and sunset, and floating point numbers for temperature, dew point, and relative humidity. Requires Dusk2Dawn library by DM Kishi; an adapted C++ port of NOAA's Solar Calculator.
category=Other
url=https://github.com/934virginia/Norman
architectures=*
includes=Dusk2Dawn.h,time.h
depends=Dusk2Dawn


text:
//Bangor//
struct SetTarget_Origin Target = {44.8016, -68.7712, -5, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {44.8016, -68.7712, -5, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 29, 0, 0, 0), getTime(2010, 7, 27, 0, 0, 0), 13.0, 25.8, 60.9, 78.0};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 29, 0, 0, 0), getTime(2010, 7, 27, 0, 0, 0), 6.6, 11.8, 57.7, 60.0};

//Denver//
struct SetTarget_Origin Target = {39.7392, -104.9903, -7, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {39.7392, -104.9903, -7, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 12, 30, 0, 0, 0), getTime(2010, 7, 10, 0, 0, 0), 24.8, 39.0, 60.8, 85.1};
struct SetRangeTDP DewPoint = {getTime(2010, 12, 30, 0, 0, 0), getTime(2010, 7, 10, 0, 0, 0), 12.9, 16.7, 42.2, 48.6};

//Fairbanks//
struct SetTarget_Origin Target = {64.8378, -147.7164, -9, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {64.8378, -147.7164, -9, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 18, 0, 0, 0), getTime(2010, 7, 3, 0, 0, 0), -5.9, -2.8, 55.2, 71.7};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 18, 0, 0, 0), getTime(2010, 7, 3, 0, 0, 0), -7.4, -6.4, 47.1, 50.0};

//Helena//
struct SetTarget_Origin Target = {46.5891, -112.0391, -7, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {46.5891, -112.0391, -7, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 1, 0, 0, 0), getTime(2010, 7, 27, 0, 0, 0), 15.6, 25.7, 57.2, 84.1};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 1, 0, 0, 0), getTime(2010, 7, 27, 0, 0, 0), 9.2, 14.0, 42.9, 46.8};

//Homer//
struct SetTarget_Origin Target = {59.6425, -151.5483, -9, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {59.6425, -151.5483, -9, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 17, 0, 0, 0), getTime(2010, 7, 30, 0, 0, 0), 25.2, 28.9, 50.6, 59.3};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 17, 0, 0, 0), getTime(2010, 7, 30, 0, 0, 0), 19.9, 22.2, 47.8, 50.3};

//Lincoln//
struct SetTarget_Origin Target = {40.8136, -96.7026, -6, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {40.8136, -96.7026, -6, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 13, 0, 0, 0), getTime(2010, 7, 20, 0, 0, 0), 18.6, 32.4, 68.4, 87.7};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 13, 0, 0, 0), getTime(2010, 7, 20, 0, 0, 0), 13.2, 17.4, 63.6, 66.2};

//Miami//
struct SetTarget_Origin Target = {25.7617, -80.1918, -5, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {25.7617, -80.1918, -5, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 17, 0, 0, 0), getTime(2010, 8, 9, 0, 0, 0), 61.6, 73.7, 79.4, 88.3};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 17, 0, 0, 0), getTime(2010, 8, 9, 0, 0, 0), 56.1, 57.6, 73.4, 75.1};

//Richmond//
struct SetTarget_Origin Target = {37.5407, -77.4360, -5, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {37.5407, -77.4360, -5, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 29, 0, 0, 0), getTime(2010, 7, 21, 0, 0, 0), 31.8, 46.1, 71.1, 87.5};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 29, 0, 0, 0), getTime(2010, 7, 21, 0, 0, 0), 25.0, 26.6, 67.9, 69.5};

//San Diego//
struct SetTarget_Origin Target = {32.7157, -117.1611, -8, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {32.7157, -117.1611, -8, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 12, 28, 0, 0, 0), getTime(2010, 8, 26, 0, 0, 0), 49.9, 63.2, 67.8, 75.9};
struct SetRangeTDP DewPoint = {getTime(2010, 12, 28, 0, 0, 0), getTime(2010, 8, 26, 0, 0, 0), 39.6, 46.5, 62.5, 63.5};

//Seattle//
struct SetTarget_Origin Target = {47.6062, -122.3321, -8, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {47.6062, -122.3321, -8, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 12, 23, 0, 0, 0), getTime(2010, 8, 1, 0, 0, 0), 37.5, 42.4, 57.3, 75.6};
struct SetRangeTDP DewPoint = {getTime(2010, 12, 23, 0, 0, 0), getTime(2010, 8, 1, 0, 0, 0), 32.8, 34.7, 52.9, 54.1};

//Shreveport//
struct SetTarget_Origin Target = {32.5252, -93.7502, -6, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {32.5252, -93.7502, -6, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 8, 0, 0, 0), getTime(2010, 8, 12, 0, 0, 0), 39.9, 54.8, 73.8, 91.7};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 8, 0, 0, 0), getTime(2010, 8, 12, 0, 0, 0), 34.9, 36.6, 69.2, 72.0};

//Tucson
struct SetTarget_Origin Target = {32.2226, -110.9747, -7, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetTarget_Origin Origin = {32.2226, -110.9747, -7, getTime(2010, 1, 1, 0, 0, 0), 365};
struct SetRangeTDP Temperature = {getTime(2010, 1, 4, 0, 0, 0), getTime(2010, 6, 29, 0, 0, 0), 42.1, 64.2, 75.1, 100.9};
struct SetRangeTDP DewPoint = {getTime(2010, 1, 4, 0, 0, 0), getTime(2010, 6, 29, 0, 0, 0), 28.9, 31.5, 42.1, 47.3};


text:
# Norman

Arduino Library for mathematical climatic simulation of natural daylight, temperature, and humidity cycles using minimal data sets.

Given target coordinates, specified date ranges, and minimum/maximum values for temperature and humidity at target's annual extremes, generate time_t values for sunrise and sunset, and floating point numbers for temperature, dew point, and relative humidity. Requires [Dusk2Dawn library by DM Kishi](https://github.com/dmkishi/Dusk2Dawn); an adapted C++ port of the [NOAA Solar Calculator](https://www.esrl.noaa.gov/gmd/grad/solcalc/).

## Licensing Disclaimer
Raw climatic data used in this project, as well as original Solar Calculator software provided by NOAA ESRL Global Monitoring Division, Boulder, Colorado, USA (http://esrl.noaa.gov/gmd/)

All dependencies referenced in this repository are the properties of their respective authors, and are exempt from the the terms of this project's governing intellectual property license (the terms of which can be found in the "LICENSE" file located under the master branch of this repository) unless otherwise stated in the terms of the respective licenses and copyright statutes governing the use and distribution of said dependencies.

## Installation

### From the Library Manager
1.  Launch the Arduino IDE and navigate to Sketch → Include Library → Manage Libraries.
2.  In the library manager, scroll to Norman or enter the name into the search field.
3.  Click on the library, then click on the Install button.

### From the ZIP file
1. Download the [ZIP file](https://github.com/934Virginia/Norman/archive/master.zip).
2. Launch the Arduino IDE and navigate to *Sketch → Include Library → Add .ZIP Library...*. From the prompt, select the ZIP just downloaded.

## Usage
Included example scripts can be utilized to either project formatted data, or control climatic conditions using RTCLib, Adafruit_Sensor, DHT, and DHT_U libraries created by Adafruit.
Example datasets for various US cities included in parameters.txt file. Just copy-paste them into the Example_Test script to get annual data.

## FAQ
### What is this?

This is Norman. Norman is a climatic simulation library that mathematically projects natural cycles of daylight, temperature, and humidity for remote locations (and periods of time) using minimal data sets. It was designed to handle climate control for indoor/greenhouse agriculture and botany applications when paired with an RTC module. It was built in the Arduino IDE and tested on an ATmega328P. It was named for Norman Borlaug; agronomist of legend and friend to all who enjoy not starving to death.

### How does it work?
#### Daylight
Norman makes extensive use of the Dusk2Dawn library, by DM Kishi. It relies on Dusk2Dawn to retrieve daily times for sunrise and sunset based on latitude, longitude, and timezone of the target location. Optionally, it anchors these daily light cycles to solar noon of local daylight schedules. This enables users utilizing a greenhouse to incorporate photoresistors and PWM driver control for the purposes of energy-efficient supplemental lighting if so desired.

#### Temperature and Humidity
Yearly temperature and dew point trends can be loosely expressed by a sine wave in most climates. This means we can project daily minima and maxima as long as we have minimum and maximum values for the hottest and coldest days of the year, as well as the indexed locations of these days for the target location. Seasonal lag was loosely accounted for by modifying the width of this sine wave based on the number of days between the hottest and coldest days of the year (relative to the current time). Daily patterns for temperature and dew point were more complicated. I used a polynomial function for daytime shifts, an exponential function for nightly decay, and a regressive anchoring system in order to create smooth transitions between day and night cycles while continuing to follow the annual sine wave. Relative humidity is retrieved using these temperature and dew point projections. This enables users to incorporate these projected values into climate control applications using popular temperature and humidity sensors (DHT11, DHT22, BMP280, etc.).

### Does it only calculate values for the current day?
No. It can be programmed to mimic conditions for any time of the year, from any time of the year. Optionally, users can designate the length and starting point of a "season," and repeat the projected conditions of this time period over and over again without having to re-flash the sketch. This method retains the (optional) functionality of anchoring target daylight cycles to local cycles happening in real time.

### How accurate is it?
That's a complicated question. You can see for yourself at [my plot.ly page](https://plot.ly/~934Virginia). I tested a dozen US cities to see how my projections would stack up, and I think it did alright, considering how crude it is. Seems to do a lot better in coastal and continental climates than mountains and deserts. I've got some ideas of how to improve its consistency, but addressing those issues would necessitate the time and labor of people who actually know what they're doing. As it is, I'm ready to move on to other projects, so we're calling it as done as done gets.

### Why are you writing all this?
Because I hope that my dumb little project will inflame the curiosity of smart people. I want other people to do this better, because I think a comprehensive mathematical model that can accurately simulate remote climatic conditions might have some exciting implications for agricultural development and botany. If you are interested in taking a swing at it, contact me. I can put you onto some questions and observations that might help you get started. Probably the first order of business would be whipping up some sunrise and sunset functions that build and fade naturally based on solar elevation and azimuth. It would also be rad if someone sent me a picture of them growing passion fruit in Siberia using my garbage code and a $10 microcontroller.

## Known Bugs
(Under construction!)

## History
- **2019-7-8**: Released.


text:
SetTarget_Origin	KEYWORD1
SetRangeTDP	KEYWORD1
getTime	KEYWORD2
DSTCheck	KEYWORD2
RHtoDP	KEYWORD2
getSun	KEYWORD2
getTDP	KEYWORD2
getRH	KEYWORD2
getYear	KEYWORD2
getMonth	KEYWORD2
getDay	KEYWORD2
getHour	KEYWORD2
getMinute	KEYWORD2
getSecond	KEYWORD2
cosTDP	KEYWORD2
polyTDP	KEYWORD2
DayofYear	KEYWORD2
halfTime	KEYWORD2
getRiseSet	KEYWORD2
baseD	KEYWORD2
baseN	KEYWORD2
getTPeak	KEYWORD2
getDOYRange	KEYWORD2
calcSun	KEYWORD2
calcTDP	KEYWORD2


text:
// All included libraries and related code snippets extracted and modified from example sketches included in said libraries are the property of their respective authors.
//getStartDTO and LTime functions created by 934Virginia, 2019-07-08, and released into the public domain.

#include <time.h>
#include "RTClib.h"
#include <Dusk2Dawn.h>
#include "Norman.h"
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define DHTPIN            2         // Pin which is connected to the DHT sensor.

// Uncomment the type of sensor in use:
//#define DHTTYPE           DHT11     // DHT 11
#define DHTTYPE           DHT22     // DHT 22 (AM2302)
//#define DHTTYPE           DHT21     // DHT 21 (AM2301)

DHT_Unified dht(DHTPIN, DHTTYPE);

//Type of RTC being used. I highly recommend the DS3231 for long-term accuracy.
RTC_DS3231 rtc;

//Define pins responsible for controlling specific relays. Can define rf codes similarly if going that route.//
int Lights = 7;

int TempPlus = 8;
int TempMinus = 9;
int RHPlus = 10;
int RHMinus = 11;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Declare how close to keep real-world climate conditions collected by the sensor to our mathematically projected values
//(Target range = projected value +- this integer.)
//The smaller the integer, the more precisely your devices will attempt to control your environment.
int Precision = 2;

//Conversion to make RTC DT values play nice with our calculations
time_t LTime(DateTime x)  {
  int yearx = x.year();
  byte monthx = x.month();
  byte dayx = x.day();
  byte hourx = x.hour();
  byte minutex = x.minute();
  byte secondx = x.second();

  struct tm tmSet;
  tmSet.tm_year = yearx - 1900;
  tmSet.tm_mon = monthx - 1;
  tmSet.tm_mday = dayx;
  tmSet.tm_hour = hourx;
  tmSet.tm_min = minutex;
  tmSet.tm_sec = secondx;
  return mk_gmtime(&tmSet) + UNIX_OFFSET;
}

void digitalClockLog(time_t Xtime) {
  // digital clock display of the time
  logDigits(getYear(Xtime));
  Serial.print('-');
  logDigits(getMonth(Xtime));
  Serial.print('-');
  logDigits(getDay(Xtime));
  Serial.print("T");
  logDigits(getHour(Xtime));
  Serial.print(':');
  logDigits(getMinute(Xtime));
  Serial.print(':');
  logDigits(getSecond(Xtime));
}

void logDigits(int digits) {
  // utility function for digital clock display: prints preceding colon and leading 0
  if (digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

//Sets the start date of the first "season" to the date we flashed the sketch, and adjusts for DST.
//If you flash between midnight and 1am during DST, expect the season to start the day before.
time_t getStartDTO()  {
  if (DSTCheck(LTime(DateTime(F(__DATE__), F(__TIME__)))) == true) {
    time_t StartDTOadj = LTime(DateTime(F(__DATE__), F(__TIME__)) - TimeSpan(0, 1, 0, 0));
    return getTime(getYear(StartDTOadj), getMonth(StartDTOadj), getDay(StartDTOadj), 0, 0, 0);
  }
  else  {
    time_t StartDTOx = LTime(DateTime(F(__DATE__), F(__TIME__)));
    return getTime(getYear(StartDTOx), getMonth(StartDTOx), getDay(StartDTOx), 0, 0, 0);
  }
}
time_t StartDTO = getStartDTO();

////////////////////////////////////STRUCT INPUT////////////////////////////////////////////////////////////////
//SetTarget_Origin Structure = (Latitude, Longitude, Timezone(standard time), Season Start, Season Length).
//Season Length is unused for Origin parameters.

//SetRangeTDP Structure = (coldest day of year, hottest day of year, Minimum value on coldest day, Maximum value on coldest day, Minimum value on hottest day, Maximum value on hottest day).
//if you can't find minimum and maximum Dew Point values for your location on the hottest and coldest days of the year,
//you'll need to use the RHtoDP(Temp, RH, "F") function for the temperature and RH data at those points in time.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//!Origin Season Start MUST be changed from copied parameter value to StartDTO in order to sync with RTC!

//Changing Origin Lat, Lon, and TZ values to your own local values will center projected sunrise and sunset times on your own solar noon.
//Use this to tinker with supplemental lighting setups, or skip entering your local values altogether.

//////////////////////////////////////////////////////

//San Diego//
struct SetTarget_Origin Target = {32.7157, -117.1611, -8, getTime(2019, 4, 15, 0, 0, 0), 90};
struct SetTarget_Origin Origin = {32.7157, -117.1611, -8, StartDTO, 365};
struct SetRangeTDP Temperature = {getTime(2010, 12, 28, 0, 0, 0), getTime(2010, 8, 26, 0, 0, 0), 49.9, 63.2, 67.8, 75.9};
struct SetRangeTDP DewPoint = {getTime(2010, 12, 28, 0, 0, 0), getTime(2010, 8, 26, 0, 0, 0), 39.6, 46.5, 62.5, 63.5};

//////////////////////////////////////////////////////

time_t currentTime;

void setup() {
  Serial.begin(9600);
  Serial.println("--------------------------------------------------");

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (rtc.lostPower()) {
    Serial.println("RTC lost power, lets set the time!");
    //The following sets the RTC to the date & time this sketch was compiled; runs a check to see if it was flashed during DST, and adjusts it to standard time if necessary.
    //If you live somewhere like Arizona or in a country with unique DST rules, you'll need to tinker with this, along with getStartDTO function.
    DateTime rtcDT;
    if (DSTCheck(LTime(DateTime(F(__DATE__), F(__TIME__)))) == true) {
      rtcDT = DateTime(F(__DATE__), F(__TIME__)) - TimeSpan(0, 1, 0, 0);
    }
    rtc.adjust(rtcDT);
  }

  // Initialize sensor.
  dht.begin();
  sensor_t sensor;
  dht.temperature().getSensor(&sensor);

  //Ready up your relay output pins.
  pinMode(Lights, OUTPUT);
  pinMode(TempPlus, OUTPUT);
  pinMode(TempMinus, OUTPUT);
  pinMode(RHPlus, OUTPUT);
  pinMode(RHMinus, OUTPUT);

}

void loop() {

  currentTime = LTime(rtc.now());

  sensors_event_t event;
  dht.temperature().getEvent(&event);

  float TempReal = (float(event.temperature) * 1.8 + 32);
  //Use this instead if measuring in Celsius.
  //int TempReal = int(event.temperature);

  dht.humidity().getEvent(&event);
  float RHReal = float(event.relative_humidity);

  time_t projRise = getSun(currentTime, Target, Origin, "Rise");
  time_t projSet = getSun(currentTime, Target, Origin, "Set");

  Serial.print("Current Time: ");
  digitalClockLog(currentTime);
  Serial.println();

  Serial.print("Sunrise: ");
  digitalClockLog(projRise);
  Serial.println();
  Serial.print("Sunset: ");
  digitalClockLog(projSet);
  Serial.println();

  if (currentTime >= projRise && currentTime < projSet) {
    Serial.println("Lights ON");
    digitalWrite(Lights, HIGH);
  }
  else {
    Serial.println("Lights OFF");
    digitalWrite(Lights, LOW);
  }

  //Structure is Current Time, Target location values (SetTarget_Origin), Origin location values (SetTarget_Origin), Numerical parameters (SetRangeTDP), Daily thermal peak (hottest time of the day, expressed in minutes after solar noon).
  //Thermal peak is a really weird piece of this project. 150 will work fine for most projections, but I built in explicit front-end access so that people can fiddle with it and plug in a proper algorithm.
  //TL;DR: Leave it at 150 unless you're a solar physicist.
  float TempProj = getTDP(currentTime, Target, Origin, Temperature, 150);
  float DPProj = getTDP(currentTime, Target, Origin, DewPoint, 150);
  float RHProj = getRH(TempProj, DPProj, "F");
  //float RHProj = getRH(TempProj, DPProj, "C");

  Serial.print("Actual temperature): ");
  Serial.print(TempReal);
  Serial.println(" F");
  //Serial.println(" C");

  Serial.print("Projected temperature: ");
  Serial.print(TempProj);
  Serial.println(" F");
  //Serial.println(" C");

  if (TempReal > (TempProj + Precision))
  {
    digitalWrite(TempMinus, HIGH);
    digitalWrite(TempPlus, LOW);
    Serial.println("High temperature! Cooling environment.");
  }
  else if (TempReal < (TempProj - Precision))
  {
    digitalWrite(TempPlus, HIGH);
    digitalWrite(TempMinus, LOW);
    Serial.println("Low temperature! Heating environment.");
  }

  Serial.print("Actual RH: ");
  Serial.print(RHReal);
  Serial.println("%");

  Serial.print("Projected RH: ");
  Serial.print(RHProj);
  Serial.println("%");

  if (RHReal > (RHProj + Precision))
  {
    digitalWrite(RHMinus, HIGH);
    digitalWrite(RHPlus, LOW);
    Serial.println("High humidity! Dehumidifying environment.");
  }
  else if (RHReal < (RHProj - Precision))
  {
    digitalWrite(RHPlus, HIGH);
    digitalWrite(RHMinus, LOW);
    Serial.println("Low humidity! Humidifying environment.");
  }
  Serial.println("--------------------------------------------------");

  //Adjust this delay to control frequency of readings and control operations.
  //Another option is to use TimeAlarms, but that gets fiddly with avr time functions.
  delay(10000);
}