ArthurBrussee/KNN

can't compile package

Aegel5 opened this issue · 4 comments

Library\PackageCache\com.akb.knn@e5efc63\Demo\KnnVisualizationDemo.cs(7,32): error CS0234: The type or namespace name 'ParticleSystemJobs' does not exist in the namespace 'UnityEngine.Experimental' (are you missing an assembly reference?)

same issue, did you manage to solve this?

Same issue here. Is there a version of Burst package we should be using? 0

Here's a patch to fix it in Unity 2020+

diff --git a/Demo/KnnVisualizationDemo.cs b/Demo/KnnVisualizationDemo.cs
index f4ee1d6..b8ae0f9 100644
--- a/Demo/KnnVisualizationDemo.cs
+++ b/Demo/KnnVisualizationDemo.cs
@@ -4,7 +4,8 @@ using Unity.Collections;
 using Unity.Jobs;
 using Unity.Mathematics;
 using UnityEngine;
-using UnityEngine.Experimental.ParticleSystemJobs;
+using UnityEngine.ParticleSystemJobs;
+
 
 // Ideally you really would use something like ECS to visualize the point cloud
 // And query from a job component system
@@ -58,14 +59,14 @@ public class KnnVisualizationDemo : MonoBehaviour {
 	}
 
 	// [BurstCompile(CompileSynchronously = true)]
-	struct ParticleJob : IParticleSystemJob {
+	struct ParticleJob : IJobParticleSystem {
 		[ReadOnly] public NativeArray<int> KnnResults;
 		public NativeArray<float3> Points;
 
 		public NativeArray<Color32> Colors;
 		public int K;
 
-		public void ProcessParticleSystem(ParticleSystemJobData jobData) {
+		public void Execute(ParticleSystemJobData jobData) {
 			var colors = jobData.startColors;
 			var positions = jobData.positions;
 
@@ -85,13 +86,13 @@ public class KnnVisualizationDemo : MonoBehaviour {
 		}
 	}
 
-	struct ParticleRangeJob : IParticleSystemJob {
+	struct ParticleRangeJob : IJobParticleSystem {
 		[ReadOnly] public NativeArray<RangeQueryResult> KnnResults;
 
 		public NativeArray<float3> Points;
 		public NativeArray<Color32> Colors;
 
-		public void ProcessParticleSystem(ParticleSystemJobData jobData) {
+		public void Execute(ParticleSystemJobData jobData) {
 			var partColors = jobData.startColors;
 			var partPos = jobData.positions;
 
@@ -119,21 +120,26 @@ public class KnnVisualizationDemo : MonoBehaviour {
 	void Update() {
 		if (Mode == QueryMode.KNearest) {
 			// Update particles job to do the colors
-			m_system.SetJob(new ParticleJob {
+			var j = new ParticleJob {
 				KnnResults = m_results,
 				Points = m_points,
 				K = QueryK,
 				Colors = m_queryColors
-			});
+			};
+
+			j.Schedule(m_system);
 		}
 		else {
 			// Update particles job to do the colors
-			m_system.SetJob(new ParticleRangeJob {
+			var j = new ParticleRangeJob {
 				KnnResults = m_rangeResults,
 				Points = m_points,
 				Colors = m_queryColors
-			});
+			};
+			j.Schedule(m_system);
 		}
+		
+		
 	}
 
 	// After particle job

Here's a patch to fix it in Unity 2020+

// After particle job

I really need this but I have no idea how to apply this. I googled how to do diff patches in github but no luck, it's all .py patch based