NormandErwan / DocFxForUnity

DocFX usage example for Unity projects
https://normanderwan.github.io/DocFxForUnity/
MIT License
213 stars 31 forks source link

Player class does not include Unity documentation #14

Open marwie opened 4 years ago

marwie commented 4 years ago

Hello, thanks for the project.

Ive been trying to figure out how to get the full name of Unity type namespaces for package code. I tried running docfx but the Player class does not include Unity documentation either: image the log output is as follows: image

As for my own project I tried using the csproj of my package as metadata provider but I get an error in UnityEngine.Rendering.yml using "ManagedReference.html.primary.js" saying something like "error running Transform function inside template preprocessor: type if undefined". It's a 7000ish raw data json. Do you happen to have any knowledge about errors like this one and maybe a hint on how to debug? (Using the default template)

shreyanshanchlia commented 3 years ago

Same issue here as well. Can't refer to Unity Documentation.

NormandErwan commented 3 years ago

DocFX requires two conditions to generate xref links:

  1. Generating metadata from .csproj not from .cs files.
  2. Building the documentation with a valid Unity installation on the machine.

Therefore it requires to install and activate Unity before generating the docs to : (1) generate the .csproj and (2) allow DocFX to generate xref links.

This is similar to #18 but here on a local machine, there on GitHub workflows.

On a local machine, you need to :

  1. Edit your docfx.json to generate metadata from .csproj

    
    "metadata": [
        {
            "src": [
                {
                    "src": "..",
                    "files": [
    -                    "**.cs"
    +                    "*.csproj"
                    ]
                }
            ],
            "globalNamespaceId": "Global",
            "filter": "filterConfig.yml",
            "dest": "api"
        }
    ],
  2. Make sure Unity has generated the .csproj files.

    • Either, inside the editor, click Assets > Open C# Project.
    • Or, in a terminal, type: "C:\Program Files\Unity\Hub\Editor\<version>\Editor\Unity.exe" -batchmode -nographics -quit -executeMethod UnityEditor.SyncVS.SyncSolution.
  3. Finally generate your docs!

I'll update the FAQ of this repo with these instructions.