Drawing in scene view doesn't work most times URP/ECS

Hi,
I’m using ALINE 1.6.2, Unity 2021.3.9f1 LTS, and URP.

Drawing in a Entities.ForEach works perfectly fine drawing in Gamemode but in scene view it draws nothing.
Sometimes after compliling it renders in scene view for a bit, but stops after compliling a few times.
Today it was 90% not working.

Any ideas as to what might cause this inconsistent issue?

Love the asset!

Cheers

Hi

Thank you for reporting this!
Would you mind showing the exact code you are using?

Hi Aron,
thank you for the reply!

Here is the code i use and it does not show in scene view most of the time.

Cheers

    protected override void OnUpdate()
    {
        var queryblob = this.EntityManager.CreateEntityQuery(typeof(SplineBlobHolder));
        if (queryblob.IsEmptyIgnoreFilter) return;
        Entity dataBlob = queryblob.GetFirstEntity();
        var splineBlobHolderComponent = this.EntityManager.GetComponentData<SplineBlobHolder>(dataBlob);

        var alineDraw = DrawingManager.GetBuilder(true);
        //Get beattime
        var deltaTime = this.Time.DeltaTime;

        this.Entities.WithAll<TagEnemy, BoidsMovementTag>().ForEach((
            Entity e, Translation translation, ref MovementTarget target, in EnemyProgress laneProgress,
            in BoidsLaneOffset offset) =>
        {
            ref var splineData = ref splineBlobHolderComponent.splineBlobReference.Value.SplineLists[0];

            float t = laneProgress.Progress;

            //Get spline progress (0->1)
            t = SplineUtility.GetPositionFromLength(t, ref splineData);
            //Get Oriented Point at spline progress position
            var point = SplineUtility.GetLocalOrientedPoint(t, ref splineData);
            //Get offset in world space
            var offsetWS = math.mul(point.Rotation, new float3(offset.Value.xy, 0f));
            //Apply offset
            var newPos = point.Position + offsetWS;

            //Set to Target component 
            target.Value = math.lerp(target.Value, newPos, deltaTime * target.TargetLerpStrength);

            alineDraw.Arrow(translation.Value, target.Value, Color.green);
            alineDraw.WireSphere(newPos, 0.3f, Color.yellow);
        }).ScheduleParallel();
        alineDraw.DisposeAfter(this.Dependency);

Thanks!

It looks like ECS system jobs can actually continue to run into the next frame. If you have an uneven framerate this can lead to flickering since during some frames 2 jobs complete, and during some frames 0 jobs complete. I have fixed this by making DisposeAfter wait for the dependency at the end of the frame before rendering by default (it can be turned off too, which is useful for long-running jobs).
This fix will be included in the next update.
I’m not sure what could cause it to render absolutely nothing, though. I cannot replicate that.

As a workaround, you can make sure to call Complete on the job before the end of the frame (well, before rendering happens).