Currently the WebGLTemplates folder must be located in the root Assets folder, unlike the folders of Editor or Plugins. It makes it difficult for assets and packages developers to create special templates, as they might get over other packages templates. Also, with the Unity Packages Manager, you need to make some hacks in order to copy a template to the project ( example of a hack here https://github.com/De-Panther/unity...3b8915/Packages/webxr/Editor/WebXRMenu.cs#L12 ) There was this bug report in the past, but it was closed. https://issuetracker.unity3d.com/is...from-packages-when-they-are-marked-as-samples Is it relevant to re-open it now? Should we report about it again?
Hmmh, it looks like there are two different ways to approach: 1. Adding support for placing "WebGLTemplates/" subdirectories to nested subdirs under Assets/. That is, in project build settings, should look for WebGLTemplates/ directories recursively and/or 2. When importing a sample, if the sample contains any "WebGLTemplates/" subdirectories, those should be imported under root WebGLTemplates/ directory, instead of to a nested subdirectory where the rest of the content is imported? I presume if either one of these was implemented, it would make the other redundant? I think adding support for 1) is probably more flexible, and avoids directory name collision. However I wonder whether we'd run into an issue that packages containing templates for, say, 2019.4 format, would not work in Unity 2020.1? (and vice versa) That is, the package will not be universally importable across many Unity versions? So I wonder if we'd also need a way to configure/filter templates to target a specific Unity version (range) only? I am leaning towards enabling support for 1), cannot think of a reason why that couldn't be implemented. Would that solve the issue?
Totally option 1. It solves all the issues. I guess that the current behavior is because that when the feature was new, Unity supported UnityScript (".js" files), and that was the only folder that ignored compilation of ".js" files in the engine. Now that UnityScript is no longer supported, I guess that option 1 would work great. Regarding 2019 vs 2020 templates, developers that want to support both versions, can add separate templates for 2019 and 2020.