Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.14
more ▼

asked Dec 31 '16 at 11:16 AM in C++ Programming

avatar image

1.2k 46 29 58

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.


more ▼

answered Jan 04 '17 at 07:47 PM

avatar image pulp_user Jan 06 '17 at 10:33 AM

Hi Tim, thank you for your answer!

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


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


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.

avatar image Tim C ♦♦ STAFF Jan 09 '17 at 05:00 PM

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.


avatar image pulp_user Jan 09 '17 at 05:11 PM

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!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question