How to extend the ALandscape class?

I am trying to extend the ALandscape class. When I try to build just a blank class that the editor generates it throws a lot of errors complaining about virtual functions. I want to know if I should spend my time trying to figure out all of the virtual functions or is there a better method for doing this or another class I should be extending instead?

Thank you!


Hey man, not sure if you’re still trying this as it’s been a while, but I’m trying to do the same thing (i.e Extend Landscape for my own purposes).

What I find is that all those linker errors are generated because those functions have been declared in their respective base classes but they lack a definition that isn’t wrapped by the “IF_WITH_EDITOR” tag/macro/whatever
If you look around, you can see that these functions do actually have definitions, but they’re scattered around the Landscape classes and wrapped with the aforementioned tag.
I believe that during compilation of the project the editor strips out these functions and does not include them in the compiled code, hence causing the linker errors.

I find that these functions are often actually inherited from a higher level base class, like AActor and thus are vital editor related functionality like EditorApplyScale/EditorApplyTranslation etc.

In essence, these functions NEED to be defined in some cases so that the editor knows what to do with your object.
So there’s no real choice except to comb through them and see which are necessary to your purpose, which are necessary to the editor and then copy/alter the definitions to your own Actor thats extending the Landscape class.

There will also be some that you probably won’t need or care about, and I guess these can be left with a blank body. They will definitely NEED a body of some sort though, so watch out for that!

And further on, I’m sure this messing about will break some functionality, so make sure to be rigorous in your checking of what broke/didn’t break.

Good luck!
Hope this was helpful to someone.


After some searching, I found out that another issue with all the landscape classes, is that they are marked as MINIMAL_API, which means that in order to improve compilation times for these classes, only type information is exported and there is no access allowed to functions or variables.

Basically, if you are trying to mess with the Landscape classes on a binary version of the engine, you might as well give up.

If you feel daring, and want to try messing with the source code of the engine in order to strip these tags out and recompile the editor/engine from source, it is possible, but I believe that at this time, especially if you are a solo developer(which I am) or on a small team, you might be better off trying to find other solutions to the problem of dynamic terrain.

Solutions that don’t involve extending the ALandscape classes. Perhaps the FProceduralMeshComponent classes might be of interest to you?

In either case, I hope this helped someone!

1 Like