Tencent / UnLua

A feature-rich, easy-learning and highly optimized Lua scripting plugin for UE.
Other
2.24k stars 612 forks source link

Failed to bind native function #153

Closed whoissunshijia closed 4 years ago

whoissunshijia commented 4 years ago
UINTERFACE(MinimalAPI)
class UITest: public UInterface
{
    GENERATED_BODY()
};
class GWORLD_API IITest
{
    GENERATED_BODY()
public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Test")
    void Process(float Deltime);
}

UCLASS()
class SERVERCONNECTOR_API AMyActor : public AActor,public IITest, public IUnLuaInterface
{
    GENERATED_BODY()

public: 
    // Sets default values for this actor's properties
    AMyActor();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

    virtual void Process_Implementation(float Deltime)override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;

};
void AMyActor::Process_Implementation(float Deltime)
{
    GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, FString("Process"));
}

C++中定义这个AMyActor类,如果这个时候在蓝图内创建一个BP继承这个AMyActor,再创建这个AMyActor的lua文件,去调用Process时,会出现Failed to bind native function错误.

rowechien commented 4 years ago

@whoissunshijia 按你的重现方法我本地试了以下,没有问题啊。 image image image image image

rowechien commented 4 years ago

@whoissunshijia 仔细翻了下代码,如果override某个带'native'标记的blueprint event,确实会有这个warning,但没有功能上的影响。fixed in fe32d98