Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Custom WebGL Templates in Project Assets (do they actually work?)

Discussion in 'Unity 5 Pre-order Beta' started by muzzythom, Feb 17, 2015.

  1. muzzythom

    muzzythom

    Joined:
    Dec 1, 2014
    Posts:
    17
    Has anyone found a way to make custom WebGL templates work when included in their project?

    Lets say I have a template named MyWebGLTemplate, I can get this to work when I add it at C:\Program Files\Unity <version>\...\WebGLTemplates\MyWebGLTemplate, but not if I include it in my project at <Project Root>\Assets\WebGLTemplates\MyWebGLTemplate.

    The error message I'm getting when I try is "Error building Player: Exception: Invalid WebGL template path: C:\Program Files\Unity <version>\Editor\Data\PlaybackEngines\webglsupport/BuildTools\WebGLTemplates\MyWebGLTemplate! Select a template in player settings". This looks to me like unity is trying to search for the template in it's own program files directory, despite the fact that the template is located in my local project directory.

    I've been trying this since b18 (or whenever WebGL templates were added), but am on RC2 now.

    Has anyone gotten this to work? If so, how?
     
  2. bsterling250DI

    bsterling250DI

    Joined:
    Sep 25, 2014
    Posts:
    78
    i would also be interested in this...
     
  3. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
  4. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    973
    and me.
     
  5. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    Moving an existing template to <project>/Assets/WebGLTemplates/ works for me.

    I have a template with files like this and it works:

    <project>/Assets/WebGLTemplates/mytemplate/index.html
    <project>/Assets/WebGLTemplates/mytemplate/thumbnail.png
    <project>/Assets/WebGLTemplates/mytemplate/TemplateData/favicon.ico
    <project>/Assets/WebGLTemplates/mytemplate/TemplateData/UnityProgress.js
    etc.
     
  6. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
    Mmmm something strange, in player settings appears my custom template but when i build have this error:

    Exception: Invalid WebGL template path: C:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport/BuildTools\WebGLTemplates\CustomTemplate! Select a template in player settings.
    UnityEditor.WebGL.WebGlBuildPostprocessor.GetTemplateFolder ()
    UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
    UnityEditor.HostView:OnGUI()

    Error building Player: Exception: Invalid WebGL template path: C:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport/BuildTools\WebGLTemplates\CustomTemplate! Select a template in player settings.



    My custom template is in: Assets\WebGLTemplates\CustomTemplate
     
  7. any_user

    any_user

    Joined:
    Oct 19, 2008
    Posts:
    374
    I'm not sure if it's normal to have forward and backslashes in the same path:
    C:\Program Files\Unity\Editor\Data\PlaybackEngines\webglsupport/BuildTools\WebGLTemplates\CustomTemplate!

    Maybe the problem only occurs on Windows (I'm on Mac where it works)?