How to create a material in a editor plugin (without being applied)

I’m new to Unreal and I’m trying to create materials to Editor I mean adding it to the content but without applying it to any node yet, just to let the user to apply it later, anyway update a existing material could be great too.

Assets are saved managable UObjects that been registered to be savable like that via AssetTools module using special non-UObject class. All engine asset types classes for that system are contained in single module:

You could study this more as it is basics of creating new asset types :slight_smile: Keep in mind as those are not UObjects if you create such class on your own you need to manually register it in module load (you homework will be figure out where it is ;] tip, it in the same module that those classes are)

But back to topic, so each of the asset type has UObjects that represents it which in case of material is UMaterial:

So you simply create new UMaterial using NewObject function and then register it as asset with this function:

https://docs.unrealengine.com/latest/INT/API/Runtime/AssetRegistry/FAssetRegistryModule/AssetCreated/index.html

Here you have some use examples from engine source code:

https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Editor/WorldBrowser/Private/Tiles/WorldTileCollectionModel.cpp#L1490
https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Editor/Kismet/Private/STimelineEditor.cpp#L669
https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Editor/UnrealEd/Private/Kismet2/Kismet2.cpp#L1372
https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Editor/BehaviorTreeEditor/Private/BehaviorTreeEditor.cpp#L1703

Note that i just figure this out right now, so not sure how this gonna work, but my guess is you won’t get better anwser then this here

Hmm i got mail you posted something here but i don’t see;p Always when you get crash check the logs first

It was a question but a totally newbie fail, I deleted this to avoid people looking for code copy it! I’ll post the working solution later.

Regards.