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 to reference one blueprint from another?

I am writing an Actor class in C++.

I have created a blueprint class that derives from this Actor class.

I want to be able to reference some other blueprint class from within my Actor blueprint (so I can spawn it through code), but when I create a UProperty it only seems to be letting me select from Actors that are in the currently opened map.

I want a reference to a non-scene object.

Example code:

 class AMyActorClass : public AActor
 {
     UPROPERTY(EditAnywhere)
     AActor* ReferencedActor;
 }

In the above example, When I go to edit the blueprint class and try to assign some other blueprint to ReferencedActor, I am unable to select anything other than Actors in the currently loaded map.

Product Version: UE 4.18
Tags:
more ▼

asked Jan 05 '18 at 10:44 AM in C++ Programming

avatar image

jonnybolton42
12 4 4 7

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

1 answer: sort voted first

Hey here, so you want to be able to select a type of an actor and not an instance correct? if that is the case you can do this:

 UPROPERTY(EditAnywhere, Category = "Test")
 TSubclassOf<AActor> ActorClass; // You can specify whatever type you want and it will filter the dropdown options

This will create a dropdown where you can select from all of the child classes of the class you specified. Then you just use the variable itself like it's an UClass for the SpawnActor, for example.

more ▼

answered Jan 05 '18 at 11:05 AM

avatar image

xlar8or
6k 163 130 305

avatar image jonnybolton42 Jan 05 '18 at 11:08 AM

Thank you very much. That's exactly what I needed.

(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