Hi !
I’ve a problem with my interface. I want to create a relation between IInteractableInterface and IInteractorInterface but when I call an interface in event, it doesn’t work. See below the code for more explanations.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Interface.h"
#include "InteractableInterface.generated.h"
class IInteractorInterface;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInteracted, IInteractorInterface*, Interactor);
// This class does not need to be modified.
UINTERFACE(MinimalAPI)
class UInteractableInterface : public UInterface
{
GENERATED_BODY()
};
/**
* Interactable interface
*/
class MYPROJECT_API IInteractableInterface
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Interactable | Event")
void OnInteracted(IInteractorInterface* Interactor);
virtual void OnInteracted_Implementation(IInteractorInterface* Interactor);
FOnInteracted OnInteractedDelegate;
};
My error message is this one.
CompilerResultsLog: Building 5 actions with 8 processes…
CompilerResultsLog: [1/5] Module.MyProject.gen.cpp
CompilerResultsLog: C:\Users\Jean-Baptiste\Documents\Unreal Projects\MyProject\Source\MyProject\Interactable/InteractableInterface.h(38) : error C2664: ‘void IInteractableInterface::OnInteracted_Implementation(IInteractorInterface *)’?: impossible de convertir l’argument 1 de ‘TScriptInterface<IInteractorInterface>’ en ‘IInteractorInterface *’
CompilerResultsLog: C:\Users\Jean-Baptiste\Documents\Unreal Projects\MyProject\Source\MyProject\Interactable/InteractableInterface.h(38): note: Aucun op?rateur de conversion d?finie par l’utilisateur disponible qui puisse effectuer cette conversion, ou l’op?rateur ne peut pas ?tre appel?
CompilerResultsLog: C:/Users/Jean-Baptiste/Documents/Unreal Projects/MyProject/Intermediate/Build/Win64/UE4Editor/Inc/MyProject/InteractableInterface.gen.cpp(57) : error C2511: ‘void IInteractableInterface::OnInteracted(const TScriptInterface<IInteractorInterface> &)’?: impossible de trouver la fonction membre surcharg?e dans ‘IInteractableInterface’
CompilerResultsLog: C:\Users\Jean-Baptiste\Documents\Unreal Projects\MyProject\Source\MyProject\Interactable/InteractableInterface.h(36): note: voir la d?claration de ‘IInteractableInterface’
CompilerResultsLog: C:/Users/Jean-Baptiste/Documents/Unreal Projects/MyProject/Intermediate/Build/Win64/UE4Editor/Inc/MyProject/InteractableInterface.gen.cpp(171) : error C2664: ‘void IInteractableInterface::OnInteracted_Implementation(IInteractorInterface *)’?: impossible de convertir l’argument 1 de ‘const TScriptInterface<IInteractorInterface>’ en
‘IInteractorInterface *’
CompilerResultsLog: C:/Users/Jean-Baptiste/Documents/Unreal Projects/MyProject/Intermediate/Build/Win64/UE4Editor/Inc/MyProject/InteractableInterface.gen.cpp(171): note: Aucun op?rateur de conversion d?finie par l’utilisateur disponible qui puisse effectuer cette conversion, ou l’op?rateur ne peut pas ?tre appel?
CompilerResultsLog: [2/5] Module.MyProject.cpp
CompilerResultsLog: C:\Users\Jean-Baptiste\Documents\Unreal Projects\MyProject\Source\MyProject\Interactable/InteractableInterface.h(38) : error C2664: ‘void IInteractableInterface::OnInteracted_Implementation(IInteractorInterface *)’?: impossible de convertir l’argument 1 de ‘TScriptInterface<IInteractorInterface>’ en ‘IInteractorInterface *’
CompilerResultsLog: C:\Users\Jean-Baptiste\Documents\Unreal Projects\MyProject\Source\MyProject\Interactable/InteractableInterface.h(38): note: Aucun op?rateur de conversion d?finie par l’utilisateur disponible qui puisse effectuer cette conversion, ou l’op?rateur ne peut pas ?tre appel?
Has anybody an issue ?