type' UnityEngine.Vector2'必须转换为System.Icomable< UnityEngine.Vector2>'将其用作参数' t'在通用类图中< t>
我不明白,我该如何解决这个问题?
I don't understand, How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您正在遇到 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>
, butGraph<T>
can only be used with generic types that implement theIComparable<T>
interface. This is probably because the implementation ofGraph
uses<
or>
to compare the value of two nodes of the graph.