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 set up actor in blueprint

I've made class, derived from AActor: KeyAActor. It has this field:

UPROPERTY ( EditAnywhere, BlueprintReadWrite, Category = "Button properties" ) AActor* keys;

But I can not set up keys component in editor.alt text

What have I done wrong? Thanks!

Product Version: Not Selected
Tags:
more ▼

asked Feb 24 '15 at 07:48 AM in C++ Programming

avatar image

MikhailMaximov
15 3 5 9

avatar image Dune Feb 24 '15 at 10:50 AM

What are you trying to set this value to? Do you have some AActor's setup in the editor that you can add here?

avatar image MikhailMaximov Feb 24 '15 at 05:13 PM

I've tried to make class, derived from UObject KeyProcessor, that have couple of virtual functions, to override them in blueprint. I've tried to make KeyProcessor* keys, an that didn't work. Then I changed to AActor* because I wanted to check, if my class is worng or something else.

avatar image ZombieKemist Feb 24 '15 at 07:26 PM

If you want to use a class derived directly from UObject you can't use AActor, since UObject is a parent of AActor. I think the other problem you are having is that references to actors in the defaults can only be to instances that already exist in the scene. Do you have a scene with actors already? If not, try adding a few and see if you can select those.

avatar image MikhailMaximov Feb 25 '15 at 05:43 PM

Okay, and can I assign UObject pointers in defaults?

avatar image ZombieKemist Feb 25 '15 at 07:12 PM

I don't think you can. Basically, you have to make sure the object exists before you can assign it. Anything in the defaults has to already be in the level since it will be assigned as soon as your actor is created. In your case, if you don't want to physically place instances in the level, you probably want to use the construction script or begin play node in your KeyAActor class to create the KeyProcessor items you want, then assign them to the array.

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

1 answer: sort voted first

From object pointers you can only set objects that are already placed in level in defaults (but i'm not sure) and details tab, you can't guaranty the code that specific object will exist when object will be spawned (that why i'm not sure with defaults). If you want to select class (C++ class or blueprint, they both classes) that you will spawn for example you need to use UClass* for all classes selection or

 TSubclassOf<ClassName>

for limited selection (ClassName is a class of base class of classes that will be listed)

more ▼

answered Feb 24 '15 at 07:48 PM

avatar image

Shadowriver
35.7k 925 168 1102

avatar image MikhailMaximov Feb 25 '15 at 07:04 PM

You are my hero! TSubclassOf working!

(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