如何在C#程序中运行“无头”(无GUI)Unity3D游戏?

时间:2017-03-09 20:39:25

标签: c# unity3d

我想只执行游戏的模型部分,没有任何类型的GUI。

因此,我会从Unity3D实例化一些类,以某种方式安排它们,“启动”它们意味着什么,并定期读取游戏中组件的状态,或者从它们接收更新事件。

目前我已经有了Unity DLLs available with a NuGet Package,但我不知道该如何继续下去:

public class HelloUnity3D
{
    void run()
    {
        var myGame = new UnityEngine.MonoBehaviour();

        //myGame.WhatNow(?)
    }
}

1 个答案:

答案 0 :(得分:0)

不,这是不可能的。

AFAIK,Oops: Machine check, sig: 7 [#1] MPC830x RDB Modules linked in: hyphy_pcie mpc_cs2_adbus_access_module NIP: cd1da524 LR: cd1da4cc CTR: 00000000 REGS: c71f5d80 TRAP: 0200 Not tainted (2.6.29.6-rt23) MSR: 00041000 <ME> CR: 44000442 XER: 00000000 TASK = c794e960[1656] 'hyphy_cnode' THREAD: c71f4000 GPR00: 00000000 c71f5e30 c794e960 cd1dadec 00000000 00000000 c71f5eb4 00000000 GPR08: 04921d4c d2121d4c 00000004 ffffffff 04921d50 10202a5c 00000000 00000000 GPR16: 00000000 00000000 00000000 0000ffff 04921d4c 4982d5dc c71f5f28 c71f5e38 GPR24: cd1e0000 cd1e0000 00000004 cd1e0000 00000001 04921d4c 00000000 00000000 Call Trace: [c71f5ef0] [c00761f4] 0xc00761f4 [c71f5f10] [c0076674] 0xc0076674 [c71f5f40] [c001141c] 0xc001141c --- Exception: c01 at 0xffa0014 LR = 0xff9fff0 Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX 7ffdfb78 XXXXXXXX XXXXXXXX XXXXXXXX 48000030 XXXXXXXX XXXXXXXX XXXXXXXX 7d69fc2c XXXXXXXX XXXXXXXX XXXXXXXX 7d7fb92e ---[ end trace 82414d2c955335e9 ]--- Oops: Machine check, sig: 7 [#2] MPC830x RDB Modules linked in: hyphy_pcie mpc_cs2_adbus_access_module NIP: cd1da524 LR: cd1da4cc CTR: 00000000 REGS: c719fd80 TRAP: 0200 Tainted: G D (2.6.29.6-rt23) MSR: 00049030 <EE,ME,IR,DR> CR: 48000422 XER: 00000000 TASK = c78784d0[1688] 'hyphy_cnode' THREAD: c719e000 GPR00: 00000000 c719fe30 c78784d0 cd1dadec 00000000 00000000 c719feb4 00000000 GPR08: 04960200 d2160200 00000004 00000000 04960204 10202a5c 00000077 00000077 GPR16: 00000073 00000066 00000067 10013430 04960200 bf93cf8c c719ff28 c719fe38 GPR24: cd1e0000 cd1e0000 00000004 cd1e0000 00000001 04960200 00000000 00000000 Call Trace: [c719fe30] [c03ceb80] 0xc03ceb80 (unreliable) [c719fef0] [c00761f4] 0xc00761f4 [c719ff10] [c0076674] 0xc0076674 [c719ff40] [c001141c] 0xc001141c --- Exception: c01 at 0xff9ff90 LR = 0xffb622c Instruction dump: 419e0168 575cf0bf 41820094 7ffdfb78 3bc00000 3f60cd1e 3f20cd1e 48000030 813bb3a0 7d3d4a14 7c0004ac 7d69fc2c <0c0b0000> 4c00012c 381e0001 7d7fb92e ---[ end trace 82414d2c955335ea ]--- 4 Oops: Machine check, sig: 7 [#3] MPC830x RDB Modules linked in: hyphy_pcie mpc_cs2_adbus_access_module NIP: cd1da524 LR: cd1da4cc CTR: 00000000 REGS: c7205d80 TRAP: 0200 Tainted: G D (2.6.29.6-rt23) MSR: 00049030 <EE,ME,IR,DR> CR: 48000422 XER: 00000000 TASK = c78df980[1692] 'hyphy_cnode' THREAD: c7204000 GPR00: 00000000 c7205e30 c78df980 cd1dadec 00000000 00000000 c7205eb4 00000000 GPR08: 04960200 d2160200 00000004 00000000 04960204 10202a5c 00000077 00000077 GPR16: 00000073 00000066 00000067 10013430 04960200 bfc2ef8c c7205f28 c7205e38 GPR24: cd1e0000 cd1e0000 00000004 cd1e0000 00000001 04960200 00000000 00000000 Call Trace: [c7205e30] [c03ceb80] 0xc03ceb80 (unreliable) [c7205ef0] [c00761f4] 0xc00761f4 [c7205f10] [c0076674] 0xc0076674 [c7205f40] [c001141c] 0xc001141c --- Exception: c01 at 0xff9ff90 LR = 0xffb622c Instruction dump: 419e0168 575cf0bf 41820094 7ffdfb78 3bc00000 3f60cd1e 3f20cd1e 48000030 813bb3a0 7d3d4a14 7c0004ac 7d69fc2c <0c0b0000> 4c00012c 381e0001 7d7fb92e ---[ end trace 82414d2c955335eb ]--- ... Oops: Machine check, sig: 7 [#4] MPC830x RDB Modules linked in: hyphy_pcie mpc_cs2_adbus_access_module NIP: cd1da524 LR: cd1da4cc CTR: 00000000 REGS: c71cbd80 TRAP: 0200 Tainted: G D (2.6.29.6-rt23) MSR: 00049030 <EE,ME,IR,DR> CR: 48000422 XER: 00000000 TASK = c794e960[1696] 'hyphy_cnode' THREAD: c71ca000 GPR00: 00000000 c71cbe30 c794e960 cd1dadec 00000000 00000000 c71cbeb4 00000000 GPR08: 04960200 d2160200 00000004 00000000 04960204 10202a5c 00000077 00000077 GPR16: 00000073 00000066 00000067 10013430 04960200 bf8d3f8c c71cbf28 c71cbe38 GPR24: cd1e0000 cd1e0000 00000004 cd1e0000 00000001 04960200 00000000 00000000 Call Trace: [c71cbe30] [c03ceb80] 0xc03ceb80 (unreliable) [c71cbef0] [c00761f4] 0xc00761f4 [c71cbf10] [c0076674] 0xc0076674 [c71cbf40] [c001141c] 0xc001141c --- Exception: c01 at 0xff9ff90 LR = 0xffb622c Instruction dump: 419e0168 575cf0bf 41820094 7ffdfb78 3bc00000 3f60cd1e 3f20cd1e 48000030 813bb3a0 7d3d4a14 7c0004ac 7d69fc2c <0c0b0000> 4c00012c 381e0001 7d7fb92e ---[ end trace 82414d2c955335ec ]--- 由Unity3D的编辑器或播放器(播放引擎)执行 - 您可以在Windows上的 unity3d_install_dir \ Editor \ Data \ PlaybackEngines 中找到它们。

因此,如果您想“仅执行游戏的模型部分”,则必须编写仅建模的播放引擎。但我认为如果不访问Unity3D的源代码就无法完成。

但是可以运行不运行需要Unity3D播放引擎的代码的MonoBehaviour代码。