type' UnityEngine.Vector2'必须转换为System.Icomable< UnityEngine.Vector2>'将其用作参数' t'在通用类图中< t>

发布于 2025-02-03 19:47:15 字数 127 浏览 3 评论 0原文

错误消息

我不明白,我该如何解决这个问题?

error message

I don't understand, How can I solve this problem?

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

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

发布评论

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

评论(1

嗫嚅 2025-02-10 19:47:15

看来您正在遇到 c#中的通用类型参数的约束。

您正在尝试创建一个Graph< vector2>,但是Graph< t>只能与实现IComable< t> 接口。这可能是因为Graph的实现使用<>以比较图的两个节点的值。

It looks like you are running into an issue with constraints on generic type parameters in C#.

You are trying to create a Graph<Vector2>, but Graph<T> can only be used with generic types that implement the IComparable<T> interface. This is probably because the implementation of Graph uses < or > to compare the value of two nodes of the graph.

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