unity3d - 在运行时设置 OnAutomaticHitTest 和 OnInteractiveHitTest
问题描述
我正在放置我的 Plane Stage 和 Plane Finder 并在运行时设置属性,但是有两个属性我不知道如何设置: OnAutomaticHitTest
和OnInteractiveHitTest
.
我看到它需要某种类型的东西HitTestEvent
,但我不知道如何在这里设置我的自定义函数。
有人能帮我吗?
解决方案
您可以在此处找到文档PlaneFinderBehaviour
本质上,您实际上并没有定义这些属性,而是使用它们来触发事件。
例如:
public class CustomPlaneFinderBehaviour : PlaneFinderBehaviour
{
public void CustomIntPerformHitTest(Vector2 screenPosition)
{
//Triggered on interactive hit test
}
public void CustomAutoPerformHitTest(Vector2 screenPosition)
{
//Triggered on automatic hit test
}
}
然后在检查器中,您可以通过按加号按钮并在框中选择当前脚本来定义事件。然后它为您提供更改被调用函数的选项。
此处已定义交互式命中测试,而自动命中测试尚未定义:
推荐阅读
- sql - Laravel:按月和年排序
- regex - 正则表达式仅在等于 / 时删除 URL 字符串中的最后一个字符
- android - 如何更改arcore sceneform中所选模型的颜色?我正在使用颜色选择器
- c# - Unity Xcode LowLevelCullingLoops.cpp 崩溃
- python - 在 matplotib 和 geopandas 中注释 xy 点
- neovim - NeoVim:在 :terminal 中运行命令后移动光标
- css - sass mixin 将参数作为 css 变量传递
- c - 映射 c 数组
- python - Python中的数据分配和范围问题
- python - 在 pyinstaller 可执行程序中找不到 Streamlit 分发