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"

Assigning actor component to UPROPERTY on other component in the editor

I have a UActorComponent implementation in C++ that has UPROPERTYs pointing to other UActorComponents.

In the editor, those UPROPERTYs show up, but are not assignable, even though the properties are marked with EditAnywhere and BlueprintReadWrite, e.g.

 UPROPERTY(Category = Spine, EditAnywhere, BlueprintReadWrite)
 UMyCustomComponent* MyComponent;

Interestingly enough, I also have custom asset classes that derrive from UObject, which I can set on UPROPERTYs in the editor just fine, e.g.

 class SPINEPLUGIN_API USpineSkeletonDataAsset: public UObject { ... }
 // then in one of my custom components
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Spine)
 USpineSkeletonDataAsset* SkeletonData;

What I'd like to be able to do is:

  1. Add my custom component of type A (written in C++) to an actor that has a UPROPERTY of type B (another customer component written in C++)

  2. Add another custom component of type B to the same actor

  3. In the Details View in the editor, set B on A's UPROPERTY of type B

When I try to set this up, the detail view of component A will show me the entry for the UPROPERTY of type B, but when I try to assign the component of type B to that UPROPERTY, the editor doesn't let me. Neither does it propose the B component in the search field, nor can I drag and drop the component.

I've tried all kinds of macro annotations, but no dice. Am I getting something conceptually wrong here?

Product Version: UE 4.14
more ▼

asked Dec 09 '16 at 09:32 AM in C++ Programming

avatar image

61 1 2 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You can use something like

 /** Actor or Component that the end of the cable should be attached to */
 UPROPERTY(EditAnywhere, Category="Cable")
 FComponentReference AttachEndTo;

to reference a component existing in a different actor. Unfortunately it seems there is no type safety here, and supported only USceneComponent classes

more ▼

answered Dec 09 '16 at 12:22 PM

avatar image

1k 13 8 31

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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