按钮函数在Unity中不可避免

发布于 2025-02-13 20:07:14 字数 261 浏览 2 评论 0原文

我进行了一些编辑,以进行蛇游戏,当玩家到达蛇头或梯子底部时,一个问题弹出。我设法出现了弹出问题,但找不到该功能,甚至无法搜索该功能。

“

我将按钮代码放在播放器移动后移动后的按钮代码下方蛇或梯子的底部。

我不允许以Unity分离其他按钮代码将按钮代码分开吗?

I made some edit to Snake&Ladder game where a question pop-up when player reach head of snake or bottom of the ladder. I manage to get the pop-up question appear but I can't find the function, not even the able to search the function.

Visual Studio snapshot showing that the button function is unavailable

I put the button code under transform position code when the player move after reach head of snake or bottom of the ladder.

Am I not allowed to separate button code from other button code in Unity?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七分※倦醒 2025-02-20 20:07:14

当程序运行到特定步骤时,如何使按钮无效或隐藏。

方法1:

command1.enabled = false按钮命令被禁用。

command1.visible = false按钮命令隐藏。

方法2:

//禁用

this.getComponent()。enabled = false;

//禁用和灰色

this.getComponent()。互动= false;

希望它对您有帮助。

How to make a button invalid or hide when the program runs to a certain step.

method 1:

Command1.Enabled = False button command is disabled.

Command1.Visible = False button command hidden.

Method 2:

//disable

this.GetComponent().enabled= false;

//disable and gray

this.GetComponent().interactable = false;

Hope it helps you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文