COMMUNITY

Getting into Unreal.hx

Hey, how many of you guys have tried Unreal.hx yet?

I know it was a bit cumbersome to get working some time ago, and that probably made some people give it up. But now its matured and improved quite a bit and i think it is really really good! And paired with some very clever use of Cppia iteration times are also much faster than with normal c++!

If you want to get into UE development and like Haxe, i really recommend you to try it!

I’ve put down a bit of effort trying to understand how things work and how to work with it and now i have to say its very awesome! The combination of Unreal Engine and the power of Haxe makes coding in UE4 so much better and faster in my opinion! I want to give a big kudos to the guys developing it, because Its like getting Haxe superpowers :slight_smile:

Also, coming from Haxe, i’ve never been a big c++ / VStudio fan so I tried to streamline development by making a flashdevelop template, that helps you set up everything and makes working like you would with normal haxe projects possible!

I want to do many of my future projects using this, because Haxe makes things awesome!

4 Likes

Just wanting to say thanks for your work on this to get it to a place where it is more accessible. Haven’t looked into it yet because of work, but can’t wait.

@d0oo0p how would you comment unreal.hx as at today?

+1, I’m interested in learning more about this. Latest commit is 8th of January. Seems like it’s somewhat maintained. I will look into this soon (as in, test it out), as I might build a cross-platform API using Haxe.

It looks like they even secretly developed a VSCode extension for it (that you’d have to build from source since it’s not published to the marketplace). :slight_smile:

https://github.com/proletariatgames/unreal.hx/tree/development/Extra/VscodeExtension

1 Like

Well, unfortunately it looks like public development has been a bit stale. Updates are not so often lately and seem to be mostly for internal use and they have not updated for latest engine versions. Still at version 4.22, which is ok but we are at version 4.25 as of now… And there is not much response on the active issues either … At some point it was very active, but they are probably busy working on their games, which is cool i guess :slight_smile:

That being said, Unreal.hx is a unique and very powerful plugin for Unreal if you want to work with Haxe. It gives you possibilities and workflows that are pretty amazing. I’ve used it for many projects and i have to say i really like the great integration and powerful workflow. It has some quirks and issues but all in all i have to say it works pretty good!

Just wish they had fixed all the issues and kept it up to date… But that might still happen? I know they wanted to do a 1.0 release on UE4 markeplace at some point, but dont know if its going to happen.

1 Like

For your project, which UE version did you use?

I was trying out the haxe plugin and I got a bug in some very fundamental code (FObjectFinder) https://github.com/proletariatgames/unreal.hx/issues/138

Have you ever encountered that?

Last project i was doing used 4.22.
FObjectFinder? How are you trying to use it?
What is the code thats creating the error?

Basically it is this code mentioned in the issue:

var asset:FObjectFinder<UStaticMesh> = new FObjectFinder("/Game/MobileStarterContent/Shapes/Shape_Cube.Shape_Cube", UStaticMesh.StaticClass());

If compiled as static, it will fail because of the compilation error mentioned there.
If compiled as cppia, it will also fail because the full build doesn’t succeed.

Hm, i have used FObjectFinder without any big issues before… Not sure what the error is…
Here is a sample of my code that has worked for me:

var findAsset = new FObjectFinder(assetPath, UStaticMesh.StaticClass());
if (findAsset.Succeeded() && findAsset.Object!=null)
{
    meshComponent.SetStaticMesh(findAsset.Object);
}

That’s frustrating, because this exact code fails with the exact error I posted on GitHub, with the Unreal.hx Plugin at Git Head, on UE 4.22.3

I wonder if there some particular hxcpp/c++ settings I have set incorrectly (e.g. I have to enable c++11 for it to build, because of e.g. usage of thread_local). But there are no documentation about that.

1 Like

I dont have a project to test on here, but is this the only error you get trying to work with unreal.hx? Everything else working fine? It might be something related to 4.22 or haxe 4 - there were several fixes done to make haxe 4 work… I know i used FObjectFinder before but am not sure if i used it with 4.22… I know it used to work atleast.

Does it work if you write the same thing in c++ only? Its always possible to write a some c++ code and write externs for it - works to do that with unreal.hx too …useful for certain things that are really hard to do or dont work. Ive done this for some things.

There should not be any specific things needed to build - as long as you can build UE4 c++ projects and haxe hxcpp projects you should be ok. Unreal.hx is really complicated and there are alot of small issues here and there - some things are hard to fix if the guys at Proletariatgames dont have time to help.

1 Like

Yeah only with unreal.hx

I drilled down a bit and found the the cause is from the glue code TypeTraits::doAssign which performs an illegal assignment on incompatible types. As noted in my latest comment in the issue.

So, yeah it works if I write C++ directly.

I wonder why it worked for you. Which unreal.hx version do you use? What c++ compiler do you use? Do you see the TypeTraits::doAssign method being created in your FObjectFinder glue?

Hey @kevinresol

Looks like I’m a bit late to the party. Did you make any progress with FObjectFinder?

I’ve been struggling with FObjectFinder for a while and hadn’t been able to find any unreal.hx documentation on it anywhere, until I stumbled upon this post. Unfortunately @d0oo0p 's code snippet doesn’t work for me either, so there must be some underlying issue.

The way I’ve been getting around it is to:

  • Expose the property to blueprints
  • Create a blueprint from the generated cpp class
  • And then set the property within blueprints

I’ve just published an example project that covers basic setup as well as setting some property via blueprints:

An example can be found in AHaxeHUD.hx