Help with OnTriggerEntered + Canvas UI

发布时间:2026-01-18 23:34

使用Canvas进行在线项目管理 #生活技巧# #工作学习技巧# #在线教育平台#

This seems like it should be incredibly easy and I know there are other posts out there with a similar title, but I promise you I have looked at all of them. All I want is for my canvas that simply says "you win" to appear when I enter an invisible box collider that I have . My canvas is by default set to disabled.

public class YouWin : MonoBehaviour { public Canvas myCanvas; private void Start() { myCanvas = GetComponent<Canvas>(); } void OnTriggerEnter (Collision Collider) { { myCanvas.gameObject.SetActive(true); } }

This script seems incredibly simple and straightforward, but for whatever reason, when I enter my box, nothing at all happens. Why might this be? What am I missing?

As per an answer I also tried

public class YouWin : MonoBehaviour { public GameObject canvas; void OnTriggerEnter (Collider Collider) { { canvas.gameObject.SetActive(true); } }

But had no luck with this either. I've been tinkering to no avail, can you please give me some suggestions?

网址:Help with OnTriggerEntered + Canvas UI https://klqsh.com/news/view/321207

相关内容

Get help with your Microsoft account
How to Get Help with File Explorer in Windows 11/10
Get Help With File Explorer in Windows 11 & 10 (Ultimate Guide)
Get Help with File Explorer in Windows 11
Remove Background Noise with AI in 10 Minutes
10 Ways to Get Help in Windows 11
How To Get Help In Windows 11 (All Methods)
Windows help and learning
Starbucks Help
Microsoft Edge help & learning

随便看看