Editor crashes when using own C++ Blueprint

Hi,

I’m trying to get the version number, so that I can display it in my HUD.

Using one of the answer here showed me a yt-video that showed to add an own C++ Blueprint Class.

GetProjectVersion.h

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "GetProjectVersion.generated.h"

/**  *   */ UCLASS() class CLEMENTINEPA010_API UGetProjectVersion : public UBlueprintFunctionLibrary { 	GENERATED_BODY()
	 		UFUNCTION(BlueprintPure, meta = (FriendlyName = "Project Version", CompactNodeTitle = "ProjectVersion"), Category = "Project Information") 		static FString GetProjectVersion(); 		 };

GetProjectVersion.cpp

#include "MyProject.h"
#include "GetProjectVersion.h"

FString UGetProjectVersion::GetProjectVersion() { 	FString ProjectVersion; 	GConfig->GetString( 		TEXT("/Script/EngineSettings.GeneralProjectSettings"), 		TEXT("ProjectVersion"), 		ProjectVersion, 		GGameIni 		); 	return ProjectVersion; }

Any idea whats wrong with my code?
It build without warnings and errors in Visual 2015.

Many thanks.

Best,

Tigger

Binding:

Hello,

  • Could you please provide the crash logs from your project’s Saved->Logs folder?
  • Could you please cause the crash again, provide your Machine ID from the Crash Reporter window, and then hit send on the window? (Assuming that you are getting a crash reporter window).
  • Can you reproduce this crash in a clean project?
  • Do you have repro steps we can follow to reproduce the crash on our end?

Hi Sean!

many thanks for replying.

  • please find logs attached - please delete from this post when downloaded.

  • MachineId:32D6BE0A44013EBE99ABA892DC1E5C6A

  • no, not reproducible - as it works in a clean project.

  • but it seems there is an other problem in my project, as I’m not able to see the “new C++ Blueprint” in my right-click menu. (the “Get Version Number” in my picture above is the function itself - so no wonder that UE crashes…)

and:
the steps I did can be found here: Custom Blueprint Node, Return ProjectVersion - YouTube

So the new question is, why is my new C++ Blueprint not shown in my “All actions for this Blueprint” nor in “All Possible Actions”-right click?

Many thanks.

Best,

Tigger

As you can see in the clean project, it gives a warning and the C++ Blueprint has a different appearance than in my project.

nevertheless it works.

//strange//

Before you declare your function in your .h file, go ahead and add public:
to ensure that the function can be called in other blueprints. After I did this, I was able to get the version number using your function and print it to the screen without any issue.

Your final declaration should look like this:

public:

	UFUNCTION(BlueprintCallable, meta = (FriendlyName = "Project Version", CompactNodeTitle = "ProjectVersion"), Category = "Project Information")         
		static FString GetProjectVersion();

Dear Sean,

I did, but still not able to see this in my Project.

public:
		UFUNCTION(BlueprintPure, meta = (DisplayName = "Project Version", CompactNodeTitle = "ProjectVersion"), Category = "Project Information")
		static FString GetProjectVersion();	

(changed FriedlyName to DisplayName as well)

screen:

Did you try using the Project Version node instead, as you displayed in your picture above? When I used this, I was able to print out the correct version number after making the function Public.

Yes, same steps as in clean project.

  • right click
  • search for project version

but no display.
(In my clean project it was displayed without making public as well)

Any idea?

Did you try using BlueprintCallable instead of BlueprintPure as I used in my example?

Yes, (now) I tried.

Same result. :frowning:

had the same idea. … you got mail… :wink:

Could you please zip up your project and provide me with a link to Dropbox where I can download it? I’d like to take a closer look at it to see why our results aren’t matching up.

If you’d like to keep it private, you can send me the link in a PM on the forums: https://forums.unrealengine.com/member.php?160394-Sean-Flint

Thank you. When you have the project uploaded, please post a comment on this post so that I will be aware that you have sent the link.

Dear Sean,

project is uploaded, please feel free to download and help me with my errors. :slight_smile:

Many thanks! :slight_smile:

I have attempted to download the project, but it keeps giving me an error while I am trying to download it. Could you attempt to download it using the link you provided me and let me know if you are able to successfully do so? Thank you.

Hi,

I sent you another link, please try.

Many thanks.

Cheers!

Thank you, this link is now working. What blueprint am I looking in to attempt to reproduce your issue?

Hi,

glad that it worked.

main menu in project in directory: Level:

Content–>UI–>Menu :: MainMenu

and the used widget(where I can’t find the “ProjectVersion”): Widget:

Content–>UI–>Menu–>Widgets :: MainMenu

I can verify that I was not able to see the Project Version node in that blueprint. However, the version of the project that you sent me does not include the code you were using. Is there any way you could reupload a full version so I can see exactly what could be causing this issue in the code?