Download

Unable to declare TScriptInterface<const InterfaceClassNameGoesHere> function parameter.

I’m making an interface with the following source code:



#pragma once

#include "WRTeamInterface.generated.h"

UINTERFACE(BlueprintType)
class UWRTeamInterface : public UInterface
{
	GENERATED_UINTERFACE_BODY()
};

class WRAITH_API IWRTeamInterface
{
	GENERATED_IINTERFACE_BODY()
	
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Team")
	bool IsFriendlyToAll() const;

        //This fails---------------------------------
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Team")
	bool IsFriendlyToTeam(const TScriptInterface<const IWRTeamInterface>& Team) const;

	UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Team")
	uint8 GetTeam() const;
};


However UHT seems to ignore the const and generates the following internal code in the .generated files. I normally never look at this but this results in my code not compiling.



bool IWRTeamInterface::IsFriendlyToTeam(TScriptInterface<IWRTeamInterface> const& Team) const
	{
		check(0 && "Do not directly call Event functions in Interfaces. Call Execute_IsFriendlyToTeam instead.");
		WRTeamInterface_eventIsFriendlyToTeam_Parms Parms;
		return Parms.ReturnValue;
	}




2>F:\Code\UnrealEngineProj\Wraith\Intermediate\Build\Win64\UE4Editor\Inc\Wraith\Wraith.generated.1.cpp(3290): error C2511: 'bool IWRTeamInterface::IsFriendlyToTeam(const TScriptInterface<IWRTeamInterface> &) const': overloaded member function not found in 'IWRTeamInterface'
2>  F:\Code\UnrealEngineProj\Wraith\Source\Wraith\Public/Gameplay/WRTeamInterface.h(12): note: see declaration of 'IWRTeamInterface'


Got any solution?