- Home /
Embed .Unity3D file in MVC4 Applicatin in Visual Studio, ASP.NET
Hi, When I built my project as Web Application, it gives two files one is .html
and other is .unity3D
I open the .html
file and can see my running application, I've to use this in my site, So for checking purposes, I created simple WEB Application in Visual Studio 2012 and add both files in that project, Also add MIME type
in .config
file, it works fine.
Now I've to add these files in my MVC4 (actual) Application. I've replaced the contents of index.cshtml
by the contents of .html
provided by unity3D, and place that .unity3D
file in same directory, i.e. VIEW
but it shows download error of data file... MIME type
is also set but same ERROR ... :( kindly help me
Answer by johandanforth · Oct 29, 2015 at 11:31 AM
Not sure what got wrong for you, because it all worked at once for me.
Create new ASP.MVC website
Build your Unity Project, and Point at the same directory as your website root, so that the files and up in the root of your MVC Project
Now include all the generated files into your Project
Open up web.config and add these lines somewere inside the section:
'
<system.webServer>
<staticContent>
<mimeMap fileExtension=".unity3d" mimeType="application/vnd.unity" />
</staticContent>
</system.webServer>
Add a link to the .html file with the player and you should now be able to run the game perfectly inside your Project.