x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

TSubclassOf IInterface type argument error

I'm having a weird error here that I can't figure out. I'm trying to pass a TSubclassOf type argument to a function, but I'm getting weird errors.

Header:

 UFUNCTION(BlueprintCallable, Server, WithValidation, Reliable, Category = "Test")
 void SpawnBlockServer(AActor* gridActor, FTransform transform, TSubclassOf<IBuildingBlock> blockClass);

Cpp:

 bool ATestCharacter::SpawnBlockServer_Validate(AActor* gridActor, FTransform transform, TSubclassOf<IBuildingBlock> blockClass) { return true; };
 void ATestCharacter::SpawnBlockServer_Implementation(AActor* gridActor, FTransform transform, TSubclassOf<IBuildingBlock> blockClass) {...}

Compiler log:

 Error x:\games\epic games\4.13\engine\source\runtime\coreuobject\public\uobject\UObject.h(745) : note: see declaration of 'UObject::FindFunctionChecked'
 Error X:\Unreal projects\Project 4.13\Source\Project\Characters\TestCharacter.cpp(125) : error C2511: 'bool ATestCharacter::SpawnBlockServer_Validate(AActor *,FTransform,TSubclassOf<IBuildingBlock>)': overloaded member function not found in 'ATestCharacter'
 Error x:\unreal projects\project 4.13\source\project\characters\TestCharacter.h(15) : note: see declaration of 'ATestCharacter'
 Error X:\Unreal projects\Project 4.13\Source\Project\Characters\TestCharacter.cpp(127) : error C2511: 'void ATestCharacter::SpawnBlockServer_Implementation(AActor *,FTransform,TSubclassOf<IBuildingBlock>)': overloaded member function not found in 'ATestCharacter'
 Error x:\unreal projects\project 4.13\source\project\characters\TestCharacter.h(15) : note: see declaration of 'ATestCharacter'
 Info BaseGameMode.cpp
 Error X:\Unreal projects\Project 4.13\Intermediate\Build\Win64\UE4Editor\Inc\Project\Project.generated.cpp(473) : error C2511: 'void ATestCharacter::SpawnBlockServer(AActor *,FTransform,TSubclassOf<UBuildingBlock>)': overloaded member function not found in 'ATestCharacter'
 Error X:\Unreal projects\Project 4.13\Source\Project\Characters/TestCharacter.h(15) : note: see declaration of 'ATestCharacter'
 Error X:\Unreal projects\Project 4.13\Intermediate\Build\Win64\UE4Editor\Inc\Project\Project.generated.cpp(478) : error C2352: 'UObject::FindFunctionChecked': illegal call of non-static member function

It doesn't seem to find the function for some reason, but it works fine if I replace IBuildingBlock with UBuildingBlock like this: Header:

 UFUNCTION(BlueprintCallable, Server, WithValidation, Reliable, Category = "Test")
 void SpawnBlockServer(AActor* gridActor, FTransform transform, TSubclassOf<UBuildingBlock> blockClass);

Cpp:

 bool ATestCharacter::SpawnBlockServer_Validate(AActor* gridActor, FTransform transform, TSubclassOf<UBuildingBlock> blockClass) { return true; };
 void ATestCharacter::SpawnBlockServer_Implementation(AActor* gridActor, FTransform transform, TSubclassOf<UBuildingBlock> blockClass) {...}

Does anyone know what I'm doing wrong?

Product Version: UE 4.13
Tags:
more ▼

asked Jan 08 '17 at 01:08 PM in C++ Programming

avatar image

AdamBors
106 2 4 9

avatar image AdamBors Jan 15 '17 at 05:17 PM

Any ideas?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question