We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
可不可以把那些可能为空的变量类型设为单一类型,由开发者自行判空呢?比如gameObject.parent,再比如egret3d.inputCollecter.getHoldKeys()...写一排if判空,只为能用一个值,有点...太闹心了...
我只是想取个键盘输入,但即便如此还是在报错...请问该用什么姿势才能取值呢?
The text was updated successfully, but these errors were encountered:
可以开启 ts 严格模式来编写代码,就会舒适很多,那样你就会知道很多都不用判断,或者说什么应该判断什么无需判断,比如下面的声明,严格说明了可能返回 null,那没有声明的,就一定不会返回 null,完全无需判断。 https://github.com/egret-labs/egret3d/blob/master/core/egret3d/components/renderer/meshRenderer/MeshFilter.ts#L30
关于输入如何使用,可以看 egretpro 工程里自带的输入例子
Sorry, something went wrong.
那个...那这个该咋判断呢?就是取是否当前有按着“W”这个,因为我已经把我能想象到的都做if判断了,但依然在报错...
No branches or pull requests
可不可以把那些可能为空的变量类型设为单一类型,由开发者自行判空呢?比如gameObject.parent,再比如egret3d.inputCollecter.getHoldKeys()...写一排if判空,只为能用一个值,有点...太闹心了...
我只是想取个键盘输入,但即便如此还是在报错...请问该用什么姿势才能取值呢?
The text was updated successfully, but these errors were encountered: