How do you link derived UObject blueprints to UObject properties?
I'm trying to set up some blueprints for data and other purposes in the editor by deriving from UObject in C++ and creating blueprints with the compiled UObject classes. Everything is working fine so far, however, when I attempt to link up the UObject blueprint to anything else, nothing shows up. To be specific, I can see the property in the editor, but my new blueprint doesn't appear.
What's the intended way to do this? Does C++ documentation exist for this? The relevant code is below:
...and in my other C++ classes header files:
asked Sep 23 '18 at 01:25 AM in C++ Programming
Blueprint are classes not objects, There only 2 cases where you can can select object in properties:
1.Object is asset and it is asset regestry. all assets you see in content browsers are UObjects which can be saved (serielized) to binery files and loaded back. Blueprints are UBlueprint and they work like sorce code file that generates UClass which you can spawn in the world.
2.If object with properties exist in same level as this object. If object A exist in the level and object B is also there, both object A and B will be selectable in properties to any object in the world. That ofcorse can only be done with actors that are only classes that you can attach to the world.
So i think what you wanting to do require you to create asset type, class which object can be saved as assets. Cheapest and easiest way is to make UDataAsset, I can not find offical docs for this, but here you go (note that you dont need to make that struct as they doing, you can place any properties in there):
But this is short cut method as normally you need to make a UFactory and AssetTypeActions for asset to create real deal asset (this is also not documented so here first tutorial i found):
This also requires creation of editor module as UFactory is part of editor so it won't build on packaging. The asset type class it self would be in runtime module.
Using this method you can also make custom editor for asset if you want to go farther this route, by default if there is not editor defined, editor opens asset in property editor and shows all exposed properties for edit exactly as in case of UDataAsset
Blueprint (and effectively C++ classes too) defaults can be data holders too, but only in case of being related to the class it self. For example you make a weapon blueprint and you hold cost of weapon in class defaults, you can read it up from default object inside UClass without creating object of class.
And yes you can read those values from different classes, if you make UClass property (this includes TSubclassOf), you can get default object and read defaults values, but this requires extra steps that why people prefer to at least use UDataAssets if data is not direcly related to class
Follow this question
Once you sign in you will be able to subscribe for any updates here