Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created April 15, 2018 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/bff6704a8ea613f9298513ff819ce50c to your computer and use it in GitHub Desktop.
Save tsubaki/bff6704a8ea613f9298513ff819ce50c to your computer and use it in GitHub Desktop.
ECS ハイブリットその1
using UnityEngine;
using Unity.Entities;
public class JumpSystem : ComponentSystem
{
struct Group
{
public ComponentArray<Rigidbody2D> rigidbody2ds;
}
[Inject] Group group;
protected override void OnUpdate()
{
if (Input.GetMouseButtonDown(0))
group.rigidbody2ds[0].velocity = new Vector2(0, 3f);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment