x

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"

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:

 UCLASS(Blueprintable, BlueprintType)
 class UMyObject : public UObject
 {
     GENERATED_BODY()
 };

...and in my other C++ classes header files:

 UPROPERTY(EditDefaultsOnly)
 class UMyObject* MyObject = nullptr;

Product Version: UE 4.20
Tags:
more ▼

asked Sep 23 '18 at 01:25 AM in C++ Programming

avatar image

Artemis_
45 2 3 6

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

1 answer: sort voted first

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):

http://www.levelplusgames.com/ue4-c-data-assets/

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):

https://gmpreussner.com/reference/adding-new-asset-types-to-ue4

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.

https://api.unrealengine.com/INT/API/Runtime/CoreUObject/UObject/UClass/GetDefaultObject/1/index.html

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

more ▼

answered Sep 23 '18 at 04:06 AM

avatar image

Shadowriver
33.9k 916 164 1093

(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