我在Unity中收到并且在Mac上工作的完整错误消息。
Assets / Scripts / Controller.cs(19,45):错误CS1061:“ Vector2”不包含“ GetAxis”的定义,并且没有可访问的扩展方法“ GetAxis”接受类型为“ Vector2”的第一个参数找到(您是否缺少using指令或程序集引用?)
这是我正在使用的代码:
$ gatsby build
success open and validate gatsby-configs — 0.006 s
success load plugins — 0.419 s
success onPreInit — 0.064 s
success delete html and css files from previous builds — 0.257 s
success initialize cache — 0.006 s
success copy gatsby files — 0.061 s
success onPreBootstrap — 0.010 s
success source and transform nodes — 0.155 s
success building schema — 0.173 s
success createPages — 0.000 s
success createPagesStatefully — 0.047 s
success onPreExtractQueries — 0.004 s
success update schema — 0.022 s
warning Using the global `graphql` tag is deprecated, and will not be supported in v3.
Import it instead like: import { graphql } from 'gatsby' in file:
/website/src/components/image.js
success extract queries from components — 0.266 s
success run static queries — 0.229 s — 6/6 26.29 queries/second
success run page queries — 0.003 s — 2/2 902.62 queries/second
success write out page data — 0.004 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.000 s
info bootstrap finished - 4.846 s
success Building production JavaScript and CSS bundles — 8.720 s
⡀ Building static HTML for pages{ department: 'obj1',
numEmployees: 2,
avgHrs: 18,
avgRate: 15,
other: 200 }
{ department: 'obj2',
numEmployees: 4,
avgHrs: 17,
avgRate: 13,
other: 150 }
{ department: 'obj3',
numEmployees: 3,
avgHrs: 20,
avgRate: 22,
other: 250 }
[ 'department', 'numEmployees', 'avgHrs', 'avgRate', 'other' ]
0
0
[ 'department', 'numEmployees', 'avgHrs', 'avgRate', 'other' ]
1
1
[ 'department', 'numEmployees', 'avgHrs', 'avgRate', 'other' ]
2
2
undefined
undefined
⢀ Building static HTML for pages /website/public/render-page.js:27034
var el = document.getElementById("myChart" + index);
^
ReferenceError: document is not defined
at charting (/website/public/render-page.js:27034:14)
at Timeout._onTimeout (/website/public/render-page.js:27103:9)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
⠁ Building static HTML for pages
请让我知道是否需要其他信息。
答案 0 :(得分:0)
我认为您对Input
和moveInput
感到困惑。另外,如果您拥有RigidBody或RigidBody2d,则应尝试不要直接修改GameObjects的位置,而应使用AddForce
方法。我将删除固定的update方法,而是将您的Update方法修改为以下内容:
void Update() {
Vector2 moveInput = new Vector2(Input.GetAxis("Horizontal"),Input.GetAxis("Vertical"));
rigidBody.AddForce(moveInput.normalized * speed);
}