0
点赞
收藏
分享

微信扫一扫

UE5 binary '=': no operator found which takes a right-hand operand of type

问题

Error C2679 binary '=': no operator found which takes a right-hand operand of type 'const FVector2D' (or there is no acceptable conversion)


代码

CenterVertex.Position = Center;

Position和Center都是FVector2D类型

/**
 * A vector in 2-D space composed of components (X, Y) with floating point precision.
 * @note The full C++ class is located here: Engine\Source\Runtime\Core\Public\Math\Vector2D.h
 */
USTRUCT(immutable, noexport, BlueprintType, meta=(HasNativeMake="Engine.KismetMathLibrary.MakeVector2D", HasNativeBreak="Engine.KismetMathLibrary.BreakVector2D"))
struct FVector2D
{
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Vector2D, SaveGame)
	FLargeWorldCoordinatesReal X;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Vector2D, SaveGame)
	FLargeWorldCoordinatesReal Y;
};


解决

	CenterVertex.Position.X = Center.X;
	CenterVertex.Position.Y = Center.Y;


原因

目前编译器不支持结构体实例的复制,只能针对结构体的字段,逐一复制

举报

相关推荐

0 条评论