C++ 是否有任何方法可以使用BindAction()从模板类调用函数?
我正在尝试在我的游戏中实现武器功能,现在我正在尝试绑定我的射击和重新加载事件。虽然我有点麻烦 目前,我有一个名为currentwarm的模板类变量C++ 是否有任何方法可以使用BindAction()从模板类调用函数?,c++,unreal-engine4,C++,Unreal Engine4,我正在尝试在我的游戏中实现武器功能,现在我正在尝试绑定我的射击和重新加载事件。虽然我有点麻烦 目前,我有一个名为currentwarm的模板类变量 // Stores the current player weapon UPROPERTY(EditAnywhere) TSubclassOf<ALTWeapon> CurrentWeapon; 关键是那件武器空的 我现在要做的是使用template类在SetupPlayerInputComponent()函数中绑定fi
// Stores the current player weapon
UPROPERTY(EditAnywhere)
TSubclassOf<ALTWeapon> CurrentWeapon;
关键是那件武器空的
我现在要做的是使用template类在SetupPlayerInputComponent()函数中绑定fire并重新加载输入事件。我目前正在这样做:
PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &CurrentWeapon::OnFire);
PlayerInputComponent->BindAction("Reload", IE_Pressed, this, &CurrentWeapon::OnReload);
这段代码没有编译,因为我没有正确使用BindAction函数参数。我的主要问题是,是否有一种方法可以让编译器引用currentWearm中存储的类,然后访问该类中的函数
我发现以下编译错误:
“currentwarm”:不是类或命名空间名称
“&”:对绑定成员函数表达式执行非法操作
“UIInputComponent::BindAction”:未找到匹配的重载函数
我真的很抱歉我没有正确的术语,如果有人需要我进一步解释,我很乐意 您的编译错误是什么?@N.Shead我收到了这些编译错误:“current武器”:不是类或命名空间名称“&”:绑定成员函数表达式“UInputComponent::BindAction”上的非法操作:未找到匹配的重载函数
PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &CurrentWeapon::OnFire);
PlayerInputComponent->BindAction("Reload", IE_Pressed, this, &CurrentWeapon::OnReload);