Editing Non-User-Classes (UMeshComponent)

Hi guys,
in my game, I need addtional information on my meshes. I figured that the easiest way to achieve this is to edit the UMeshComponent header directly. I cannot simply inherit from a subclass, since I’ll want to use static and dynamic meshes in the future, so editing their base class would be the most elegant way.

However I have a few questions on this:

Is it acceptable or good practice to edit the classes that come with the engine, instead of only inheriting from them?

What are the downsides?

And if I do that: can I simply override the header file? (VS tells me its read-only, but gives me the option to try to overwrite it.)

How do I version control it? (since the change would not be a part of my game folder).


I just want to know if I am about to do something very stupid.

Hi pulp_user,

You are free to modify the source code of the Engine to meet your needs. However, this will only work if you have built the Engine from source code. If you are using the binary version of the Engine that is installed through the Launcher, you won’t be able to compile the changes that you make.

Whether or not you should modify the class in the source code really depends on what your needs are. If you need the modifications for all of your projects, then it may be worthwhile to edit the base class. If you only need the modifications in one project, it may be better to subclass the base class and make your modifications in the subclass.

I am a little confused as to why you feel you can’t subclass the UMeshComponent if you want to be able to use meshes with different mobility settings. This is a property in the UMeshComponent that should be inherited by your subclass.

Hi , thank you for your answer!

The reason I think I can’t subclass UMeshComponent is this: if my hirarchie looks like this right now:

UMeshComponent
           UStaticMeshComponent
           UProceduralMeshComponent

and I subclass UMeshComponent with a class that holds the information I need like this:

UMeshComponent
           UMyMeshComponent
           UStaticMeshComponent
           UProceduralMeshComponent

then UStaticMeshComponent and UProceduralMeshComponent still don’t have that information. And since I want to use the features of Static and Procedural mesh, I have to somehow get my information in the Static and Procedural mesh classes, and I don’t get that by subclassing UMeshComponent. I hope this made it more clear. If I am wrong on this please let me know!

I also don’t exactly know what mobility settings are.

Ok, I see what you are getting at. In that case, if you need to have the exact same additional functionality in your StaticMeshComponent and ProcedureMeshComponent, then modifying the MeshComponent class may be beneficial for you. If you are doing something like adding a virtual function that will be overridden differently in your StaticMeshComponent and ProceduralMeshComponent classes, then you might want to subclass those instead and add your specific functionality to each one.

Sorry for the confusion with the mobility settings. Static and Dynamic are usually used to refer to whether a mesh can be moved or not, which affects how lighting is applied to it. I thought that was what you were referring to originally. If that had been the case, all you would have needed to do would be to subclass StaticMeshComponent and you would have been all set.

I’m sorry, I confused dynamic meshes with procedural meshes. Thanks for your help! I think I will try to not edit the UMeshComponent, and instead work around it, so that I maybe get away with subclassing. I’m glad that I now know all the options I have! Thank you!