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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

How to override C++ function in Blueprint?

There is some function, which I gonna to override in Blueprint

.h file:

 UFUNCTION(BlueprintCallable, Category = RemoteServer)
 virtual void ServerMsg(const FString& msg);

.cpp file:

 void UCrazyRacingGameInstance::ServerMsg(const FString& msg)
      PRINT("Server message: %s", *msg);

This function will be called by CallFunctionByNameWithArguments method and using BlueprintNativeEvent is improperly.

If I try to define ServerMsg function in blueprint, I got the message:

 Error: The function name in node Server Msg is already used
 Error: Cannot override '::ServerMsg' at Server Msg which declarated in a parent with a different signature!

How to override this function? Help me please :)

alt text

Product Version: UE 4.8
pic.png (184.4 kB)
more ▼

asked Aug 02 '15 at 04:45 PM in C++ Programming

avatar image

559 44 63 91

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

2 answers: sort voted first

You can declare UFUNCTION() functions as virtual. However you can not override them inside blueprints. Only inside other C++ classes. You probably already seen that you can not see the function you declared virtual, inside blueprint editors overridable functions list.

If you want to override a function inside blueprints, you will need to use BlueprintNativeEvent or BlueprintImplementableEvent as UFUNCTION() specifiers.

more ▼

answered Aug 02 '15 at 06:15 PM

avatar image

186 26 25 36

avatar image broly Aug 02 '15 at 06:20 PM

But method CallFunctionByNameWithArguments is not applicable to Events. Are there analogs of this method? Or this method may be used too?

Just I don't want to increase function count in C++ code for one action.

avatar image Corpse0327 Aug 02 '15 at 06:24 PM

I am not familiar with that function and it seems DOC has very little information.

Instead of function can you tell what you are trying to do? Maybe i can suggest some other approach.

avatar image broly Aug 02 '15 at 06:35 PM

I use my server for remote function calling CLIENT <--> SERVER At case CLIENT -> SERVER call I just use defined method name in C++ and place the string with the method and parameters to CallFunctionByNameWithArguments for implicit call. But in future I think realisation can be moved also in blueprints for more extensibility.

avatar image Corpse0327 Aug 02 '15 at 06:54 PM

As far as i understand, you are trying to call a function ?server has access to? from client computer. I am not experienced with networking so i cannot be of much help.

Maybe by using replication you can achieve the same effect or you can post another question regarding possible different approaches to this.

avatar image broly Aug 03 '15 at 05:45 AM

This is not UE4 server. This is remote manager for some controls.

Problem soloved. Events also can be called too by CallFunctionByNameWithArguments. Thank you for attention :)

avatar image broly Aug 05 '15 at 12:22 PM

FindFunction and ProcessEvent is nice things too:)

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

I'm afraid that you can't declare UFUNCTIONs as virtual. At least that's what I can tell by experience.

more ▼

answered Aug 02 '15 at 05:51 PM

avatar image

138 10 11 26

avatar image broly Aug 02 '15 at 06:08 PM

But compiled successfully. virtual or not virtual it makes no difference.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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