• Stars
    star
    1,281
  • Rank 36,746 (Top 0.8 %)
  • Language
    C#
  • License
    Other
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Samples designed as exercises to be ported from Unity GameObjects/MonoBehaviours to Unity DOTS.

Under the 'Originals' directory, you'll find small simulations/games implemented in classic (non-DOTS) Unity. Your task is to implement one of these samples in DOTS.

  1. Clone this repository.
  2. Make a new branch for your sample port.
  3. Create a new Unity Project and place it under the 'Ported' directory, e.g /Ported/AutoFarmers/
  4. Configure the project for DOTS.

Feel free to copy assets and code snippets from the originals into your ports. The focus of this exercise is to familiarize yourself with the DOTS API and to practice Data-oriented Design principles!

Sample Gallery

Expand the arrows for more details about each sample.

Ant Pheromones: Ants look for food and spread pheromones to influence the pathing of other ants.
Click here for details
  • Ants bring food from the source (green spot) to the destination (red spot).
  • Each ant spawns at the center point with a random heading.
  • Ants bounce off of walls at the inverse angle.
  • Ants will steer towards the food source (green dot) if they have line of sight.
  • Ants leave pheromone in the spots they walk over.
  • Ant steering is affected by pheromones, goal location (food or nest), obstacle avoidance and obstacle "bounce".
  • Pheromone at a spot decays over time.
  • Ant steering is also slightly randomized, so ants donโ€™t walk in straight lines.
  • The gaps in the ring walls randomly vary in size and placement.
  • Keyboard controls allow the user to slow down, speed up, and reset the simulation.
  • The amount of pheromone an ant drops depends on the speed of the ant, and the speed depends on steering.

Ant Pheromones


Auto Farmers: Farmers gather and sell resources to expand their farm.
Click here for details
  • On start, a single farmer (the green cylinders) spawns.
  • Farmers walk around to destroy rocks (the grey cylinders) to make way for tilling the soil (creating brown-striped crop cells).
  • A plant grows in each crop cell. (The color and mesh of plant randomly varies.)
  • When fully grown, a plant is ready for harvest by a farmer. Farmers deposit plants in the nearest silo (grey-blue cylinder).
  • When enough resources have been collected into a silo, a new farmer spawns from the silo.
  • Farmers look for their next task in a limited radius. If no task is found, they look in an increasingly larger radius until a task is found.
  • For every fifth farmer spawned, a drone is spawned instead.
  • Drones fly and harvest plants. They do not destroy rocks or plant crops.
  • After depositing, drones hover over the silo until they locate a plant to harvest.
  • Keyboard controls allow the user to reset the simulation.

Auto Farmers


Bucket Brigade: Firefighters pass buckets along a chain to extinguish a fire.
Click here for details
  • Each cell of the grid has a temperature from 0.0 to 1.0. Cells above 0.2 are on fire and transmit heat to their neighbors. The color and height of a fire cell reflects its temperature. (For visual effect, a fire cell's height randomly oscillates a small amount, but this does not reflect its actual temperature.)
  • On start, a few random cells are on fire. Buckets are randomly placed around the field.
  • Workers are grouped into teams. Each team picks the closest cell on fire and forms two lines from the fire to the nearest water (blue cells outside the field). One line passes full buckets; the other passes empty buckets.
  • Each team has a bucket fetcher, who retrieves the nearest bucket, walks it to the water at the end of the line, fills the bucket, and then drops it.
  • Workers in the 'pass full' line look for full buckets on the ground within a small radius. When found, they walk over, pick up the bucket, carry it to the next worker up the line, and drop it. The last worker in the 'pass full' line empties the bucket on the fire (lowering the temperature of that cell and its eight surrounding cells to zero). Workers move slower while carrying a full bucket.
  • Workers in the 'pass empty' line behave the same but only carry empty buckets.
  • Every frame, a team will reposition its line to the fire cell closest to its current water source.
  • When a team's water source is exhausted, it repositions the line to the next closest water.
  • When repositioning, a worker will not resume its normal behavior until it has reached its new position.
  • In the moment between a worker placing a bucket on the ground and the next picking it up, the line might reposition, in which case the bucket will be left on the ground.
  • OPTIONAL: A small configured number of 'omniworkers' (black) are not part of any team. An omniworker picks up the nearest bucket, fills it at the nearest water source, and dumps it on the nearest fire.
  • Keyboard controls allow the user to reset the simulation.

Bucket Brigade


Combat Bees: Two bee hives battle for resources and survival.
Click here for details
  • Resources (green discs) spawn in the middle. Yellow bees spawn in the yellow base. Blue bees spawn in the blue base.
  • Resources spawned at the same location will stack on top of each other.
  • Bees pick up resources and drop them in their base.
  • When a resource hits the ground of a base, it explodes, spawning several bees of that base's color.
  • Bees not carrying resources may attack and destroy enemy bees.
  • A destroyed bee emits bee fragments and blood splatters, and the resource eventually carried falls to the ground.
  • Blood splatters on surfaces shrink to nothing over time.
  • Each bee's displayed scale oscillates along all three axes, but this is just a visual effect. Collisions are not affected.
  • Keyboard controls allow the user to reset the simulation.
  • Left mouse clicks spawn additional resources at the point clicked (determined by casting a ray from the cursor).
  • The camera can be controlled with the mouse (hold down right button to rotate, use mouse wheel to zoom).

Combat Bees


Highway Racers: Simulate traffic on a 4-lane highway.
Click here for details
  • Each car has a random cruising speed, a random overtake speed, a random overtake distance, and a random overtake time (each within a fixed min/max range).
  • When traveling at its cruising speed, a car is grey. When going below its cruising speed, it turns red. While going above its cruising speed, it turns green.
  • Cars have three main states: cruising, looking to change lane, and overtaking.
  • While cruising, a car accelerates/brakes to its cruising speed; if it comes up behind a slower car within its overtake distance, it enters the 'looking to change lane' state.
  • A looking-to-change car will look for sufficient open space to its left or right to change lanes. While blocked from changing lanes, the car will tail the car ahead of it. When it is clear to change lane, it will enter the overtake state.
  • In the overtake state, a car first moves into another lane, then accelerates to its overtake speed. Once the car's overtake time elapses, it looks to move back into the lane it came from. If blocked from moving back, the car gives up and goes back to the cruising state. If at any time the car is impeded by a slower moving car within its overtake distance, it goes back to the cruising state.
  • Keyboard controls allow the user to reset the simulation.

Highway Racers


LabRat: Place arrows on the board to route the most mice into your home base.
Click here for details
  • Mice spawn at frequent, randomized intervals from locations randomly chosen at startup.
  • The board has holes at random locations, both mice and cats can fall into those holes and despawn when that happens.
  • At start of play, walls are randomly placed between grid cells.
  • Cats and mice travel on the grid, changing direction when they hit a wall or travel over an arrow.
  • Cats spawn in random squares. When a cat and mouse intersect, the mouse is eaten.
  • When a mouse hits a player's 'home base' (one of the four dots placed near the center of the grid), the mouse disappears, and the player is awarded a point.
  • Similarly, when a cat hits a player's 'home base', the cat disappears, and the player gets negative points.
  • Players can place arrows in cells of the board. The green player places green arrows, the red player places red arrows, etc. A player cannot place their arrows in a cell occupied by an arrow of another player.
  • Once a player has three arrows on the board, their next placed arrow removes their oldest arrow on the board.
  • Only one player is human. The AI players just place their arrows randomly at random intervals.
  • At the end of 30 seconds, the player with the most points wins.
  • Keyboard controls allow the user to reset the simulation.
  • Walls can be added at runtime by left clicking while holding the shift key down.

Lab Rat


Stack Interchange: Cars drive through a stack interchange.
Click here for details
  • At random intervals, cars spawn at the edge of the straight roads. Cars despawn when they run off the edge of the straight roads.
  • Cars merging onto a new road should yield for cars on the road.
  • Each road has two lanes. Cars in both lanes of a road travel in the same direction.
  • Cars stay in their lanes through their whole trip, e.g. a car in the left lane will travel in the left lane on all roads.
  • Each car has a color matching one of the roadways. A car's path through the interchange must include the roadway maching its color.
  • Some roadways arch upwards to pass over other roads.
  • The simulation has multiple interchanges, but each is unconnected and independent from the others. Cars of one interchange do not travel to the other interchanges.
  • Keyboard controls allow the user to reset the simulation.

Stack Interchange


Thrower Arms: Mechanical arms throw rocks at tin cans.
Click here for details
  • The arms and hands are animated by inverse kinematics.
  • The cans scroll in from the sides and wrap around.
  • Rocks scroll in from the side and get destroyed once they reach the end. Additional rocks spawn along the path to ensure all arms have sufficient rocks.
  • Two arms should never reach for the same ball.
  • An arm does not collide with rocks or with other arms. The fingers wrap around a rock but do not actually grip the rock. The rock is temporarily attached to the hand.
  • Once an arm has picked up a rock, it targets a can and calculates the required throwing trajectory). (No two arms should ever attempt to pick up the same rock or target the same can.)
  • When struck, a can is affected by gravity and the force of the hit. A single rock can hit multiple cans. Rocks are impacted by their collisions with the cans. Cans do not collide with other cans.
  • Falling rocks and cans despawn when they fall below a certain altitude.
  • Keyboard controls allow the user to reset the simulation.

Thrower Arms


Metro: Metro train transport commuters from station to station.
Click here for details
  • The trains move on a fixed schedule. Passengers should not enter or exit the train if they do not have time to get in position before the train moves.
  • Disembarking passengers randomly pick another train to board.
  • The scene contains a set of authored control points that defines splines for the tracks. Some of these control points also define the placement of stations.
  • Keyboard controls allow the user to reset the simulation.

Metro


Zombie Maze: A circle picks up capsules in a maze infested with zombies.
Click here for details
  • A player (yellow cube) and zombies (green cubes) move along the grid of the board.
  • The interior maze walls are randomly generated at init time.
  • The magenta walls move back and forth at a regular interval.
  • The player wins by picking up all of the capsules.
  • Most zombies path towards a randoly chosen pill. When a zombie reaches its destination pill, it selects another pill target.
  • A fixed number of zombies path towards the player.
  • Keyboard controls allow the user to reset the simulation.

Zombie Maze


Deprecated samples

More Repositories

1

ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
C#
16,946
star
2

UnityCsReference

Unity C# reference source code.
C#
10,410
star
3

EntityComponentSystemSamples

C#
7,135
star
4

FPSSample

A first person multiplayer shooter example project in Unity
C#
4,864
star
5

PostProcessing

Post Processing Stack
C#
3,665
star
6

arfoundation-samples

Example content for Unity projects based on AR Foundation
C#
3,040
star
7

NavMeshComponents

High Level API Components for Runtime NavMesh Building
C#
3,008
star
8

BoatAttack

Demo Project using the Universal RP from Unity3D
C#
2,534
star
9

Graphics

Unity Graphics - Including Scriptable Render Pipeline
C#
2,504
star
10

com.unity.netcode.gameobjects

Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
C#
2,138
star
11

AssetBundles-Browser

Editor tool for viewing and debugging asset bundle contents before and after builds
C#
1,940
star
12

UniversalRenderingExamples

This project contains a collection of Custom Renderer examples. This will be updated as we refine the feature and add more options.
C#
1,923
star
13

com.unity.multiplayer.samples.coop

A small-scale cooperative game sample built on the new, Unity networking framework to teach developers about creating a similar multiplayer game.
C#
1,595
star
14

VolumetricLighting

Lighting effects implemented for the Adam demo: volumetric fog, area lights and tube lights
C#
1,576
star
15

Unity-Robotics-Hub

Central repository for tools, tutorials, resources, and documentation for robotics simulation in Unity.
C#
1,544
star
16

AutoLOD

Automatic LOD generation + scene optimization
C#
1,534
star
17

VisualEffectGraph-Samples

Visual Effect Graph - Samples Project
C#
1,498
star
18

InputSystem

An efficient and versatile input system for Unity.
C#
1,428
star
19

game-programming-patterns-demo

A repo of small demos that assemble some of the well-known design patterns in Unity development to support the ebook "Level up your code with game programming patterns"
C#
1,427
star
20

2d-extras

Fun 2D Stuff that we'd like to share!
C#
1,387
star
21

Animation-Instancing

This technique is designed to instance Characters(SkinnedMeshRender).
C#
1,366
star
22

Unity.Mathematics

The C# math library used in Unity providing vector types and math functions with a shader like syntax
C#
1,354
star
23

multiplayer

Unity multiplayer packages and samples
1,328
star
24

UnityRenderStreaming

Streaming server for Unity
C#
1,306
star
25

Addressables-Sample

Demo project using Addressables package
C#
1,277
star
26

ShaderGraph

Unity ShaderGraph project
C#
1,154
star
27

AssetGraph

Visual Workflow Automation Tool for Unity.
C#
1,088
star
28

XR-Interaction-Toolkit-Examples

This repository contains various examples to use with the XR Interaction Toolkit
C#
1,068
star
29

FontainebleauDemo

Fontainebleau demo
C#
947
star
30

uGUI

Source code for the Unity UI system.
C#
937
star
31

DOTSSample

A third person, multiplayer sample project. Built with Unity and using the new Data Oriented Tech Stack (DOTS).
C#
932
star
32

EditorXR

Author XR in XR
C#
925
star
33

SpaceshipDemo

Spaceship Demo - AAA Playable First person demo showcasing effects made with Visual Effect Graph and rendered with High Definition Render Pipeline
C#
916
star
34

VFXToolbox

Additional tools for Visual Effect Artists
C#
909
star
35

2d-techdemos

Tech Demos for Unity 2D Features
C#
881
star
36

ProjectTinySamples

Samples for Project Tiny
C#
880
star
37

HLODSystem

C#
844
star
38

ProjectAuditor

Project Auditor is an experimental static analysis tool for Unity Projects.
C#
815
star
39

UnityPlayground

A collection of simple scripts to create 2D physics game, intended for giving workshops to a young audience
C#
806
star
40

com.unity.formats.alembic

Alembic importer and exporter plugin for Unity
C#
786
star
41

HLSLcc

DirectX shader bytecode cross compiler
C++
770
star
42

com.unity.webrtc

WebRTC package for Unity
Assembly
753
star
43

giles

GILES: A Runtime Level Editor for Unity3D
C#
743
star
44

com.unity.perception

Perception toolkit for sim2real training and validation in Unity
C#
734
star
45

BackgroundDownload

Plugins for mobile platforms to enable file downloads in background
C#
721
star
46

UniteAustinTechnicalPresentation

C#
721
star
47

com.unity.demoteam.hair

An integrated solution for authoring / importing / simulating / rendering strand-based hair in Unity.
C#
712
star
48

SuperScience

Gems of Unity Labs for our user-base.
C#
711
star
49

com.unity.multiplayer.docs

Open Source documentation for Unity Multiplayer, which includes Netcode for GameObjects, the Unity Transport Package, Multiplayer Tools and Educational references and Sample Games such as Boss Room.
JavaScript
634
star
50

NativeRenderingPlugin

C++ Rendering Plugin example for Unity
C
633
star
51

guid-based-reference

A component for giving Game Objects a GUID and a class to create references to objects in any Scene by GUID
C#
615
star
52

uaal-example

Objective-C++
605
star
53

com.unity.uiwidgets

UIWidgets is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
C#
603
star
54

Standard-Assets-Characters

Unity Standard Asset Controllers
C#
602
star
55

megacity-metro

Megacity-Metro: a thrilling shooter game, using Netcode for Entities for a multiplayer experience supporting 128+ players. Latest DOTS packages and Unity Gaming Services elevate the user experience, demonstrating how to craft engaging multiplayer games.
C#
567
star
56

barracuda-release

C#
565
star
57

MeshApiExamples

Example project for Unity 2020.1 Mesh API improvements
C#
558
star
58

unity-cache-server

Unity CacheServer optimized for multi-client local networks
JavaScript
554
star
59

SimpleAnimation

A simple Animation Component that leverages PlayableGraphs
C#
539
star
60

GenericFrameRecorder

This GitHub package is DEPRECATED. Please get the new Unity Recorder from the Asset Store (https://assetstore.unity.com/packages/essentials/unity-recorder-94079) Use the editor builtin Bug Reporter to report issues. You can track and vote for issues on the Issue Tracker (https://issuetracker.unity3d.com)
C#
533
star
61

obstacle-tower-env

Obstacle Tower Environment
Python
532
star
62

graph-visualizer

Visualizer for your Playable graphs
C#
522
star
63

DeLightingTool

De-Lighting tool
C#
518
star
64

com.unity.demoteam.digital-human

Library of tech features used to realize the digital human from 'The Heretic' and 'Enemies'.
C#
517
star
65

PhysicsExamples2D

Examples of various Unity 2D Physics components and features.
C#
512
star
66

com.unity.cinemachine

Smart camera tools for passionate creators
C#
503
star
67

usd-unity-sdk

Integration of Pixar's Universal Scene Description into Unity. UPDATE: This package has been superseded by our new bundle of USD packages. Please see README & link below for further details.
C#
498
star
68

arfoundation-demos

AR Foundation demo projects
C#
494
star
69

facial-ar-remote

**This project is discontinued** Facial AR Remote is a tool that allows you to capture blendshape animations directly from your iPhone X into Unity 3d by use of an app on your phone.
C#
482
star
70

animation-jobs-samples

Code samples using the animation C# jobs feature.
C#
464
star
71

vscode-unity-debug

Unity debugging support for VS Code
C#
459
star
72

MeshSyncDCCPlugins

DCC plugins for MeshSync in Unity. Supported tools: Maya, Maya LT, 3ds Max, Motion Builder, Modo, Blender, Metasequoia
C++
438
star
73

UIElementsExamples

Unity project containing examples to use UIElements in the Editor
C#
436
star
74

Unity.Animation.Samples

Repository of projects that showcase the new DOTS animation package (com.unity.animation).
C#
419
star
75

com.unity.demoteam.mesh-to-sdf

A light and fast real-time SDF generator, primarily for animated characters. The dynamic SDF can be used for all sorts of VFX. Also enables hair-to-character collisions in the new hair package.
C#
402
star
76

MeasuredMaterialLibraryURP

HLSL
377
star
77

BatchBreakingCause

This project demonstrates different cases when Unity has to break a batch while rendering.
GLSL
355
star
78

MeasuredMaterialLibraryHDRP

C#
355
star
79

UIToolkitUnityRoyaleRuntimeDemo

This is a sample project to introduce the use of UI Toolkit in Runtime
C#
351
star
80

UnityDataTools

Experimental tools and libraries for reading and analyzing Unity data files.
C#
328
star
81

HDRPRayTracingScenes

This repository contains a startup DXR project.
327
star
82

SynthDet

SynthDet - An end-to-end object detection pipeline using synthetic data
C#
324
star
83

EndlessRunnerSampleGame

Repository for the Endless Runner Game Sample (Trash Dash)
C#
324
star
84

boat-attack-water

Package repo containing the water system created for the URP Boat Attack demo project.
C#
318
star
85

BuildReportInspector

Editor script which implements an inspector for the BuildReport class
C#
317
star
86

multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
C#
316
star
87

com.unity.services.samples.use-cases

The collection of samples in this repo use Unity Gaming Services in a Unity project to demonstrate live gaming operations.
C#
312
star
88

com.unity.probuilder

C#
305
star
89

XRLineRenderer

An XR-Focused line renderer that mimics rendering with 3d capsules while only using two quads worth of geometry.
C#
299
star
90

com.unity.demoteam.digital-human.sample

Character sample featuring the digital human from 'The Heretic'.
C#
298
star
91

VRAlchemyLab

VR Demo project using HDRP and unity 2019.3
C#
283
star
92

marathon-envs

A set of high-dimensional continuous control environments for use with Unity ML-Agents Toolkit.
C#
279
star
93

articulations-robot-demo

C#
278
star
94

NotificationsSamples

Sample project for Unity Notifications
C#
265
star
95

SkyboxPanoramicShader

Skybox shader for support of 360/180/cubemap video and static content
ShaderLab
265
star
96

PeopleSansPeople

Unity's privacy-preserving human-centric synthetic data generator
C#
261
star
97

Robotics-Object-Pose-Estimation

A complete end-to-end demonstration in which we collect training data in Unity and use that data to train a deep neural network to predict the pose of a cube. This model is then deployed in a simulated robotic pick-and-place task.
Python
250
star
98

ECS-Network-Racing-Sample

ECS multiplayer racing sample to showcase using Unity Entities and netcode with best practices
C#
248
star
99

2d-pixel-perfect

Pixel Perfect Camera
C#
244
star
100

ShaderGraph-Custom-Lighting

A sample project showcasing a simple method to calculate custom lighting inside of Shader Graph for the Lightweight Render Pipeline. Includes a sample toon shaded scene and example assets. Built for Unity 2019.2 .
Mathematica
244
star