Hi All
I’m trying to update the .Percent of a SProgressBar in c++ using a getter bound to that attribute. Following the example here Slate data binding issue - Programming & Scripting - Unreal Engine Forums and How to set a slate attribute dynamically - C++ - Unreal Engine Forums so far I have:
FVASFVPluginEdModeToolkit.h
...
public:
...
TOptional<float> GetPercentage() const;
...
FVASFVPluginEdModeToolkit.cpp
...
SNew(SProgressBar)
.Percent(this, &FVASFVPluginEdModeToolkit::GetPercentage)
...
and later still in FVASFVPluginEdModeToolkit.cpp simply
TOptional<float> FVASFVPluginEdModeToolkit::GetPercentage() const
{
return 0.5f;
}
My code compiles fine but when I go to the editor plugin, UE4 crashes. The project log file only says:
[2016.03.07-16.35.18:547][305]LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
[2016.03.07-16.35.18:978][305]LogCrashTracker:
[2016.03.07-16.35.18:978][305]LogCrashTracker:
[2016.03.07-16.35.18:978][305]LogWindows:Error: === Critical error: ===
Assertion failed: SharedThis.Get() == this [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h] [Line: 1093]
[2016.03.07-16.35.19:037][305]LogExit: Executing StaticShutdownAfterError
If I remove the .Percent attribute then I can build without errors and can see my progress bar in the plugin UI. I’ve left out the rest of FVASFVPluginEdModeToolkit.cpp but can put it in pastebin if it’s important. I don’t understand what I’m doing differently from the linked example which would cause this error, please forgive my relative newness with c++!
Thanks for your help!