Samples

Samples

To help you get started, we provided a repository of examples for learning how to to write systems at scale.

Sample projects for the Entity Component System and C# Job System

Further sample projects on the C# Job System can be found here

13 Likes

The samples all seem geared towards high performance using DrawInstanced internally, I guess. So when an object is displayed in the scene, it doesn’t exist in the hierarchy view which makes inspecting and reverse engineering to learn how things are done very hard.
So it would be great to include an ECS example or two that still uses GO, transform, prefabs like the old way, just the game logic is ECS, this way we can transition one bit at a time.

8 Likes

Is the Nordeus demo available for download?

@laurentlavigne — i have not looked at it myself but the TwoStickShooter example sounds like what you are looking for (it has a classical / hybrid / pure folder)

@gl33mer - I have not downloaded this, but this could well be it or some version of it TechDemo

@gl33mer Its here
https://github.com/Unity-Technologies/UniteAustinTechnicalPresentation

1 Like

Ty. @sngdan @korzen303

I like the look of this sample, not tried it yet myself:

1 Like

The TwoStickShooter Hybrid scenes are made to do exactly that.

Also check out Windows → EntityDebugger. It is our first step into visualizing pure entities. We still have a lot of work ahead of us but its already a good tool to inspect all your systems & entities in the world.

7 Likes

Where can I download 2018.1b12?

Download the beta build required here

Thanks guys, I found the twinstickshooter.
Questions:

  • The Hybrid is very convoluted. Is it because all the wrappers would be moved to engine?
  • I think Classic seems purposfully badly programmed. Nobody calls findobjectoftype for each object per frame, instead use self registration to a global.
  • Pure has Wrapper plumbing with comment about c++, does this mean it will disappear and move to the engine? They seem very generic already.
  • What is this thing about injection vs foreach etc…? Can someone explain the difference?

It seems to show only what entity use a system and how many ms that eats up. I like ECS but it’s very opaque. I’d say first thing to implement is a way to inspect entities like a classic object. In fact a good way to ease the transition and replace monos with ECS is to show the entities and systems in the hierarchy panel and allow selection and inspection in the same old way.
Looking over the ECS code, I have to say I really really like what the code looks like, so pure and non object-y :slight_smile:

1 Like

Yes, I wish they had some examples that try not to show off the system but rather take you through the basics step by step. I guess this will come in time.

I followed @Spy-Shifty_1 's implementation of his “pre-make” of how he assumed Unities ECS would look like and I found it more friendly to get going…(it’s not really maintained, did not do jobs, etc.) so has it’s own flaws but still, if you are new to ECS it’s possibly a good alternative read to get going

2 Likes

I’ve ran both the Hybrid and the Pure examples… and in the profiler it seems the Pure example spikes up to 30fps pretty frequently while all other examples run at around 250fs. Is there something going on that is affecting performance in the pure example?

I posted a thread about accessing values from ComponentDataArrays in ComponentSystems being super slow. I’m fairly sure that this affects the InstancedRendering system the Pure sample uses, and would explain slowness. It appears that there are debugging checks that slow it down. I might take a second look at the Pure scene and see if it’s the same thing, I’m fairly sure it probably is.

I tried out the hybrid and original samples, and in my case the pure performs better than the rest. Not by a whole lot, but by a bit. I certainly wasn’t getting 250fps on any of the projects lol. I dunno though, but that’s what I got when I tested them.

Please note:

  1. In the editor by default the Job debugger & full race condition checks are on by default
  2. Leak detection is enabled by default
  3. Burst by default compiles with safety checks

All of this has noticable overhead. In the jobs menu you can turn all of them off in the editor. (Disabling all safety resulting in that Unity might crash when you accidentally introduce race conditions) So this is good to have on as a default, but when profiling you should turn them off.

3 Likes

I have downloaded the samples and opening them in Unity 2018.1b12, but keep getting many Burst Compiler related errors like below.
C:/ProgramData/Unity/cache/packages/staging-packages.unity.com/com.unity.burst@0.2.1/Editor/BurstReflection.cs(19,67): error CS0246: The type or namespace name `AssembliesType’ could not be found. Are you missing an assembly reference?

Am I missing anything?

@asethi probably you need a preview build from here (https://beta.unity3d.com/download/ed1bf90b40e6/public_download.html), which is different than Unity 2018.1b12 from Unity Beta website

1 Like

Ah!. Just wasted 5 GB downloading the latest beta via Unity Hub. Alright, will check this preview build then. Thanks!

not work…3436795--271743--vox.jpg