Unity WebGL 与 ASP.NET

问题描述 投票:0回答:0

因为我找不到解决我的问题的方法,所以我创建了这个线程。我是 ASP.NET MVC 的初学者,目前正在尝试使用 Unity 构建游戏作为 WebGL 创建一个网站。这是我的项目树

这是我的 GamePage.cshtml 代码

@page
@model GamePageModel
@{
    ViewBag.Title = "Game";
}

<h2>@ViewBag.Title</h2>

<div id="gameContainer"></div>

<script src="~/Build/TemplateData/style.css"></script>
<script src="~/Build/TemplateData/UnityProgress.js"></script>

<script src="~/Build/BUILDS.loader.js"></script>
<script src="~/Build/BUILDS.data"></script>
<script src="~/index.html"></script>

<a href="~/index.html">~/index.html</a>

这是我的 GameController.cs 的脚本

using Microsoft.AspNetCore.Mvc;

namespace TestGame02.Controllers
{
    public class GameController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public ActionResult Game()
        {
            return View();
        }

    }
}

但是当我在本地服务器上运行游戏时出现此错误。

我再次为菜鸟问题道歉,我知道我遗漏了一些东西,但我找不到什么。

asp.net unity-game-engine model-view-controller webgl
© www.soinside.com 2019 - 2024. All rights reserved.