Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace GLTFast.Newtonsoft could not be found #671

Closed
daniel1v opened this issue Jan 25, 2024 · 4 comments
Closed

Namespace GLTFast.Newtonsoft could not be found #671

daniel1v opened this issue Jan 25, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@daniel1v
Copy link

daniel1v commented Jan 25, 2024

Describe the bug

Unity Editor shows a compiler error:

error CS0234: The type or namespace name 'Newtonsoft' does not exist in the namespace 'GLTFast' (are you missing an assembly reference?)

following package versions are installed via package manager:

com.unity.nuget.newtonsoft-json 3.2.1
com.unity.cloud.gltfast 6.1.0

To Reproduce

Using Unity 2022.3

install com.unity.nuget.newtonsoft-json
install com.unity.cloud.gltfast
try to use namespace GLTFast.Newtonsoft

Expected behavior
namespace should be found, because newtonsoft is present

Am I missing something?

@daniel1v daniel1v added the bug Something isn't working label Jan 25, 2024
@daniel1v
Copy link
Author

After diving a bit into the package, I noticed, that autoReferenced should be set to true in the asmdef.

At least it seems to solve my issues.

@atteneder
Copy link
Owner

Hi @daniel1v ,

Glad you found a solution! I'm hesitant to enable autoReference. Imho references should be set explicitely to give devs full control. I'm aware that this is not consistent within glTF....legacy was carried on for now. At some point all asmdefs shoud not be auto referenced.

Thanks.

@daniel1v
Copy link
Author

Hi @atteneder,

thank you for your reply. I'm not sure if this is a general solution for the issue, because I had to move the package and edit its contents. So it is more a workaround I think and I fear this leads to issues when the package is updated.

Is there a recommended way to solve this, without editing contents of the package? My unity knowledge is limited, so maybe I have overseen something obvious?

@atteneder
Copy link
Owner

I think the original error was resolved in glTFast 6.2.0, which was released yesterday. Feel free to give it a try and report any issues.

With regards to asmdefs, the best practice is to put your own code into an asmdef as well and reference any dependencies explicitely. That should keep compile times (and thus iteration time) short and there are no surprisingly linked libraries. See the docs for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants