- Home /
Hybrid ECS ForEach how to
first try of using Hybrid entity component system. Stuck un Entity.ForEach implimenting. Thera are three script attached and issue is in third one
//------------------------//
using UnityEngine;
public class CupsuleParams : MonoBehaviour
{
public float speed = 3;
}
//-----------------------//
using UnityEngine;
public struct CupsuleComponent
{
public Rigidbody rigidbody;
}
//-----------------------//
using UnityEngine;
using Unity.Entities;
public class CupsuleSystem : ComponentSystem
{
protected override void OnUpdate()
{
// used to be correct before update of the ETC. And all the internet lessons do this way
//foreach (CupsuleComponent component in GetEntities<CupsuleComponent>())
//{
// component.rigidbody.AddForce(Vector3.up);
//}
// this shows error
Entities.ForEach((Entity entities, CupsuleComponent component) =>
{
component.rigidbody.AddForce(Vector3.up);
});
}
}
Comment
Your answer
Follow this Question
Related Questions
UI problem with mask 1 Answer
Unable to Reference a Class 1 Answer
About to start an Ambitious project 2 Answers
Help with auto moving script 1 Answer
C#scripts visibility at runtime and in editor in Monodevelop 1 Answer