问题标签 [unity-dots]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1719 浏览

unity3d - 如何使 Unity DOTS Physics Ray cast 与 ECS 配合使用?

问题:我有 3 个游戏对象,它们具有 PhysicShape 和 PhysicBody(static) 组件。我将其转换为实体并进入场景。我不认为物体会相互碰撞,所以我尝试让 Ray cast 在它们碰撞之前处理另一个物体。但似乎我做错了什么,Ray cast 没有“看到”其他对象(它们都在一层,都是实体)。

我的雷演员代码

0 投票
1 回答
291 浏览

unity3d - Visual Scripting Dots Package Assemble issue

So I just created a new project to mess around with visual scripting, ECS and DOTS but I'm having some issues to get some of the unity physics stuff to work VisualScriptingPhysics.cs it says that it has Assemble reference missing but I have check the docs and it has all the references it would need to work what am I missing

I'm getting 2 errors in the console

Library\PackageCache\com.unity.visualscripting.entities@0.4.0-preview.1\Runtime\VisualScriptingPhysics.cs(94,58): error CS0246: The type or namespace name 'ICollisionEventsJob' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.unity.visualscripting.entities@0.4.0-preview.1\Runtime\VisualScriptingPhysics.cs(94,39): error CS0246: The type or namespace name 'ITriggerEventsJob' could not be found (are you missing a using directive or an assembly reference?)

witch is referencing this struct CollectCollisionsJob : ITriggerEventsJob, ICollisionEventsJob witch is in VisualScriptingPhysics.cs a part of Visual Scripting package for it to be compatible with unity physics and the reference that it says it needs in the doc is Unity.Physics witch is at the top of the code would there be any way to fix this manual please let me know

full code for the file that is throwing error keep in mind that this is part of a package and not my code let me know if its something I can fix or do I have to wait till unity update their package

here is all the packages I have installed with the version and date they were updated i have tried to change the version of a different package but keep getting the same error

Burst Version 1.3.3 - June 26, 2020

Castle Core Version 1.0.1 - June 13, 2019

Collections Version 0.11.0-preview.17 - July 22, 2020

Custom NUnit Version 1.0.0 - April 03, 2019

Entities Version 0.13.0-preview.24 - July 22, 2020

Graph Tools Foundation Version 0.3.0-preview.1 - July 31, 2020

Havok Physics for Unity Version 0.3.1-preview - July 28, 2020

Hybrid Renderer Version 0.7.0-preview.24 - July 22, 2020

Input System Version 1.0.0 - April 29, 2020

Jobs Version 0.4.0-preview.18 - July 22, 2020

Mathematics Version 1.1.0 - July 11, 2019

Mono Cecil Version 0.1.5-preview - April 03, 2019

Moq Version 1.0.0 - June 13, 2019

Newtonsoft Json Version 2.0.0-preview - December 13, 2019

Performance testing API Version 2.2.0-preview - May 27, 2020

Platforms Version 0.6.0-preview.1 - July 07, 2020

Properties Version 1.3.1-preview - June 17, 2020

Properties UI Version 1.3.1-preview - June 18, 2020

Scriptable Build Pipeline Version 1.6.4-preview - February 11, 2020

Searcher Version 4.0.9 - November 11, 2019

Serialization Version 1.3.1-preview - June 18, 2020

Test Framework Version 1.1.16 - July 27, 2020

TextMeshPro Version 3.0.1 - July 27, 2020

Timeline Version 1.3.4 - June 11, 2020

Unity Collaborate Version 1.3.8 - June 12, 2020

Unity Physics Version 0.4.1-preview - July 27, 2020

Unity UI Version 1.0.0 - August 05, 2020

Visual Scripting ECS Version 0.4.0-preview.1 - July 31, 2020

Visual Studio Code Editor Version 1.2.1 - May 20, 2020

Visual Studio Editor Version 2.0.2 - June 02, 2020

0 投票
1 回答
910 浏览

c# - Unity Job System 抛出范围异常并告诉我调用 jobHandle.complete() 即使我有它

这是我无法真正理解的错误,我不明白为什么索引是-1?我得到的所有这些错误都被-1抵消了。

IndexOutOfRangeException:索引 -1 超出 ReadWriteBuffer 中受限的 IJobParallelFor 范围 [0...799]。ReadWriteBuffers 仅限于读取和写入作业索引处的元素。您可以使用双缓冲策略来避免由于并行读取和写入作业中的相同元素而导致的竞争条件。

我只是创建了一个基于 3d 噪声的行进立方体洞穴生成器,我在没有统一的工作系统的情况下工作,而且速度很慢,所以我想我试试这个来提高速度。

这是我所有的代码:(它可能很烂,但我在工作系统上做了一些其他教程,并想跳进更难的东西)

0 投票
1 回答
1173 浏览

unity3d - Unity DOTS 对普通游戏有多大好处?

我知道 DOTS 和 ECS 的巨大优势体现在游戏包含大量拥有相同数据的对象时,因此它们可以放在内存块中并轻松迭代。

我的问题是:我正在做一个普通的游戏,它不包含数千个拥有相同数据的对象,恰恰相反:有很多对象包含不同的数据和行为。使用 DOTS 是否仍然有益?

我知道就内存而言,它是有益的,因为只有有用的东西才能发挥作用,但是在 DOTS(数千个类似对象)的巨大好处不存在的情况下,我应该如何决定使用它与否?

0 投票
1 回答
64 浏览

unity3d - Unity ECS 系统在命名空间更改后中断

我刚刚意识到在一些(据称)无害的重构更改之后,我的游戏逻辑崩溃了。

通过我的 VCS 历史记录和一些调试,我发现问题是由导致问题的系统的命名空间更改引起的。

奇怪的是系统似乎仍然可以工作,更新我的实体的平移和旋转的部分仍然被调用(从断点/日志消息中可以看出),但是,没有任何更改反映在渲染或实际组件中.

0 投票
0 回答
88 浏览

c# - 安装 Unity DOTS 包后出错

我正在尝试设置一个将使用 DOTS 的项目,但是我遇到了这个错误,几乎没有我自己的代码。在通过 StackOverflow、Reddit 和 Unity 论坛搜索后,没有任何建议可以解决问题。

我尝试过更新包,恢复到旧包,手动替换代码(所有错误都来自对 SharedComponentDataProxy 的相同引用)。好像它来自com.unity.entities。在该类的官方实体文档页面上,它提到它来自 com.unity.entities@0.20.0 但包管理器说我有最新版本并且尝试手动添加指定版本没有任何作用。

我应该怎么做才能解决这个问题?

当前软件包版本
当前包版本 统一日志 Unity log 问题代码示例 问题代码示例

0 投票
1 回答
181 浏览

unity3d - 当我调整视图时,统一场景和游戏视图中的对象正在消失

所以我正在尝试学习 Unity DOTS,并且我已经构建了一个渲染一堆立方体的程序。但是由于某种原因,在游戏视图和场景视图中,当我移动相机时,屏幕边缘的立方体开始消失。我不知道是否可能有一些设置导致不可见的对象不被渲染或某些东西,或者可能与它们成为实体有关?

这是我用来生成瓷砖的代码:

显示剪辑的屏幕截图

0 投票
0 回答
124 浏览

unity3d - 如何在 Unity DOTS 中冻结/约束 PhysicsBody 的旋转?

我试图从 Unity Engine 移植一个小型测试项目,以了解 Unity New Fishers DOTS && ECS。

这是一个小项目,我有一个带 a 的胶囊,Rigidbody我使用加力将其从左向右移动,并限制速度以限制速度。

我正在尝试在 DOTS 上“冻结特定旋转”。

如果没有 DOTS,就会有 Unity 的“正常”方式来约束Rigidbody位置和旋转。

在此处输入图像描述

但是如果我们使用 DOTS,我就不能使用RigidbodyDOTS PhysicsBody,因为我没有找到任何方法来冻结/限制某些旋转。

如何PhysicsBody在 DOTS 中限制 a 的旋转?

0 投票
0 回答
25 浏览

c# - Unity DOTS Cubes 不想正确移动

您好,我目前正在学习 DOTS,但遇到了问题。我想移动一些立方体,但他们不想。我的系统脚本如下所示:

噪声位置函数根据当前给定的位置计算新位置。立方体只移动一次,然后它们会停留在那个位置并且不会进一步移动。所以我猜系统设置立方体位置但不改变初始值。所以我从 state1 开始,从中计算 state2,立方体被移动到 state2,但在下一帧它再次用 state1 计算。此处链接示例图片:https : //ibb.co/kGqb3pP 立方体的初始 y 位置始终为零,因此计算似乎有效。

我用这些线创建立方体:

对于运动代码:我使用相同的函数与独立作业系统进行比较。既然它在那里工作,逻辑应该是正确的:

但是,如果我将函数调用替换为一个简单position.Value += deltaTime的立方体,则立方体会正确移动。

所以总结一下,我有点困惑,如果这里有人对 DOTS 有足够的了解来帮助我,我会很感激。提前致谢。

0 投票
1 回答
43 浏览

c# - RTT(往返时间)在 Unity DOTs 项目中始终返回零

我正在尝试使用 DOTsSample Unity 项目并希望使用此 NetworkStatistics 类(https://github.com/Unity-Technologies/DOTSSample/blob/master/Assets/Scripts/Game/Main/NetworkStatisticsClient.cs)并尝试编写一个脚本来显示我游戏中的网络统计信息,但问题是它总是返回 0。

有人可以帮我吗?