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"

Function returning false in blueprint

I'm experimenting with creating my own custom blueprints, and I hit upon something I can't explain.

I create a class with extended UBlueprintFunctionLibrary, make the UFUNCTION for my function BlueprintCallable. The function is just returning a bool true every time.

However when I get into the blueprints, and actually put my function out on the graph, set target to my class and print the result, it always returns false. I have no idea what the problem could be because there's no way my function can even return false.

I'm stuck thinking it's something with how I get an object of my class and that it thinks it's an object of the class but it's actually not or something like that.

 UCLASS(Blueprintable) //Uclass
 UFUNCTION(BlueprintCallable, Category = "Test") //My function



 UFUNCTION(BlueprintCallable, Category = "UDP Networking")
 bool ConnectToServer(int32 port);

 bool UGameServer::ConnectToServer(int32 port)
 {
 
     
     FString address = TEXT("127.0.0.1");
 
     TSharedRef < FInternetAddr > addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
     FIPv4Address ip;
     FIPv4Address::Parse(address, ip);
 
     addr->SetIp(ip.GetValue());
     addr->SetPort(port);
     //bool connected = Socket->Connect(*addr);
     //Socket->Bind(*addr);
     Socket = FUdpSocketBuilder(TEXT("default"))
         .AsNonBlocking()
         .AsReusable()
         .BoundToAddress(ip)
         .BoundToPort(port);
 
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::FromInt(port));
     GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, Socket ? TEXT("trueee") : TEXT("falseee"));
     if (Socket)
     {
         return true;
     }
     else
     {
         return true;
     }
     return true;
 }
Product Version: Not Selected
Tags:
more ▼

asked Feb 19 '15 at 05:38 PM in C++ Programming

avatar image

Netzone
6 2 4 7

avatar image Lojo Feb 19 '15 at 08:51 PM

Can you post the signature of your function?

avatar image Netzone Feb 22 '15 at 04:19 PM

Code apparently didn't like being in comments, I'll put it in the topic instead.

(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