Can't find JSON files in Visual Studio project

Hi,

I added some JSON files to my project (under Assets/Resources), and when I generate a visual studio solution, it doesn’t add those files.

  • If I rename them to .txt, then it does, but then the syntax highlight doesn’t work well.
  • If I add them manually from within Visual Studio, then after a while Unity will overwrite the project files and they are removed from the solution once again.

This is a bit frustrating. How can I get Unity to add JSON files to the Visual Studio solution?

Thanks

I solved this by going to Project settings - > Editor and adding json to the “Additional extension to include” option.

8 Likes

I guess it doesn’t add them, but it looks like there is a way to hook into the Visual Studio project generation and do this yourself:

Sam

Here is a gist I just wrote to add JSON files to the generated Visual Studio project! Just drop it into Unity somewhere and force Unity to regenerate the VS project (clicking on .cs file should do the trick).

This will add JSON files that are anywhere under Assets. Note that it adds them to the “Assembly-CSharp” project, even if the JSON is under an Editor directory.

Cheers,
Sam

Yeah I solved it the same way, sorry for not updating the thread.

1 Like

Lol somehow I did not even see slim’s post! Well at least now I know about the VS hooks!