Unity-Technologies/com.unity.demoteam.hair

Impossible to access DemoTeam namespace in code

methusalah opened this issue · 4 comments

I want to change the solver settings via code (for example to dry hair over time by having less and less gravity applied).

But it seems that I cannot access the Unity.DemoTeam namespace and end up with this message in the console "Assets\Scripts\Kinematic\HairInstanceController.cs(3,13): error CS0234: The type or namespace name 'DemoTeam' does not exist in the namespace 'Unity' (are you missing an assembly reference?)"

I'm am able to manually include the DLL in the solution in Visual Studio, but whenever I go back to Unity, it recompile and remove the dependency.

The package is present in the package manager. Here is what I tried:

  • installed it with a git URL,
  • installed it by adding the dependency in the manifest,
  • restarted Unity,
  • tested on different projects,
  • tested on different Unity versions (2021.2 and 2022.1),
  • tested on different computer, have friend to test it as well,
  • tested with an up-to-date Visual Studio 2022.
  • tested the DigitalHuman package (also in the DemoTeam namespace) with the same result.

Anyhow I can't access any of the demoteam.hair public script via code.

Is there something I am missing here? is it because the package is experimental?

Hey, see my reported issue #3
Only way to access I found was to change the assembly file and set autoreferenced to true inside the Hair package. This is far from optimal, and it would be an easy change to do this in the repo.

@qlee01 thank you for pointing it out, but I have no knowledge on the matter. Could you be a little more explicit about how to do what you describe, for my sake and others' that might end up here?

Thank you in advance

In the Hair package Runtime folder, find the file Unity.DemoTeam.Hair.Runtime.asmdef, and set "autoReferenced": true.
There might me more asmdef files which need change (in Editor folder).
This basically allows the default namespace in C# to access the scripts. (default namespace = no explicit namespace stated).
If you are already using namespaces, there might be better options to include the namespace of Hair package, but I also don't have much knowledge about this.

Thanks, it seems to work for me. I just had to restart Unity.

I can't tell why it is like that, though. Is there any point to have the package not referenced like this? Having available components but not being able to get the associated script seems odd and a bad design. Or maybe it is a way to ensure people will not reach the API, because it is still a WIP and experimental?

Anyway it solved my issue so I close this.