Code Monkey home page Code Monkey logo

usharp's Introduction

USharp

USharp is a plugin for Unreal Engine (4.23) which allows for programming in C#.

This project adapts various parts of mono-ue https://mono-ue.github.io/ and is roughly similar but has support for Mono, .NET Framework and .NET Core. The C++ code used is mostly PInvoke methods and the equivalent mono-ue backend code is mostly written in C#.

This project currently isn't usable for most use cases. There are a lot of bugs and lacking features. Check back soon for updates!

Join the gitter chat room for quick help / discussion https://gitter.im/USharp/Lobby

Features

  • Write C# using UObject exposed types (AActor, AGameMode, UActorComponent, etc). Define new UObject types and inherit existing ones. Exposed C# types can then be used in (or extended by) Blueprint.
  • Access to Unreal's reflection system (UClass, UFunction, UProperty, etc).
  • Hotreload
  • Dynamically switch between .NET Framework, .NET Core and Mono for an improved debugging / runtime experience without having to reopen the editor
  • Supports Windows, Mac and Linux

Plugin Setup

See the wiki on how to setup the plugin

Issues / caveats

  • This project depends on a lot of PInvoked functions which could potentially behave differently on different C++ compilers. This project may not work on some target platforms.
  • Like mono-ue this project depends on lots of generated code and IL weaving. It probably isn't the best for performance and there is a huge amount of generated code everywhere.
  • The weaved IL currently seems to break edit-and-continue debugging (issue with cecil?)
  • There is currently too much marshaling on structs / collections (list, map, set). Marshaling needs to be redesigned to avoid copies of entire collections / structs on trivial calls between C# / native code. Additionally marshaling of delegates needs to be redesigned (various issues such as being referenced as a copy of the delegate).

Why does this project exist? Why wasn't this instead contributions to mono-ue? Originally this project was just a way to access the UObject system from C# and ended up basically being a copy of mono-ue. The mono-ue compile times / debugging process made it hard to contribute starting with little knowledge of Unreal.

usharp's People

Contributors

algorithman avatar fjays avatar iainmckay avatar pixeltris avatar rob-ack avatar tanner555 avatar timschneiderwb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usharp's Issues

Losing reference to C# class when restarting UE4

If you use a C# class in ue4's instanced object (like if I were to make a UAnimNotifyState class in C# and reference it in an AnimSequence or AnimMontage), save and close the editor, next time you open it, the reference is lost, the message log will says something akin to:
image

Any idea if its something on my end? or a known issue? or an unresolvable issue?

Restart of editor required after changing a property while fixing a null reference

Steps to produce:

  1. Add a blueprint exposed property and initialize it:
[UProperty, EditAnywhere, BlueprintReadWrite]
public UCameraComponent Camera { get; set; }

public override void Initialize(FObjectInitializer initializer)
{
    base.Initialize(initializer);

    Camera = initializer.CreateDefaultSubobject<UCameraComponent>(this, new FName("Camera"));
}
  1. Compile it and hot-reload. You'll see your property as expected
  2. Cause an exception in Initialize
public override void Initialize(FObjectInitializer initializer)
{
    base.Initialize(initializer);

    Camera = initializer.CreateDefaultSubobject<UCameraComponent>(this, new FName("Camera"));

    UCameraComponent y = null;
    FMessage.Log(y.ToString());
}
  1. Now fix the null reference and rename Camera to Camera2 before recompiling.

The editor now won't pick up that Camera was renamed and you need to restart the editor to fix it. This is a contrived example but you can see how you can introduce exceptions while working. Then while fixing the problem; rethink how you implemented something, causing you to rename one or properties.

If you fix the null reference, hot-reload, THEN change Camera to Camera2 it works as expected.

"Edit and Continue" debugging

AssemblyRewriter / cecil seems to break edit and continue debugging. This happens even in the simplest setup with cecil. See the attached project to test this.

  • Compile the project.
  • Run CecilTest. See that the output is "Hello from IAmVisible!". You can also "edit and continue" debug this program.
  • Run Rewriter and then run CecilTest again. See that the output is "Hello from IAmHidden!" and "Hello from IAmVisible!". "Edit and continue" debugging will no longer work.

CecilIssue.zip

Hotreload on Mac (Mono) is broken

Hotreload works by using FileSystemWatcher to watch for changes made to the C# game dll. Mono uses a libmono-native-compat.dylib to implement some of this functionality. Currently it crashes when trying to load the dylib (fails to find a symbol in the dyld_stub_binder call?). This is possibly due to a bad configuration of the embedded Mono. I have had this issue previously but it looks like the .dylib files have possibly been shuffled around so I'm no longer sure what the solution is.

For now use .NET Core if you want to hotreload. Or hotreload manually using the USharpRuntime reload command in the UE4 command box.

AActor HelloWorld Example documentation

Documentation on a simple helloWorld application using AActors would be useful in the wiki under "writing c# game code" would be very welcome. Please close this item if you feel this is irrelevant to current development.

Some properties are overwritten by the old CDO on reinstancing

[UClass, Blueprintable, BlueprintType]
public class SharpActor : AActor
{
	[UProperty, EditAnywhere, BlueprintReadWrite]
	public int SomeValue { get; set; }
	
	public override void Initialize(FObjectInitializer initializer)
	{
		SomeValue = 10;
		AllowTickBeforeBeginPlay = true;
	}
}
  • Create the above C# actor.
  • Create a blueprint which parents that class.
  • Reopen the editor to get a clean state.
  • Open the blueprint editor it should have SomeValue as 10 and AllowTickBeforeBeginPlay should be true (checked).

In the C# code change SomeValue to 5 and AllowTickBeforeBeginPlay to false and then recompile the C# code so that it hotreloads. The blueprint will correctly update SomeValue to 5 (unless it has been changed in the details panel to be non-default, which is again correct behavior). However, AllowTickBeforeBeginPlay will still show as being true and will now have the yellow icon/button next to to signify it is no longer the default value. This is incorrect. AllowTickBeforeBeginPlay should now be false and there shouldn't be any default value modified signifier.

This issue stems from the object reinstancing code. Property values from the old CDO are copied over to the new CDO. This occurs in UEngine::CopyPropertiesForUnrelatedObjects.

Look into what determines which values should be copied over, we may need to do custom re-instancing to filter out copying of values which are set to default?

Callstack for the property copy on child blueprints (this happens first):

UE4Editor-Engine.dll!UEngine::CopyPropertiesForUnrelatedObjects(UObject * OldObject, UObject * NewObject, UEngine::FCopyPropertiesForUnrelatedObjectsParams Params) Line 13491	C++
UE4Editor-UnrealEd.dll!ReplaceActorHelper(UObject * OldObject, UClass * OldClass, UObject * & NewUObject, UClass * NewClass, TMap<UObject *,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UObject *,UObject *,0> > & OldToNewInstanceMap, TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0> > & InOldToNewClassMap, AActor * OldActor, TMap<FSoftObjectPath,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FSoftObjectPath,UObject *,0> > & ReinstancedObjectsWeakReferenceMap, TMap<UObject *,FActorAttachmentData,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UObject *,FActorAttachmentData,0> > & ActorAttachmentData, TArray<FActorReplacementHelper,FDefaultAllocator> & ReplacementActors, bool bPreserveRootComponent, bool & bSelectionChanged) Line 1816	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner(TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0> > & InOldToNewClassMap, UObject * InOriginalCDO, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, bool bClassObjectReplaced, bool bPreserveRootComponent, bool bArchetypesAreUpToDate) Line 2013	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::BatchReplaceInstancesOfClass(TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0> > & InOldToNewClassMap, bool bArchetypesAreUpToDate) Line 1471	C++
UE4Editor-Kismet.dll!FBlueprintCompilationManagerImpl::FlushReinstancingQueueImpl() Line 1085	C++
UE4Editor-Kismet.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl(const FBPCompileRequest & Request) Line 203	C++
UE4Editor-UnrealEd.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, EBlueprintCompileOptions CompileFlags, FCompilerResultsLog * pResults) Line 745	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::CompileChildren() Line 603	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReinstanceObjects(bool bForceAlwaysReinstance) Line 737	C++
UE4Editor-USharp.dll!Export_SharpHotReloadUtils_ReinstanceClass(FSharpHotReloadClassReinstancer * Reinstancer) Line 45	C++
[Managed to Native Transition]	
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.ManagedUnrealTypes.BuildTypes() Line 907	C#
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.ManagedUnrealTypes.Load() Line 63	C#
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.Native.NativeFunctions.OnNativeFunctionsRegistered() Line 189	C#
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.Native.NativeFunctions.RegisterFunctions(System.IntPtr registerFunctionsAddr) Line 99	C#
UnrealEngine.Runtime.dll!UnrealEngine.EntryPoint.DllMain(string arg) Line 70	C#
[Native to Managed Transition]	
[Managed to Native Transition]	
Loader.dll!UnrealEngine.AssemblyLoader.Load() Line 475	C#
[AppDomain (DefaultDomain�, #1) -> AppDomain (Domain30654212 4�, #6)]	
Loader.dll!UnrealEngine.EntryPoint.ReloadAppDomain() Line 249	C#
Loader.dll!UnrealEngine.EntryPoint.ReloadAppDomain.AnonymousMethod__0() Line 195	C#
Loader.dll!UnrealEngine.GameThreadHelper.Tick(float deltaTime) Line 672	C#
[Native to Managed Transition]	
UE4Editor-USharp.dll!FTickerDelegateWrapper::Tick(float DeltaTime) Line 9	C++
UE4Editor-Core.dll!FTicker::Tick(float DeltaTime) Line 98	C++
UE4Editor.exe!FEngineLoop::Tick() Line 3669	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 166	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 209	C++
UE4Editor.exe!__scrt_common_main_seh() Line 283	C++
kernel32.dll!00000000778b59cd()	Unknown
ntdll.dll!0000000077a1385d()	Unknown

Callstack for the property copy on instanced objects in the world which can also be instanced C# actors as opposed to blueprint which also exhibit the same issues:

UE4Editor-Engine.dll!UEngine::CopyPropertiesForUnrelatedObjects(UObject * OldObject, UObject * NewObject, UEngine::FCopyPropertiesForUnrelatedObjectsParams Params) Line 13491	C++
UE4Editor-UnrealEd.dll!ReplaceActorHelper(UObject * OldObject, UClass * OldClass, UObject * & NewUObject, UClass * NewClass, TMap<UObject *,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UObject *,UObject *,0> > & OldToNewInstanceMap, TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0> > & InOldToNewClassMap, AActor * OldActor, TMap<FSoftObjectPath,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FSoftObjectPath,UObject *,0> > & ReinstancedObjectsWeakReferenceMap, TMap<UObject *,FActorAttachmentData,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UObject *,FActorAttachmentData,0> > & ActorAttachmentData, TArray<FActorReplacementHelper,FDefaultAllocator> & ReplacementActors, bool bPreserveRootComponent, bool & bSelectionChanged) Line 1816	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner(TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0> > & InOldToNewClassMap, UObject * InOriginalCDO, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, bool bClassObjectReplaced, bool bPreserveRootComponent, bool bArchetypesAreUpToDate) Line 2013	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass(UClass * OldClass, UClass * NewClass, UObject * OriginalCDO, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, bool bClassObjectReplaced, bool bPreserveRootComponent) Line 1460	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReinstanceInner(bool bForceAlwaysReinstance) Line 660	C++
UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReinstanceObjects(bool bForceAlwaysReinstance) Line 904	C++
UE4Editor-USharp.dll!Export_SharpHotReloadUtils_ReinstanceClass(FSharpHotReloadClassReinstancer * Reinstancer) Line 45	C++
[Managed to Native Transition]	
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.ManagedUnrealTypes.BuildTypes() Line 907	C#
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.ManagedUnrealTypes.Load() Line 63	C#
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.Native.NativeFunctions.OnNativeFunctionsRegistered() Line 189	C#
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.Native.NativeFunctions.RegisterFunctions(System.IntPtr registerFunctionsAddr) Line 99	C#
UnrealEngine.Runtime.dll!UnrealEngine.EntryPoint.DllMain(string arg) Line 70	C#
[Native to Managed Transition]	
[Managed to Native Transition]	
Loader.dll!UnrealEngine.AssemblyLoader.Load() Line 475	C#
[AppDomain (DefaultDomain�, #1) -> AppDomain (Domain30654212 4�, #6)]	
Loader.dll!UnrealEngine.EntryPoint.ReloadAppDomain() Line 249	C#
Loader.dll!UnrealEngine.EntryPoint.ReloadAppDomain.AnonymousMethod__0() Line 195	C#
Loader.dll!UnrealEngine.GameThreadHelper.Tick(float deltaTime) Line 672	C#
[Native to Managed Transition]	
UE4Editor-USharp.dll!FTickerDelegateWrapper::Tick(float DeltaTime) Line 9	C++
UE4Editor-Core.dll!FTicker::Tick(float DeltaTime) Line 98	C++
UE4Editor.exe!FEngineLoop::Tick() Line 3669	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 166	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 209	C++
UE4Editor.exe!__scrt_common_main_seh() Line 283	C++
kernel32.dll!00000000778b59cd()	Unknown
ntdll.dll!0000000077a1385d()	Unknown

No way to Broadcast FMulticastDelegates

There was a great example of how to create a blueprint callable FMulticastDelegate in the examples section. Unfortunately you can't call this FMulticastDelegate in c#. That's because there is currently no Broadcast binding in the generated class. I'm sure it's easy enough calling it from blueprints, but I should be able to call it from c# just as easily.

public class GeneralDelegateHandler : FMulticastDelegate<GeneralDelegateHandler.Signature>
{
    public delegate void Signature();
}

[UProperty(PropFlags.BlueprintCallable | PropFlags.BlueprintAssignable), EditAnywhere, BlueprintReadWrite]
public GeneralDelegateHandler BowlTurnIsFinished { get; set; }

I currently just use c# events and delegates, but that would be nice if there was a c# binding for Broadcast. I don't think this would work.

if (BowlTurnIsFinished.IsBound)
{
    BowlTurnIsFinished.Invoke();
}

Maybe it would, I haven't tried it. Someone can comment if they found a way to broadcast from c#.

Create an automated GameSolution.sln generator step

Project looks promising. 👍
To me it looks like you choose to do the heavy lifting in the managed code. Which is the best choice from my point of view.

From what i have seen so far there is no automated GameSolution.sln generator step at the moment.
Is this correct???
I think it needs to be build soon to speed up the progress of the project. Is there anything going on here.
If not lets talk about the strategy to build one.

I suggest the following steps:

  • Add a sln generation step in the c# codebase (UnrealEngine.Runtime).
  • Add one template version of the solution/project needed when building a game dll to the repository containing the bare minimum example of c# code and all necessary settings including the post process steps.
  • Add c# MSBuild SDK files to support MSBuild environment variables to the project file and a minimum project configuration to the project. It will contain the configuration including output path and post process steps as well as defines and anything we might need.
    It is easy to read and write and will enable us to generate VS settings without the need to modify the project/solution template at all. (do not over complicate it with an SDK resolver or other complicated stuff until it is definitive necessary. keep it simple and effective)
  • Add unit test so we know when it breaks.

Maybe that i can help building it (since i have a bare minimum concept in place)!

[Feature Request] Add Ability To Generate C# Project For Projects Not Using Templates

Before the new templates update, USharp would automatically add a Managed Folder to your project when you had the plugin enabled. Now it seems like the plugin is enabled by default, and 2 new C# starter templates have been added. But for those who want to add C# Code to an existing project (that hasn't been added to yet), it'll be a big hassle for them. I'd suggest creating a USharp command that'll generate all the needed files and put them into a Managed folder, just like before. This will make life a lot easier for those who want to add USharp to an existing project.

Mixed mode (C#/C++) callstack on unhandled exceptions

If an unhandled exception occurs the crash reporter is invoked which displays the callstack info. This callstack doesn't include C# frames (and trashes the topmost C++ frames) which can make that callstack info basically useless.

To get the full callstack we need the FGenericPlatformCrashContext / FGenericPlatformStackWalk classes (and their platform specific equivalents) to have callbacks so we can implement a custom stack walker. There currently aren't any suitable callbacks available which would mean we would need several function hooks per platform if we wanted to implement this without modifying the engine source.

Even if there were callbacks available, the implementation wouldn't be trivial as we have to support .NET Framework, .NET Core and Mono on at least Windows, Mac and Linux. Each platform has a different way of getting the callstack and on top of that each platform may have several different ways of getting the callstack depending on requirements (e.g. RtlCaptureStackBackTrace has issues on functions outside of known modules which doesn't work well with JITed functions). There are also issues with calling convention differences between X86 and X64 which again increases the likelihood that the APIs we need to use would be different between architectures.

.NET Framework / Windows solution

On .NET Framework (and possibly .NET Core) under Windows there is an API for getting mixed mode callstack info using CLRDataCreateInstance / ICLRDataTarget and associated functions. This might be one easy-ish way of getting the full callstack.

https://github.com/dotnet/coreclr/blob/master/src/debug/createdump/crashinfo.cpp
https://www.codeproject.com/Articles/371137/A-Mixed-Mode-Stackwalk-with-the-IDebugClient-Inter
http://blog.steveniemitz.com/building-a-mixed-mode-stack-walker-part-1/

There is also some useful information here for getting raw callstack info (this would still need to be paired with something to get the C# function names). https://stackoverflow.com/questions/34501602/fast-capture-stack-trace-on-windows-64-bit-mixed-mode

Generic solution

One possible way of dealing with it could be a stack walker similar to the one in Unreal Engine (which might have to be modified / completely manual if there are platforms which don't have APIs capable of walking functions outside of well known modules (JITed functions)).

Once we have the raw callstack addresses we can use the regular symbol lookup functions in conjunction with C# function lookup via reflection (non generic functions only). This reflection based lookup would use MethodInfo.MethodHandle.GetFunctionPointer() to create some crude managed function table lookup without having to look inside the .NET Framework, .NET Core or Mono internals. This might need to be combined with a simpler dissembler such as hde32 / hde64 to determine function length.

Temporary solution

Calls such as FMessage.Log(ELogVerbosity.Fatal, "error"); crash UE4, trash the callstack and cannot be handled by AppDomain.CurrentDomain.UnhandledException to print out the C# callstack. try/catch blocks in C# seem to work (when not debugging) so try/catch blocks should be where possible until we have better exception handling. Log the C# callstack somewhere and then somehow invoke the crash reporter (this could be done by setting GIsCriticalError to false and then causing another fatal error without a C# try/catch block).

NOTE: As far as I'm aware there isn't any way to provide useful information to the crash reporter. UE_LOG fatal seems to put the error message all on one line which isn't good for outputting the C# callstack. There is NewReportEnsure but after the first try/catch that function doesn't seem to work. Maybe just use the C# FMessage.OpenDialog() method.

Missing binding for some methods

Hello,

I'm trying to convert some C++ code to C#. It's for testing purpose only. I noticed few changes from C++ to C# as well as some missing methods or properties. This is my code, comments indicates the missing property or method.

public override void Initialize(FObjectInitializer initializer)
{
	base.Initialize(initializer);

	VROrigin = initializer.CreateDefaultSubobject<USceneComponent>(this, new FName("VROrigin"));
	//VROrigin.SetupAttachment(RootComponent);
	VROrigin.SetRelativeLocation(new FVector(0.0f, 0.0f, 80.0f), false, out FHitResult sr, false);

	MainCamera = initializer.CreateDefaultSubobject<UCameraComponent>(this, new FName("MainCamera"));
	//MainCamera.SetupAttachment(VROrigin);

	UIWidgetInteraction = initializer.CreateDefaultSubobject<UWidgetInteractionComponent>(this, new FName("UIWidgetInteraction"));
	//MainCamera.SetupAttachment(MainCamera);

	SetupMotionController(initializer, true);
	SetupMotionController(initializer, false);

	ForwardVRMode = ForwardVRMode.Pawn;

	//PrimaryActorTick.CanEverTick = true;
}

private void SetupMotionController(FObjectInitializer initializer, bool left)
{
	var mc = initializer.CreateDefaultSubobject<UMotionControllerComponent>(this, new FName(left ? "LeftHand" : "RightHand"));
	//mc.SetupAttachment(VROrigin);
	//mc.SetTrackingSource(ControllerHand.Right);
	mc.SetTrackingMotionSource(left ? new FName("Left") : new FName("Right"));
	mc.SetRelativeLocation(new FVector(36.0f, left ? -20.0f : 20.0f, -26.0f), false, out FHitResult sr, false);
}

How can we add those missing methods? Maybe I can try to add some of them? If you give me a starting point?

Managed dll files not generating

Can't resolve UnrealEngine.Runtime.dll / UnrealEngine.dll references when Editor opens after running PluginInstaller steps in wiki:

  • PluginInstaller type the buildcpp command to compile the C++ code
  • In PluginInstaller type the copyruntime all

Not possible to add references to /USharp/Binaries/Managed as no folder is created from above steps. It may be that simply clarifying the steps in the wiki will help resolve this.

crash when overriding some of my C++ native event and blueprint implementable event

When I override some method in my C++ classes the CS part crash (well tbh it crash the entire
editor/project) saying this:
image

then this:

image

is this a known issue, am i doing something wrong

here's the C# version of the method:
protected override void Restart_Implementation( ) { base.Restart_Implementation( ); AbilitySystem.RefreshAbilityActorInfo( ); }

here's the CPP signature:
UFUNCTION(BlueprintImplementableEvent) void K2_Restart( );

Cannot Bind Input From C#

Right now, Pawns don't have bindings for the overridable BindInput method. Also the input class that makes binding possible doesn't have bindings either. This makes it impossible to bind input from c# currently. I currently create a wrapper ufunction in my c#, and call it from blueprints.
leftmouseinputbinding

Error and crash after hotreload with disabled USharpMinHotReload

An error appears immediately after compiling the project when the engine is open.
And then if you try to play/stop the game or if you close the editor crash occurs
but at the same time the library is updated.

USharp: Error: Entry point exception (UnrealEngine.Runtime): System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at UnrealEngine.Runtime.ManagedUnrealTypes.BuildTypes() in C:\My\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\ManagedUnrealTypes.Builder.cs:line 936
   at UnrealEngine.Runtime.ManagedUnrealTypes.Load() in C:\My\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\ManagedUnrealTypes.Builder.cs:line 72
   at UnrealEngine.Runtime.Native.NativeFunctions.OnNativeFunctionsRegistered() in C:\My\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\Native\NativeFunctions.cs:line 236
   at UnrealEngine.Runtime.Native.NativeFunctions.RegisterFunctions(IntPtr registerFunctionsAddr) in C:\My\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\Native\NativeFunctions.cs:line 120
   at UnrealEngine.EntryPoint.DllMain(String arg) in C:\My\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\EntryPoint.cs:line 80

This happen with USharpMinHotReload is disabled and when i add new classes with enabled USharpMinHotReload. May be that's not all conditions.

Issues Compiling USharp and Module Generation Errors

With the new commit, I'm having trouble compiling USharp with Unreal Engine 4.22. When I compile the c plus plus, I get this error.

 C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_IPluginManager.h(55): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_IPluginManager.h(55): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FTickFunction.h(63): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FTickFunction.h(63): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FGlobals.h(148): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FGlobals.h(148): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(120): error C4800: Implicit conversion from 'const csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(120): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(125): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FMemory.h(125): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FSlowTask.h(3): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FSlowTask.h(3): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\ExportedFunctionsConventions.h(96): note: see declaration of 'csbool' C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\ExportedFunctions\Export_FSlowTask.h(8): error C4800: Implicit conversion from 'csbool' to bool. Possible information loss C:\Users\Tanner\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\Exporte

Just like I noted in my old 4.22 upgrade PR #66, I had to add explicit casts to every export method with csbool parameters. When I did this, I was able to compile USharp just fine and load up a new UE4.22 project with it installed.

But there's another issue. When I try generating the modules (USharpGen modules), the generated code has a bunch of errors. Most of them are ambiguous reference errors.

1>------ Build started: Project: UnrealEngine, Configuration: Debug Any CPU ------ 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(722,21,722,45): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_IsValid' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(723,16,723,56): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_InstanceFunctionAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(724,23,724,55): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_FunctionAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(725,20,725,47): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_ParamsSize' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(726,21,726,57): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_NewMeshInfo_IsValid' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(727,30,727,74): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_NewMeshInfo_PropertyAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(728,20,728,55): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_NewMeshInfo_Offset' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(729,21,729,59): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_RequestedMesh_IsValid' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(730,30,730,76): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_RequestedMesh_PropertyAddress' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(731,20,731,57): error CS0102: The type 'UMeshTrackerComponent' already contains a definition for 'SelectMeshBlocks_RequestedMesh_Offset' 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(736,21,736,37): error CS0111: Type 'UMeshTrackerComponent' already defines a member called 'SelectMeshBlocks' with the same parameter types 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Plugins\MagicLeap\MeshTrackerComponent.cs(767,24,767,55): error CS0111: Type 'UMeshTrackerComponent' already defines a member called 'SelectMeshBlocks_Implementation' with the same parameter types 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Engine\FunctionalTesting\TraceQueryTestResults.cs(128,23,128,31): warning CS0114: 'UTraceQueryTestResults.ToString()' hides inherited member 'object.ToString()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Engine\Engine\KismetSystemLibrary.cs(4548,30,4548,41): warning CS0108: 'USystemLibrary.GetPathName(UObject)' hides inherited member 'UObject.GetPathName(UObject)'. Use the new keyword if hiding was intended. 1>C:\Program Files\Epic Games\UE_4.22\Engine\Plugins\USharp\Binaries\Managed\Modules\Engine\Engine\KismetSystemLibrary.cs(7115,28,7115,42): warning CS0108: 'USystemLibrary.C

And a funny example of a UEnum that is an EEnum instead for whatever reason.

UnrealEngine.Runtime.UEnum toReturn = UObjectMarshaler<EEnum>.FromNative(IntPtr.Add(ParamsBuffer, GetAnimationStateEnum_ReturnValue_Offset), 0, GetAnimationStateEnum_ReturnValue_PropertyAddress.Address);

Ambiguous function warning

If there is a C# defined class which has a name ending in "Actor" and inherits from AActor there will be warnings on overridden functions (e.g. ReceiveBeginPlay) when opening a Blueprint editor.

This also happens in C++ if you were to create a class UMyActor : UObject and add an exposed function called ReceiveBeginPlay. There would be a warning that there is an ambiguous function conflicting with AActor even though UMyActor has nothing to do with AActor or its ReceiveBeginPlay function.

  • It doesn't seem like there is any obvious way to deal with this. Is there some way to set up our C# classes so that they are somehow skipped in this check? Blueprints seem to be skipped possibly due to their internal classes having _C suffixed onto their names.
  • If there isn't any work around for our C# class setup then possibly submit an issue to UE4?

Example:
LogUObjectHash: Warning: Ambiguous search, could be Function /Script/Engine.Actor:ReceiveBeginPlay or Function /Script/USharp.TestActor:ReceiveBeginPlay

To reproduce this warning manually:
FindObject<UFunction>(ANY_Package, TEXT("Actor:ReceiveBeginPlay"), true);

Callstack:

UE4Editor-CoreUObject.dll!StaticFindObjectFastInternalThreadSafe(FUObjectHashTables & ThreadHash, UClass * ObjectClass, UObject * ObjectPackage, FName ObjectName, bool bExactClass, bool bAnyPackage, EObjectFlags ExcludeFlags, EInternalObjectFlags ExclusiveInternalFlags) Line 517	C++
UE4Editor-CoreUObject.dll!StaticFindObjectFastInternal(UClass * ObjectClass, UObject * ObjectPackage, FName ObjectName, bool bExactClass, bool bAnyPackage, EObjectFlags ExcludeFlags, EInternalObjectFlags ExclusiveInternalFlags) Line 542	C++
UE4Editor-CoreUObject.dll!StaticFindObjectFast(UClass * ObjectClass, UObject * ObjectPackage, FName ObjectName, bool ExactClass, bool AnyPackage, EObjectFlags ExclusiveFlags, EInternalObjectFlags ExclusiveInternalFlags) Line 288	C++
UE4Editor-CoreUObject.dll!StaticFindObject(UClass * ObjectClass, UObject * InObjectPackage, const wchar_t * OrigInName, bool ExactClass) Line 365	C++
UE4Editor-Kismet.dll!FBlueprintSpawnNodeCommands::RegisterCommands() Line 328	C++
UE4Editor-Kismet.dll!TCommands<FBlueprintSpawnNodeCommands>::Register() Line 57	C++
UE4Editor-Kismet.dll!FBlueprintEditor::CreateDefaultCommands() Line 2375	C++
UE4Editor-Kismet.dll!FBlueprintEditor::CommonInitialization(const TArray<UBlueprint *,FDefaultAllocator> & InitBlueprints) Line 1650	C++
UE4Editor-Kismet.dll!FBlueprintEditor::InitBlueprintEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost,0> & InitToolkitHost, const TArray<UBlueprint *,FDefaultAllocator> & InBlueprints, bool bShouldOpenInDefaultsMode) Line 1768	C++
UE4Editor-Kismet.dll!FBlueprintEditorModule::CreateBlueprintEditor(const EToolkitMode::Type Mode, const TSharedPtr<IToolkitHost,0> & InitToolkitHost, UBlueprint * Blueprint, bool bShouldOpenInDefaultsMode) Line 257	C++
UE4Editor-AssetTools.dll!FAssetTypeActions_Blueprint::OpenAssetEditor(const TArray<UObject *,FDefaultAllocator> & InObjects, TSharedPtr<IToolkitHost,0> EditWithinLevelEditor) Line 87	C++
UE4Editor-UnrealEd.dll!FAssetEditorManager::OpenEditorForAsset(UObject * Asset, const EToolkitMode::Type ToolkitMode, TSharedPtr<IToolkitHost,0> OpenedFromLevelEditor, const bool bShowProgressWindow) Line 378	C++
UE4Editor-AssetTools.dll!FAssetTypeActions_Base::AssetsActivated(const TArray<UObject *,FDefaultAllocator> & InObjects, EAssetTypeActivationMethod::Type ActivationType) Line 57	C++
UE4Editor-ContentBrowser.dll!SContentBrowser::OnAssetsActivated(const TArray<FAssetData,FDefaultAllocator> & ActivatedAssets, EAssetTypeActivationMethod::Type ActivationMethod) Line 2085	C++
UE4Editor-ContentBrowser.dll!TBaseSPMethodDelegateInstance<0,SContentBrowser,0,void __cdecl(TArray<FAssetData,FDefaultAllocator> const & __ptr64,enum EAssetTypeActivationMethod::Type)>::ExecuteIfSafe(const TArray<FAssetData,FDefaultAllocator> & <Params_0>, EAssetTypeActivationMethod::Type <Params_1>) Line 345	C++
UE4Editor-ContentBrowser.dll!SAssetView::OnListMouseButtonDoubleClick(TSharedPtr<FAssetViewItem,0> AssetItem) Line 4046	C++
UE4Editor-ContentBrowser.dll!TBaseSPMethodDelegateInstance<0,SAssetView,0,void __cdecl(TSharedPtr<FAssetViewItem,0>)>::ExecuteIfSafe(TSharedPtr<FAssetViewItem,0> <Params_0>) Line 345	C++
UE4Editor-ContentBrowser.dll!TBaseDelegate<void,TSharedPtr<FAssetViewItem,0> >::ExecuteIfBound(TSharedPtr<FAssetViewItem,0> <Params_0>) Line 624	C++
UE4Editor-ContentBrowser.dll!SListView<TSharedPtr<FAssetViewItem,0> >::Private_OnItemDoubleClicked(TSharedPtr<FAssetViewItem,0> TheItem) Line 815	C++
UE4Editor-ContentBrowser.dll!STableRow<TSharedPtr<FAssetViewItem,0> >::OnMouseButtonDoubleClick(const FGeometry & InMyGeometry, const FPointerEvent & InMouseEvent) Line 310	C++
UE4Editor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FPointerEvent,<lambda_eeb33fd1b480e3cad58a1531d90d2e14> >(FSlateApplication * ThisApplication, FEventRouter::FBubblePolicy RoutingPolicy, FPointerEvent EventCopy, const FSlateApplication::RoutePointerDoubleClickEvent::__l2::<lambda_eeb33fd1b480e3cad58a1531d90d2e14> & Lambda) Line 268	C++
UE4Editor-Slate.dll!FSlateApplication::RoutePointerDoubleClickEvent(FWidgetPath & WidgetsUnderPointer, FPointerEvent & PointerEvent) Line 5922	C++
UE4Editor-Slate.dll!FSlateApplication::ProcessMouseButtonDoubleClickEvent(const TSharedPtr<FGenericWindow,0> & PlatformWindow, FPointerEvent & InMouseEvent) Line 5909	C++
UE4Editor-Slate.dll!FSlateApplication::OnMouseDoubleClick(const TSharedPtr<FGenericWindow,0> & PlatformWindow, const EMouseButtons::Type Button, const FVector2D CursorPos) Line 5885	C++
UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 1740	C++
UE4Editor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 2182	C++
UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 895	C++
UE4Editor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 732	C++
user32.dll!0000000077249bbd()	Unknown
user32.dll!00000000772498c2()	Unknown
UE4Editor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 129	C++
UE4Editor.exe!FEngineLoop::Tick() Line 3417	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 166	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 209	C++
UE4Editor.exe!__scrt_common_main_seh() Line 283	C++
kernel32.dll!00000000771259cd()	Unknown
ntdll.dll!000000007738385d()	Unknown

Question about CodeGenerator

Hello,

I created a class named UUE_AnimTool, the prefix UUE means "Unreal Extent"(The module name is UnrealExtent) with an UObject prefix.
When I generated the C# code, I found that the name of the class is UE_AnimTool, so I read the source code of CodeGenerator.UpdateTypeNamePrefix:

private string UpdateTypeNamePrefix(CodeGeneratorSettings.TypePrefix typePrefix, string str, 
    bool fullyQualifiedName, List<string> namespaces, string namespaceName = null)
{
    switch (typePrefix.Mode)
    {
        case CodeGeneratorSettings.TypePrefixMode.Strip:
            if (str.Length > 1 && str[0] == typePrefix.Char && char.IsUpper(str[1]))
            {
                str = str.Remove(0, 1);
            }
            break;
        case CodeGeneratorSettings.TypePrefixMode.Enforce:
            if (str.Length > 0)
            {
                if (str[0] != typePrefix.Char ||
                    (str.Length > 1 && char.IsUpper(str[0]) && char.IsLower(str[1])))
                {
                    str = typePrefix.Char + str;
                }
            }
            break;
    }
    return UpdateTypeNameNamespace(str, fullyQualifiedName, namespaces, namespaceName);
}

It compares str[0] and typePrefix.Char, but I don't know the reason. Why not insert the prefix dirrectly?

So, can you tell me?
Thanks~

FRandRange error!

In file \Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Core\Math\FMath_UnrealMathUtility.cs

        /// <summary>
        /// Util to generate a random number in a range.
        /// </summary>
        public static float FRandRange(float min, float max)
        {
            return min + (max - min) + FRand();
        }

return min + (max - min) + FRand();

Support for default values on C# auto properties exposed to UE4

Part of the AssemblyRewriter process is rewriting the IL to remove the C# backing field for properties and instead read / write to the native memory of the underlying UE4 object. This breaks default values as the C# compiler will generate code to directly assign the backing field in the constructor.

AssemblyRewriter needs to scan the constructor to any assignments to backing fields, then take the value and generate code in the Initialize method to do that assignment instead.

public class Test : AActor
{
    [UProperty, EditAnywhere]
    public int MyValue { get; set; } = 100;
}

Class redirectors don't work

Class redirectors currently depend on the concrete type UClass to be used in order for redirectors to work (see FCoreRedirects:GetFlagsForTypeName). As USharp uses USharpClass, none of the C# defined classes can use redirectors. Structs might also be impacted as USharp uses a custom type USharpStruct.

Redirectors are pretty important for creating template projects in the same format that C++ template projects are made (redirectors are used to rename classes based on the project name). They are also generally important for renaming types.

The only real way of fixing this is engine source modifications.

PluginInstaller can't find MSBuild with VisualStudio2019 Professional

Hi, firstly thank you for providing this code. I'm looking forward to using it to prototype my game idea.

Following the instructions to install the plugin into unreal, version 4.23, the PluginInstaller is unable to locate MsBuild. Debugging and recompiling revealed that there appears to be no code for Professional editions of the software.

To work around the issue I have hardcoded the msbuildpath at my local version of msbuild and recompiled the PluginInstaller. For me located here;

private static string msbuildPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe";

...to find where it is installed on your machine boot the VisualStudio enabled version of command prompt, something like 'x86 Native Tools Command Prompt for VS 2019' and then type 'where msbuild'

Cheers
D

[Bug] TMap's iterator is different between C# and C++ in UE 4.22

Hello~
I created a TMap data in C++, and export to C#.

UPROPERTY(BlueprintReadWrite)
TMap<int, int> testMap;

After I gen the C# code, it created a TMapReadWrite in C#.
But the iterator is not fit the UE 4.22 source code(not just delete KeyOffset in FScriptMapLayout and FScriptSetLayout).

For example,

testMap.Add(1, 1);
testMap.Add(2, 2);
testMap.Add(3, 3);
testMap.Remove(1);

After running the code, the count of the testMap is 2. In the VS debug preview window, the first element in testMap is Invalid.When I iterate testMap in C++ and C#, it's different.
In C++, the iterator can visit all the elements valid(testMap[2] and testMap[3]). But in C#, the iterator can just visit the invalid element and testMap[2], testMap[3] is missing.

I tried to follow the source code, and found that iterator in C++ called TConstSetBitIterator in BitArray.h, but iterator in C# called TMapBase.Enumerator, used ++index and map.Count to iterate, just not fit the source code of UE 4.22.

Looking forward to your reply, thank you!

File.ReadAllText( ... ) crashes UE4

As title says. It happens actually in a library I'm using (conveniently I made that too). UE 4.22.2 crashes without a managed exception. I know it might have something to do with System.IO.File.ReadAllText because that's when UE4 crashed when I was stepping in debug mode.
It has this stacktrace:

image

or as text:

LoginId:1bfd630647f744751faf1c96c1fd4a63
EpicAccountId:f84e0288fd544283ab12d3e57ba3be21

Unhandled exception

KERNELBASE
clr
clr
clr
clr
clr
clr
clr
UE4Editor_Engine!AActor::DispatchBeginPlay() [d:\build\++ue4\sync\engine\source\runtime\engine\private\actor.cpp:3343]
UE4Editor_Engine!AWorldSettings::NotifyBeginPlay() [d:\build\++ue4\sync\engine\source\runtime\engine\private\worldsettings.cpp:253]
UE4Editor_Engine!AGameStateBase::HandleBeginPlay() [d:\build\++ue4\sync\engine\source\runtime\engine\private\gamestatebase.cpp:177]
UE4Editor_Engine!UWorld::BeginPlay() [d:\build\++ue4\sync\engine\source\runtime\engine\private\world.cpp:3948]
UE4Editor_Engine!UGameInstance::StartPlayInEditorGameInstance() [d:\build\++ue4\sync\engine\source\runtime\engine\private\gameinstance.cpp:413]
UE4Editor_UnrealEd!UEditorEngine::CreatePIEGameInstance() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\playlevel.cpp:3341]
UE4Editor_UnrealEd!UEditorEngine::PlayInEditor() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\playlevel.cpp:2466]
UE4Editor_UnrealEd!UEditorEngine::StartQueuedPlayMapRequest() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\playlevel.cpp:1280]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\editorengine.cpp:1532]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
UE4Editor!FEngineLoop::Tick() [d:\build\++ue4\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3967]
UE4Editor!GuardedMain() [d:\build\++ue4\sync\engine\source\runtime\launch\private\launch.cpp:168]
UE4Editor!GuardedMainWrapper() [d:\build\++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:145]
UE4Editor!WinMain() [d:\build\++ue4\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:275]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

I will also test this in an isolated project.

Static Values Do Not Get Garbage Collected After Play

Static Values Do Not Become Null When the game ends. This causes issues when accessing a nullptr when the game restarts, causing the engine to crash.

protected static BowlGameModeComponent ThisInstance = null;

public static BowlGameModeComponent GetInstance(UObject worldContextObject)
{
    if(ThisInstance == null)
    {
        ThisInstance = UGameplayStatics.GetGameMode(worldContextObject).GetComponentByClass<BowlGameModeComponent>();
    }
    return ThisInstance;
}

If I try to obtain ThisInstance When the game restarts, the null check won't work, even if the field is a nullptr. Normally null exceptions don't cause the engine to crash, but in this case, it will.

protected override void ReceiveEndPlay_Implementation(EEndPlayReason EndPlayReason)
{
    //Set ThisInstance To Null, Otherwise Value Doesn't Get Destroyed and Will Crash Engine.
    ThisInstance = null;
}

I can prevent this by setting the static field to null in ReceiveEndPlay. Newcomers may not understand why their engine is crashing when they attempt to retrieve a value that doesn't get garbage collected when they restart the game.

UnrealEngine.Runtime has a reference to envdte

UnrealEngine.Runtime has a reverence to envdte
this will not be resolved at runntime on many platfromrs ofc.

I propose to add an editor only assemlby which is loaded only in the editor and is not there at runntime.
image

UnrealEngine.Runtime should have only the bare minimum to run USharp at runntime on board.

Error in Unreal Editor when recompiling MyProject.Managed.dll

After creating a stock PuzzleSample project and running it. Open the managed project .sln in visual studio 2019 and recompile with a minor change. In my case, I changed the colour materials around just to test the workflow. On returning Unreal Editor to focus is am getting this error, followed by crash reporter.

Entry point exception (UnrealEngine.Runtime): System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception. at UnrealEngine.Runtime.ManagedUnrealTypes.BuildTypes() in C:\dev\MyProject\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\ManagedUnrealTypes.Builder.cs:line 936 at UnrealEngine.Runtime.ManagedUnrealTypes.Load() in C:\dev\MyProject\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\ManagedUnrealTypes.Builder.cs:line 72 at UnrealEngine.Runtime.Native.NativeFunctions.OnNativeFunctionsRegistered() in C:\dev\MyProject\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\Native\NativeFunctions.cs:line 236 at UnrealEngine.Runtime.Native.NativeFunctions.RegisterFunctions(IntPtr registerFunctionsAddr) in C:\dev\MyProject\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\Native\NativeFunctions.cs:line 120 at UnrealEngine.EntryPoint.DllMain(String arg) in C:\dev\MyProject\UE_4.23\Engine\Plugins\USharp\Managed\UnrealEngine.Runtime\UnrealEngine.Runtime\Internal\EntryPoint.cs:line 80

Getting it running

I'm trying to get this running.

So far, I've:

  • compiled the project
  • installed the plugin using (PluginInstaller.exe)
  • created my project folder as directed in the README
  • added the post build hook

I can see in the UE log that USharp has loaded but I get no hot-reloading events and cannot see any types in the class list inside the editor (I've copied test.cs for now from the examples).

Is there something else I'm missing? I understand the utility of this project is quite low right now but I fancied having a play around.

Mono issues on Linux

Unreal ignores all unused signals in FUnixPlatformMisc::SetCrashHandler which messes with the mono signal setup such as this. Ignoring unused signals seems unnecessary as handlers wont get called unless explicitly hooked up? There is a workaround for mono sub-processes but this doesn't help with embedding mono. Perhaps @RCL might know the reasoning for ignoring signals and a possible workaround?

C# threads crash when they exit. There can be various errors but the most common is an assert on mono_bitset_test_fast. The only info I have found on this is an issue in libTAS which mentions something about thread recycling. This threading issue doesn't happen on Mac or Windows.

How to get GetWorld() in C#?

In C++ it's easy to #include "Engine/World.h" and get access to GetWorld() global to get the root game world, I can't find a way to do that in this project from C#.

Support for latent functions

Latent functions can be used to expose functions to Blueprint which complete at some arbitrary time after being called by Blueprint.

To support this a wrapper for FLatentActionInfo needs to be created. Attributes [Latent] / [LatentInfo(nameof(myLatentParam))] need to be added so that UE4 knows which parameters are latent. FLatentActionManager needs to be exposed, and some type such as FSharpLatentAction needs to be created so a C# object can be held onto for processing the custom latent action.

Question: Creating mesh with USharp

Not sure if this is the appropriate place to ask a question, but I am curious if there is a way to programatically create a mesh via USharp. If I am not mistaken, there are several ways one could create a mesh with UE's API:

I'm looking for a way to create a mesh programmatically via USharp and I'm obviously missing some key lessons in how meshes work within UE. Is it possible to create a mesh from USharp and have it added to the scene either during editing or in game play? If so, can anyone point me in the right direction?

C++ fail to build with PluginInstaller

Hello,

After building the CS solutions, I try to build the C++ part from PluginInstaller. I've a build error and I don't understand why. I successfuly build the plugin on an another PC so I've probably something missing on this one.

That's the content of the log file

AndroidPlatformFactory.RegisterBuildPlatforms: UnrealBuildTool.AndroidPlatformSDK has no valid SDK
WindowsPlatformFactory.RegisterBuildPlatforms: UnrealBuildTool.WindowsPlatformSDK using manually installed SDK
BuildMode.Execute: Command line: "D:\Devel\Epic Games\UE_4.22\Engine\Binaries\DotNET\UnrealBuildTool.exe" UE4Editor Win64 Development -plugin=C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\USharp.uplugin_temp -iwyu -noubtmakefiles -manifest=C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Saved\Manifest-UE4Editor-Win64-Development.xml -log="C:\Users\demon\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Devel+Epic+Games+UE_4.22\UBT-UE4Editor-Win64-Development.txt"
DynamicCompilation.RequiresCompilation: Compiling C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Intermediate\Build\BuildRules\USharpModuleRules.dll: Assembly does not exist
WindowsPlatform.EnumerateSdkRootDirs: Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (1)
WindowsPlatform.EnumerateSdkRootDirs: Found Windows 10 SDK root at C:\Program Files (x86)\Windows Kits\10 (2)
WindowsPlatform.UpdateCachedWindowsSdks: Found Windows 10 SDK version 10.0.17763.0 at C:\Program Files (x86)\Windows Kits\10
WindowsPlatform.UpdateCachedWindowsSdks: Found Universal CRT version 10.0.17763.0 at C:\Program Files (x86)\Windows Kits\10
UEBuildTarget.AddPlugin: Enabling plugin 'USharp' (referenced via command line)
UEBuildTarget.AddPlugin: Enabling plugin 'Paper2D' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AISupport' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'LightPropagationVolume' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'ActorLayerUtilities' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AnimationSharing' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'SignificanceManager' (referenced via default plugins -> AnimationSharing.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'CLionSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'CodeLiteSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'GitSourceControl' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'KDevelopSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'NullSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'PerforceSourceControl' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'SubversionSourceControl' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'UObjectPlugin' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'VisualStudioCodeSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'VisualStudioSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'XCodeSourceCodeAccess' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AssetManagerEditor' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'CryptoKeys' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'DataValidation' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'FacialAnimation' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'GameplayTagsEditor' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MacGraphicsSwitching' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MaterialAnalyzer' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MobileLauncherProfileWizard' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'PluginBrowser' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'SpeedTreeImporter' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'DatasmithContent' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'VariantManagerContent' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AlembicImporter' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'GeometryCache' (referenced via default plugins -> AlembicImporter.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'AppleImageUtils' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AppleVision' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'BackChannel' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'CharacterAI' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'HTML5Networking' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'ProxyLODPlugin' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'SkeletalReduction' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MagicLeapMedia' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MagicLeap' (referenced via default plugins -> MagicLeapMedia.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'ProceduralMeshComponent' (referenced via default plugins -> MagicLeapMedia.uplugin -> MagicLeap.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'AndroidMedia' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AvfMedia' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'ImgMedia' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'LinearTimecode' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MediaCompositing' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MediaPlayerEditor' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'WmfMedia' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'TcpMessaging' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'UdpMessaging' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'ActorSequence' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'LevelSequenceEditor' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MatineeToLevelSequence' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'NetcodeUnitTest' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'NUTUnrealEngine4' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'OnlineSubsystemGooglePlay' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'OnlineSubsystem' (referenced via default plugins -> OnlineSubsystemGooglePlay.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'AndroidPermission' (referenced via default plugins -> OnlineSubsystemGooglePlay.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'OnlineSubsystemIOS' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'OnlineSubsystemNull' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'OnlineSubsystemUtils' (referenced via default plugins -> OnlineSubsystemNull.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'LauncherChunkInstaller' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AndroidDeviceProfileSelector' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AndroidMoviePlayer' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AppleMoviePlayer' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'ArchVisCharacter' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'AudioCapture' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'CableComponent' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'CustomMeshComponent' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'EditableMesh' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'ExampleDeviceProfileSelector' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'Firebase' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'GoogleCloudMessaging' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'IOSDeviceProfileSelector' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'LinuxDeviceProfileSelector' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'LocationServicesBPLibrary' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'MobilePatchingUtils' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'OculusVR' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'PhysXVehicles' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'RuntimePhysXCooking' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'SteamVR' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'WebMMoviePlayer' (referenced via default plugins)
UEBuildTarget.AddPlugin: Enabling plugin 'WebMMedia' (referenced via default plugins -> WebMMoviePlayer.uplugin)
UEBuildTarget.AddPlugin: Enabling plugin 'WindowsMoviePlayer' (referenced via default plugins)
VCToolChain..ctor: Compiler: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64\cl.exe
VCToolChain..ctor: Linker: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64\link.exe
VCToolChain..ctor: Library Manager: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64\lib.exe
VCToolChain..ctor: Resource Compiler: C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\rc.exe
ExternalExecution.ExecuteHeaderToolIfNecessary: Parsing headers for UE4Editor
ExternalExecution.ExecuteHeaderToolIfNecessary:   Running UnrealHeaderTool UE4Editor "D:\Devel\Epic Games\UE_4.22\Engine\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
ExternalExecution.ExecuteHeaderToolIfNecessary: Reflection code generated for UE4Editor in 8,052176 seconds
UEBuildTarget.GenerateManifest: Writing manifest to C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Saved\Manifest-UE4Editor-Win64-Development.xml
ActionGraph.IsActionOutdated: PCH.USharp.cpp: Produced item "PCH.USharp.h.pch" doesn't exist.
ActionGraph.IsActionOutdated: PCH.USharp.cpp: Produced item "PCH.USharp.h.obj" doesn't exist.
ActionGraph.IsActionOutdated: PCH.USharp.cpp: Produced item "PCH.USharp.h.txt" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor-USharp.dll: Produced item "UE4Editor-USharp.dll" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor-USharp.dll: Produced item "UE4Editor-USharp.pdb" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor-USharpEditor.dll: Produced item "UE4Editor-USharpEditor.dll" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor-USharpEditor.dll: Produced item "UE4Editor-USharpEditor.pdb" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor-USharp.lib: Produced item "UE4Editor-USharp.lib" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor-USharpEditor.lib: Produced item "UE4Editor-USharpEditor.lib" doesn't exist.
ActionGraph.IsActionOutdated: UE4Editor.target: Prerequisite UE4Editor-USharp.dll is produced by outdated action.
ActionGraph.IsActionOutdated: Module.USharpEditor.gen.cpp: Produced item "Module.USharpEditor.gen.cpp.obj" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharpEditor.gen.cpp: Produced item "Module.USharpEditor.gen.cpp.txt" doesn't exist.
ActionGraph.IsActionOutdated: PCH.USharpEditor.cpp: Produced item "PCH.USharpEditor.h.pch" doesn't exist.
ActionGraph.IsActionOutdated: PCH.USharpEditor.cpp: Produced item "PCH.USharpEditor.h.obj" doesn't exist.
ActionGraph.IsActionOutdated: PCH.USharpEditor.cpp: Produced item "PCH.USharpEditor.h.txt" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharp.gen.cpp: Produced item "Module.USharp.gen.cpp.obj" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharp.gen.cpp: Produced item "Module.USharp.gen.cpp.txt" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharp.cpp: Produced item "Module.USharp.cpp.obj" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharp.cpp: Produced item "Module.USharp.cpp.txt" doesn't exist.
ActionGraph.IsActionOutdated: Default.rc2: Produced item "Default.rc2.res" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharpEditor.cpp: Produced item "Module.USharpEditor.cpp.obj" doesn't exist.
ActionGraph.IsActionOutdated: Module.USharpEditor.cpp: Produced item "Module.USharpEditor.cpp.txt" doesn't exist.
ActionGraph.IsActionOutdated: Default.rc2: Produced item "Default.rc2.res" doesn't exist.
BuildMode.Build: Using Visual Studio 2019 14.20.27508 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
ParallelExecutor.ExecuteActions: Building 13 actions with 8 processes...
ParallelExecutor.ExecuteActions:   [1/13] Default.rc2
ParallelExecutor.ExecuteActions:   [2/13] Default.rc2
ParallelExecutor.ExecuteActions:   [3/13] PCH.USharp.cpp
ParallelExecutor.ExecuteActions:   [4/13] PCH.USharpEditor.cpp
ParallelExecutor.ExecuteActions:   [5/13] Module.USharp.cpp
ParallelExecutor.ExecuteActions:   C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Source\USharp\Private\CSharpLoader.h(10): fatal error C1083: Impossible d'ouvrir le fichier include : 'metahost.h' : No such file or directory
ParallelExecutor.ExecuteActions:   [6/13] Module.USharpEditor.gen.cpp
ParallelExecutor.ExecuteActions:   [7/13] Module.USharpEditor.cpp
ParallelExecutor.ExecuteActions:   [8/13] UE4Editor-USharpEditor.lib
ParallelExecutor.ExecuteActions:      CrÚation de la bibliothÞque C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Intermediate\Build\Win64\UE4Editor\Development\USharpEditor\UE4Editor-USharpEditor.lib et de l'objet C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Intermediate\Build\Win64\UE4Editor\Development\USharpEditor\UE4Editor-USharpEditor.exp
ParallelExecutor.ExecuteActions:   [9/13] UE4Editor-USharpEditor.dll
ParallelExecutor.ExecuteActions:      CrÚation de la bibliothÞque C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Intermediate\Build\Win64\UE4Editor\Development\USharpEditor\UE4Editor-USharpEditor.suppressed.lib et de l'objet C:\Users\demon\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\Intermediate\Build\Win64\UE4Editor\Development\USharpEditor\UE4Editor-USharpEditor.suppressed.exp
ParallelExecutor.ExecuteActions:   [10/13] Module.USharp.gen.cpp
UnrealBuildTool.Main: CompilationResultException: Error: OtherCompilationError
UnrealBuildTool.Main:    à UnrealBuildTool.ActionGraph.ExecuteActions(BuildConfiguration BuildConfiguration, List`1 ActionsToExecute) dans D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\ActionGraph.cs:ligne 175
UnrealBuildTool.Main:    à UnrealBuildTool.BuildMode.Build(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options) dans D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:ligne 311
UnrealBuildTool.Main:    à UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) dans D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:ligne 196
UnrealBuildTool.Main:    à UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) dans D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:ligne 429
Timeline.Print: Timeline:
Timeline.Print: 
Timeline.Print: [ 0.000]
Timeline.Print: [ 0.000](+0.023) <unknown>
Timeline.Print: [ 0.023](+0.003) FileMetadataPrefetch.QueueEngineDirectory()
Timeline.Print: [ 0.026](+0.175) XmlConfig.ReadConfigFiles()
Timeline.Print: [ 0.202](+0.000) SingleInstanceMutex.Acquire()
Timeline.Print: [ 0.202](+0.173) UEBuildPlatform.RegisterPlatforms()
Timeline.Print:   0.210          [ 0.008](+0.076) Initializing InstalledPlatformInfo
Timeline.Print:   0.287          [ 0.084](+0.000) Querying types
Timeline.Print:   0.292          [ 0.090](+0.003) MacPlatformFactory
Timeline.Print:   0.296          [ 0.093](+0.000) TVOSPlatformFactory
Timeline.Print:   0.296          [ 0.093](+0.024) AndroidPlatformFactory
Timeline.Print:   0.321          [ 0.118](+0.000) IOSPlatformFactory
Timeline.Print:   0.321          [ 0.119](+0.000) HTML5PlatformFactory
Timeline.Print:   0.321          [ 0.119](+0.000) LinuxPlatformFactory
Timeline.Print:   0.322          [ 0.119](+0.000) LuminPlatformFactory
Timeline.Print:   0.322          [ 0.119](+0.053) WindowsPlatformFactory
Timeline.Print: [ 0.393](+0.035) TargetDescriptor.ParseCommandLine()
Timeline.Print: [ 0.442](+1.421) UEBuildTarget.Create()
Timeline.Print:   0.451          [ 0.008](+0.474) RulesCompiler.CreateTargetRulesAssembly()
Timeline.Print:   0.451            0.008          [ 0.000](+0.150) <unknown>
Timeline.Print:   0.602            0.159          [ 0.150](+0.094) Finding engine modules
Timeline.Print:   0.696            0.253          [ 0.244](+0.003) Finding plugin modules
Timeline.Print:   0.699            0.257          [ 0.248](+0.033) <unknown>
Timeline.Print:   0.732            0.290          [ 0.281](+0.006) Finding program modules
Timeline.Print:   0.739            0.297          [ 0.288](+0.001) Finding program targets
Timeline.Print:   0.747            0.304          [ 0.295](+0.171) Compiling rules assembly (USharpModuleRules.dll)
Timeline.Print:   0.926          [ 0.483](+0.075) RulesAssembly.CreateTargetRules()
Timeline.Print:   1.006          [ 0.564](+0.086) UEBuildTarget constructor
Timeline.Print:   1.010            0.568          [ 0.003](+0.080) Reading source file metadata cache
Timeline.Print:   1.093          [ 0.651](+0.770) UEBuildTarget.PreBuildSetup()
Timeline.Print: [ 1.867](+9.200) UEBuildTarget.Build()
Timeline.Print:   1.867          [ 0.000](+0.076) <unknown>
Timeline.Print:   1.943          [ 0.076](+0.147) ExternalExecution.SetupUObjectModules()
Timeline.Print:   2.090          [ 0.223](+0.043) <unknown>
Timeline.Print:   2.134          [ 0.267](+8.052) Executing UnrealHeaderTool
Timeline.Print:  10.186          [ 8.319](+0.003) ExternalExecution.ResetCachedHeaderInfo()
Timeline.Print:  10.190          [ 8.322](+0.011) ExternalExecution.UpdateDirectoryTimestamps()
Timeline.Print:  10.201          [ 8.334](+0.029) <unknown>
Timeline.Print:  10.231          [ 8.364](+0.270) UEBuildBinary.Build()
Timeline.Print:  10.501          [ 8.634](+0.566) <unknown>
Timeline.Print: [11.067](+0.028) <unknown>
Timeline.Print: [11.096](+0.000) Finding editor processes for hot-reload
Timeline.Print: [11.101](+0.002) Reading dependency cache
Timeline.Print: [11.104](+0.005) Reading action history
Timeline.Print: [11.110](+0.019) ActionGraph.GetActionsToExecute()
Timeline.Print:  11.112          [ 0.001](+0.001) Prefetching include dependencies
Timeline.Print:  11.113          [ 0.002](+0.016) Cache outdated actions
Timeline.Print: [11.137](+8.485) ActionGraph.ExecuteActions()
Timeline.Print: [19.635](+0.000) FileMetadataPrefetch.Stop()
Timeline.Print: [19.639]

Thank you for your help!

Generating C# wrapper functionality for Datasmith

C# wrapper generation when running USharpGen modules errors when Datasmith plugins from Epic are enabled. Probably low on the to-do list as it's an additional Epic plugin however you may want to consider for any users utilising these Unreal Studio plugins.

Workaround is not to use datasmith with USharp!

C# Loader Error

I notice that using a normal pre-compiled version of ue4, I had to put the usharp plugin inside my game project folder (create a folder called "Plugins" inside your root game project folder and paste usharp inside there). When I enabled the plugin and restarted the editor, I got a C# Loader Error.
usharploadererror
Apparently the c# loader was expecting a "UnrealEngine.Runtime" dll inside the Managed Folder. The problem is that the Managed folder didn't exist at all. So I had to manually create the "Managed" folder under "USharp/Binaries/". Then I looked inside each project inside the UnrealEngine.Runtime folder, looked inside the bin/Debug folder, and copy-pasted the dlls and pdbs from these folders inside the Managed folder I just created. Now the plugin loads just fine with no errors. The build process should create these dlls in the appropriate places by default.

Is Android possible in the near future?

Hello,

The plugin works well on the Windows platform. Can we expect an Android compatiblity in a near future? What do you need to make it possible? Can we help you? If yes how?

Full dev integration

This isn't likely to be the best place to put this so feel free to change this as needs be.

I could see that this plugin may have a lot of wider community benefits. To that end, Epic might support its further development under their Megagrants - particularly where it may be in their interest to encourage C# integration to encourage engine adoption with developers familiar with Unity. They may also be able to offer direct dev support as part of this.
https://www.unrealengine.com/en-US/megagrants

VTableHacks on Mac / Linux

Currently there are a few hacks in place to swap out vtable function entries to override native C++ functions without having USharp depend on engine modifications.

On Mac the vtable swap works but calling the original function results in a crash (this pointer is passed in via RDX when we call the original function, but it expects it to be in RDI (at least for AActor::BeginPlay()).

Is there something wrong with the way the original function is being called? If not then the vtable hacks cannot be used as they don't work as expected. Engine modifications would be the only alternative route.

typedef void (UObject::*ActorBeginPlayFunc)();
CSEXPORT void CSCONV Export_VTableHacks_CallOriginal_ActorBeginPlay(ActorBeginPlayFunc Func, UObject* Obj)
{
	(Obj->*Func)();// "Obj" is passed in via RDX, the target function expects RDI
}

EDIT:

After doing some tests in Compiler Explorer (https://godbolt.org/) with gcc/clang, they both seem to set up the registers as expected. Xcode's disassembly view where it crashes seems to chop off instructions prior to those in the stack trace, so I was assuming it was passing by RDX based on the register values from register read.

The following is some code which should work in UE4 based on the disassembly in the main 3 compilers (gcc, clang, msvc) which can be tested on https://godbolt.org/.

#include <iostream>
using namespace std;

class UObject
{
public:
    int Val1;
    int Val2;
};

class AActor : public UObject
{
public:
    virtual void BeginPlay()
    {
        cout << "AActor " << Val1 << " " << Val2 << "\n";
    }
};

class ASomeActor : public AActor
{
public:
    virtual void BeginPlay() override
    {
        cout << "ASomeActor " << Val1 << " " << Val2 << "\n";
    }
};

typedef void (AActor::*ActorBeginPlayFunc)();
void Export_VTableHacks_CallOriginal_ActorBeginPlay(ActorBeginPlayFunc Func, AActor* Obj)
{
    (Obj->*Func)();
}

int main()
{
    AActor obj = ASomeActor();
    obj.BeginPlay();

    Export_VTableHacks_CallOriginal_ActorBeginPlay(&AActor::BeginPlay, &obj);

    return 0;
}

USharp doesn't compile

Working environment:

  • Visual Studio 2019
  • Windows 10, VS 2019
  • .NET Framework 4.7.2
  • .NET Core SDK 2.1
  • MSVC++ 2015-2019

Type command "buildcpp" crashed in PluginInstaller.exe (I put it in the correct directory).
Full error information:

buildcpp
Running AutomationTool...
Parsing command line: BuildPlugin -Plugin=C:\Users\Lenovo\AppData\Roaming\USharp\BuildTemp2\USharp.uplugin_temp -Package=C:\Users\Lenovo\AppData\Roaming\USharp\Build -Rocket -Platform=Win64
Copying 185 file(s) using max 64 thread(s)
Reading plugin from C:\Users\Lenovo\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\USharp.uplugin_temp...
Building plugin for host platforms: Win64
Running: E:\UE_4.24\Engine\Binaries\DotNET\UnrealBuildTool.exe UE4Editor Win64 Development -Project=C:\Users\Lenovo\AppData\Roaming\USharp\Build\HostProject\HostProject.uproject -plugin=C:\Users\Lenovo\AppData\Roaming\USharp\Build\HostProject\Plugins\USharp\USharp.uplugin_temp -iwyu -noubtmakefiles -manifest=C:\Users\Lenovo\AppData\Roaming\USharp\Build\HostProject\Saved\Manifest-UE4Editor-Win64-Development.xml -nohotreload -log="C:\Users\Lenovo\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_4.24\UBT-UE4Editor-Win64-Development.txt"
  Parsing headers for UE4Editor
    Running UnrealHeaderTool "C:\Users\Lenovo\AppData\Roaming\USharp\Build\HostProject\HostProject.uproject" "C:\Users\Lenovo\AppData\Roaming\USharp\Build\HostProject\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
  LogWindows: Error: === Critical error: ===
  LogWindows: Error:
  LogWindows: Error: Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Projects/Private/PluginManager.cpp] [Line: 889]
  LogWindows: Error: This project requires the 'USharp' plugin. Install it and try again, or remove it from the project's required plugin list.
  LogWindows: Error:
  LogWindows: Error:
  LogWindows: Error:
Took 65.336724s to run UnrealBuildTool.exe, ExitCode=3
UnrealBuildTool failed. See log for more details. (C:\Users\Lenovo\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UE_4.24\UBT-UE4Editor-Win64-Development.txt)
AutomationTool exiting with ExitCode=3 (Error_UnknownCommand)
BUILD FAILED
done (00:01:09.0939575)

And my UE4 engine directory is E:/UE_4.24/Engine. It seems one project requires the "USharp" plugin, but it has not been compiled yet. Cannot open the engine directly after placing the USharp plugin into the engine plugins directory. Can someone help me?

Crash when hotreloading after changing the layout of a struct

Create a Blueprint which inherits from ASomeActor. Uncomment Val3 and recompile for hotreload.

  • The crash doesn't occur if Blueprint has a FSomeStruct member, it only crashes when inheriting from a C# defined type which has that struct as a member.
  • The crash doesn't occur for all data types.
  • The crash only occurs when adding new members (it doesn't crash when removing members).
  • The crash occurs when reinstancing the class. It doesn't crash when reinstancing the struct (Export_SharpHotReloadUtils_ReinstanceClass).
[UStruct]
struct FSomeStruct
{
	[UProperty, EditAnywhere, BlueprintReadWrite]
	public string Val1;
	[UProperty, EditAnywhere, BlueprintReadWrite]
	public string Val2;
	//[UProperty, EditAnywhere, BlueprintReadWrite]
	//public string Val3;
}

[UClass, BlueprintType, Blueprintable]
class ASomeActor : AActor
{
	[UProperty, EditAnywhere, BlueprintReadWrite]
	public FSomeStruct Val1 { get; set; }
}
[Inline Frame] UE4Editor-Core.dll!TCString<wchar_t>::IsPureAnsi(const wchar_t * Str) Line 324	C++	Symbols loaded.
UE4Editor-Core.dll!operator<<(FArchive & Ar, FString & A) Line 1469	C++	Symbols loaded.
UE4Editor-Core.dll!FStructuredArchive::FSlot::operator<<(FString & Value) Line 376	C++	Symbols loaded.
UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FStructuredArchive::FSlot Slot, UProperty * Property, unsigned char * Value, unsigned char * Defaults) Line 224	C++	Symbols loaded.
UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FStructuredArchive::FSlot Slot, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1216	C++	Symbols loaded.
UE4Editor-CoreUObject.dll!UScriptStruct::SerializeItem(FStructuredArchive::FSlot Slot, void * Value, const void * Defaults) Line 2201	C++	Symbols loaded.
UE4Editor-CoreUObject.dll!UStructProperty::SerializeItem(FStructuredArchive::FSlot Slot, void * Value, const void * Defaults) Line 130	C++	Symbols loaded.
UE4Editor-USharp.dll!FSharpHotReloadClassReinstancer::UpdateDefaultProperties() Line 685	C++	Symbols loaded.
[Inline Frame] UE4Editor-USharp.dll!FSharpHotReloadClassReinstancer::ReinstanceObjectsAndUpdateDefaults()	C++	Symbols loaded.
UE4Editor-USharp.dll!Export_SharpHotReloadUtils_ReinstanceClass(FSharpHotReloadClassReinstancer * Reinstancer) Line 45	C++	Symbols loaded.
[Managed to Native Transition]		Annotated Frame
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.ManagedUnrealTypes.BuildTypes() Line 945	C#	Symbols loaded.
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.ManagedUnrealTypes.Load() Line 68	C#	Symbols loaded.
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.Native.NativeFunctions.OnNativeFunctionsRegistered() Line 235	C#	Symbols loaded.
UnrealEngine.Runtime.dll!UnrealEngine.Runtime.Native.NativeFunctions.RegisterFunctions(System.IntPtr registerFunctionsAddr) Line 119	C#	Symbols loaded.
UnrealEngine.Runtime.dll!UnrealEngine.EntryPoint.DllMain(string arg) Line 80	C#	Symbols loaded.
[Native to Managed Transition]		Annotated Frame
[Managed to Native Transition]		Annotated Frame
Loader.dll!UnrealEngine.AssemblyLoader.Load() Line 739	C#	Symbols loaded.
[AppDomain (DefaultDomain�, #1) -> AppDomain (Domain21852167 2�, #4)]		Annotated Frame
Loader.dll!UnrealEngine.Runtime.AssemblyContextRef.DoCallBackAppDomain(UnrealEngine.Runtime.CrossAssemblyContextDelegate callBackDelegate) Line 626	C#	Symbols loaded.
Loader.dll!UnrealEngine.Runtime.AssemblyContextRef.DoCallBack(UnrealEngine.Runtime.CrossAssemblyContextDelegate callBackDelegate) Line 620	C#	Symbols loaded.
Loader.dll!UnrealEngine.EntryPoint.ReloadMainContext(bool threaded) Line 397	C#	Symbols loaded.
Loader.dll!UnrealEngine.EntryPoint.ReloadMainContext.AnonymousMethod__0() Line 351	C#	Symbols loaded.
Loader.dll!UnrealEngine.GameThreadHelper.Tick(float deltaTime) Line 157	C#	Symbols loaded.
[Native to Managed Transition]		Annotated Frame
[Inline Frame] UE4Editor-USharp.dll!Export_FTicker_Reg_CoreTicker::__l5::<lambda_7b7ea35a06c06b4e153c935ad95248c2>::operator()(float) Line 8	C++	Symbols loaded.
[Inline Frame] UE4Editor-USharp.dll!UE4Tuple_Private::TTupleImpl<TIntegerSequence<unsigned int> >::ApplyAfter(Export_FTicker_Reg_CoreTicker::__l5::<lambda_7b7ea35a06c06b4e153c935ad95248c2> &) Line 498	C++	Symbols loaded.
UE4Editor-USharp.dll!TBaseFunctorDelegateInstance<bool __cdecl(float),<lambda_7b7ea35a06c06b4e153c935ad95248c2> >::Execute(float <Params_0>) Line 893	C++	Symbols loaded.
[Inline Frame] UE4Editor-Core.dll!TBaseDelegate<bool,float>::Execute(float)	C++	Symbols loaded.
[Inline Frame] UE4Editor-Core.dll!FTicker::FElement::Fire(float)	C++	Symbols loaded.
UE4Editor-Core.dll!FTicker::Tick(float DeltaTime) Line 95	C++	Symbols loaded.
UE4Editor.exe!FEngineLoop::Tick() Line 4167	C++	Symbols loaded.
[Inline Frame] UE4Editor.exe!EngineTick()	C++	Symbols loaded.
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 168	C++	Symbols loaded.
UE4Editor.exe!GuardedMainWrapper(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 145	C++	Symbols loaded.
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 275	C++	Symbols loaded.
[Inline Frame] UE4Editor.exe!invoke_main() Line 102	C++	Non-user code. Symbols loaded.
UE4Editor.exe!__scrt_common_main_seh() Line 288	C++	Non-user code. Symbols loaded.
kernel32.dll!0000000077b0555d()	Unknown	Non-user code. Cannot find or open the PDB file.
ntdll.dll!0000000077c6385d()	Unknown	Non-user code. Cannot find or open the PDB file.

There is also another crash. I'm not sure the what the steps are to reproduce this. It looks like it crashes after manually compiling a Blueprint, somewhen after modifying a C# defined struct. I have a feeling the hotreload process missed the Blueprint, so when it was next compiled it hadn't been updated with the struct changes.

[2019.05.09-22.15.45:810][391]LogWindows: Error: === Critical error: ===
[2019.05.09-22.15.45:810][391]LogWindows: Error:
[2019.05.09-22.15.45:810][391]LogWindows: Error: Fatal error!
[2019.05.09-22.15.45:810][391]LogWindows: Error:
[2019.05.09-22.15.45:810][391]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000
[2019.05.09-22.15.45:810][391]LogWindows: Error:
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe5385645e UE4Editor-CoreUObject.dll!UStructProperty::DestroyValueInternal() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\CoreUObject\Private\UObject\PropertyStruct.cpp:305]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe19ea64c9 UE4Editor-Engine.dll!UBlueprintGeneratedClass::DestroyPersistentUberGraphFrame() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Engine\Private\BlueprintGeneratedClass.cpp:1328]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe538c60ab UE4Editor-CoreUObject.dll!UObjectBase::SetClass() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectBase.cpp:278]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe3a5f5934 UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::MoveCDOToNewClass() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Editor\UnrealEd\Private\Kismet2\KismetReinstanceUtilities.cpp:1571]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe3a5b598a UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::FBlueprintCompileReinstancer() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Editor\UnrealEd\Private\Kismet2\KismetReinstanceUtilities.cpp:265]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe4c65ea9a UE4Editor-Kismet.dll!FBlueprintCompilationManagerImpl::FlushCompilationQueueImpl() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:943]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe4c612276 UE4Editor-Kismet.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Editor\Kismet\Private\BlueprintCompilationManager.cpp:207]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe3a5d0144 UE4Editor-UnrealEd.dll!FKismetEditorUtilities::CompileBlueprint() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Editor\UnrealEd\Private\Kismet2\Kismet2.cpp:766]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe4c6fd116 UE4Editor-Kismet.dll!FBlueprintEditor::Compile() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Editor\Kismet\Private\BlueprintEditor.cpp:3258]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe4c7184e8 UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance<0,FBlueprintEditor,0,void __cdecl(void)>::ExecuteIfSafe() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:355]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe505413aa UE4Editor-Slate.dll!FUICommandList::ExecuteAction() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Framework\Commands\UICommandList.cpp:99]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe50618162 UE4Editor-Slate.dll!SToolBarButtonBlock::OnClicked() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Framework\MultiBox\SToolBarButtonBlock.cpp:300]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe505f9fb4 UE4Editor-Slate.dll!TBaseSPMethodDelegateInstance<0,SToolBarButtonBlock,0,FReply __cdecl(void)>::Execute() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:279]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe506b10b2 UE4Editor-Slate.dll!SButton::OnMouseButtonUp() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Widgets\Input\SButton.cpp:293]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe505045cb UE4Editor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FToLeafmostPolicy,FPointerEvent,<lambda_cc5aea9e7377b04ce85c30c65ec3889b> >() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:271]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe5057fae1 UE4Editor-Slate.dll!FSlateApplication::RoutePointerUpEvent() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:5598]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe5056a24a UE4Editor-Slate.dll!FSlateApplication::ProcessMouseButtonUpEvent() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:6203]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe5055fcf4 UE4Editor-Slate.dll!FSlateApplication::OnMouseUp() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Slate\Private\Framework\Application\SlateApplication.cpp:6176]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe6fd5b74d UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:1842]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe6fd4ef3f UE4Editor-ApplicationCore.dll!FWindowsApplication::DeferMessage() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:2292]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe6fd5d5ef UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessMessage() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:1522]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffe6fd4c060 UE4Editor-ApplicationCore.dll!FWindowsApplication::AppWndProc() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsApplication.cpp:772]
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffec128681d USER32.dll!UnknownFunction []
[2019.05.09-22.15.45:810][391]LogWindows: Error: [Callstack] 0x00007ffec1286212 USER32.dll!UnknownFunction []
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ffe6fd5e7a6 UE4Editor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\ApplicationCore\Private\Windows\WindowsPlatformApplicationMisc.cpp:130]
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ff72e085aaf UE4Editor.exe!FEngineLoop::Tick() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:3882]
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ff72e094f5c UE4Editor.exe!GuardedMain() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Launch\Private\Launch.cpp:168]
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ff72e094fda UE4Editor.exe!GuardedMainWrapper() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:145]
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ff72e0a2a4c UE4Editor.exe!WinMain() [I:\Develop\UnrealEngine\UE4_422_Src\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:275]
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ff72e0a542a UE4Editor.exe!__scrt_common_main_seh() [d:\agent\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ffec1147bd4 KERNEL32.DLL!UnknownFunction []
[2019.05.09-22.15.45:811][391]LogWindows: Error: [Callstack] 0x00007ffec1c2ce71 ntdll.dll!UnknownFunction []
[2019.05.09-22.15.45:811][391]LogWindows: Error:
[2019.05.09-22.15.45:823][391]LogExit: Executing StaticShutdownAfterError
[2019.05.09-22.15.45:830][391]LogWindows: FPlatformMisc::RequestExit(1)
[2019.05.09-22.15.45:840][391]Log file closed, 05/09/19 16:15:45

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.