I’d like to make sure that some .UAssets which serve as base classes or example assets are not moved, renamed or deleted from within the editor. Preferrably I don’t even want them to be edited, making them “read-only”. These rights are only relevant within the UE editor and should not be set on the OS level.
I’ve done this in the past by just making my own custom asset in C++ with it’s own custom UI for editing the asset. I think I used this guide to get me there also.
That is cool but I need this on any UAsset of any “out of the box” engine type. Reason for this is that I want to prevent people from modifying placeholder / example files.
Yeah I’m not sure that’s possible, but I’d be interested to know if there is one. Since UAssets are really just blobs it’s really up to the thing editing it to decide whether or not something is editable/shown/writable. And I’m unsure if there’s an system in place to enforce such a behavior on all the editors, since really they are just piggy backing off of what the reflection system is telling them they can edit. Basically it’s just like the details panel populating based off of the UPROPERTY() UCLASS() USTRUCT() specifiers.
There is a somewhat related read-only mode that activates when the editor is running a preview instance of the project, which turns of editing on properties. What I’m thinking of is on the asset level. Asset renames / modification / moving etc. which don’t necessarily involve the property panels.
I’m wondering if you were able to do this via a plugin? IE all assets are plugin content and then you could somehow lock the content folder somehow without doing it on the OS level.
I know there are ReadOnlyTargetRules for modules.
#if WITH_FORWARDED_MODULE_RULES_CTOR
public Linter(ReadOnlyTargetRules Target) : base(Target)
#else
public Linter(TargetInfo Target)
#endif
Potentially a way to do it via build.cs? I’ve never actually used this but I did stumble upon it a while back. BTW that is old code, so there might be a better proper definition epic has changed it too without the preprocessor block.