Example #1
0
        protected override void OnUpdate()
        {
            var job = new RotationSpeedJob()
            {
                RotationTypeHandle      = GetComponentTypeHandle <Rotation>(false),
                RotationSpeedTypeHandle = GetComponentTypeHandle <RotationSpeed>(true),
                DeltaTime = Time.DeltaTime
            };

            this.Dependency = job.ScheduleParallel(m_Query, this.Dependency);
        }
Example #2
0
    // OnUpdate runs on the main thread.
    protected override void OnUpdate()
    {
        // Explicitly declare:
        // - Read-Write access to Rotation
        // - Read-Only access to RotationSpeed_IJobChunk
        var rotationType      = GetComponentTypeHandle <Rotation>();
        var rotationSpeedType = GetComponentTypeHandle <RotationSpeed_IJobEntityBatch>(true);

        var job = new RotationSpeedJob()
        {
            RotationTypeHandle      = rotationType,
            RotationSpeedTypeHandle = rotationSpeedType,
            DeltaTime = Time.DeltaTime
        };

        Dependency = job.ScheduleParallel(m_Query, 1, Dependency);
    }