Skip to content

fast c# entity component system that uses burst and job systems by default.

Notifications You must be signed in to change notification settings

AlexWargon/Nukecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo-no-background

NUKECS is a fast c# entity component system that uses burst and job systems by default.

Entity Job System

[BurstCompile]
public struct ExampleSystem1 : IEntityJobSystem
{
	public SystemMode Mode => SystemMode.Parallel;
	public Query GetQuery(ref world) => world.CreateQuery()
					.With<Component1>()
					.With<Component2>()
					.None<Component3>();
 	public void OnUpdate(ref Entity entity, float deltaTime)
	{
 		ref var comp1 = ref entity.Get<Component1>();
		ref var comp2 = ref entity.Get<Component2>();
		entity.Has<Component3>() // return false in this case
		entity.Remove<Component1>();
 	}
}

Job System

[BurstCompile]
public struct TestSystem2 : IJobSystem, ICreate {
	private Query _query;

	public void OnCreate(ref World world) {
	        _query = world.CreateQuery().None<Component1>().With<Component2>();
	}

	public void OnUpdate(ref World world, float deltaTime)
	{
		if (_query.Count > 0) 
		{
			Debug.Log("WORK");
		}
	}
}

Also for every system can be added ICreate interface. OnCreate(ref World world) will be called when system are added to list of systems

TODO:

  • Unity integration without tri inspector
  • Generator for generic job systems