KieranCoppins / Decision-Tree-Package

An open source Unity package for creating Decision Trees with a visual editor. The package comes with some samples to help teach users how to use it and an action manager to handle executing the results of the decision tree.
MIT License
47 stars 2 forks source link

Error CS0234: The type or namespace name 'GraphView' does not exist in the namespace 'UnityEditor.Experimental' #10

Closed OruteZ closed 1 month ago

OruteZ commented 1 month ago

I encountered an issue when trying to build a project that uses the com.kierancoppins.decision-trees package. The build fails with the following error:

Library\PackageCache\com.kierancoppins.decision-trees@e597ef1d9a\Runtime\DecisionTree.cs(6,32): error CS0234: The type or namespace name 'GraphView' does not exist in the namespace 'UnityEditor.Experimental' (are you missing an assembly reference?)

To investigate the issue further, I created a new, empty Unity project and only added the sample from this package. The same error occurred during the build process, which suggests that the issue is related to the package itself rather than my project setup.

It seems that the GraphView API, which is part of the UnityEditor.Experimental namespace, may not be available or correctly referenced in the package. As a result, the package fails to compile.

Steps to Reproduce:

Create a new Unity project. Add the com.kierancoppins.decision-trees package to the project. Attempt to build the project. Expected Behavior: The project should compile and build without errors.

Unity Version: 2021.3 and 2022.3

Please let me know if there is a workaround or if there are any specific dependencies that need to be included to resolve this issue. Any help would be appreciated.

Thank you.

KieranCoppins commented 1 month ago

Hi @OruteZ, thank you for posting this issue and bringing it to my attention!

I have done some research and it appears Unity does not allow building of projects with experimental dependancies, which this package relies heavily on the GraphView experiemental package. I have looked at newer versions of Unity and it appears that the GraphView package has never come out of experimental.

It appears they are currently working on a new package called the Graph Tools Foundation that will replace the Graph View API. According to their road map, the Graph Tools Foundation is still in progress. This will mean that once that is done, this package will most likely require a rewrite for the new API.

As for right now, it seems that there is no way to build a project with an experimental package. However, we don't actually need to include the graph view package when building out project, we only need it for the editor! I have just finished working on adding preprocessor directives to the package to leave out any editor specific code so that it doesn't get included into the production build. I have tested this on my project and appears to work without a problem. I am going to PR this shortly.

Thanks again for raising this issue!

KieranCoppins commented 1 month ago

I have now released V1.3.0, please update your package to the latest release. I will wait for your confirmation before closing this issue!

OruteZ commented 1 month ago

In my project, I added that package and successfully built it. Thank you!