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"

TSubclassOf becomes Null when BP spawned

Hi.

I have room BP. Inside this BP i have custom component. In that component i have TSubclassOf variable, set with another trap BP that i need to spawn.

alt text

So when i spawn room BP from my code, this variable TSubclassOf becomes Null.

alt text

But! When i simply move room BP to the world, everything okay, and variable not Null, and trap BP is spawning.

How can i fix it?

P.s. Sorry for my english.

Product Version: UE 4.10
Tags:
trap.png (37.0 kB)
nulls.png (60.5 kB)
more ▼

asked Aug 27 '16 at 03:59 PM in C++ Programming

avatar image

Ignisor
93 3 7 16

avatar image ItsaMeTuni Aug 28 '16 at 01:09 AM

Are you spawning the room BP or its c++ class?

avatar image Ignisor Aug 28 '16 at 09:19 AM

I spawn room BP derived from class ARoom using TSubclassOf

avatar image Ignisor Aug 28 '16 at 09:54 AM

Also to spawn room BP i using BeginDeferredActorSpawnFromClass, but i tried to change it on SpawnActor and nothing changed.

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

1 answer: sort voted first

This is how i fixed it:

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Trap) TSubclassOf<class ATrap> Trap;
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Trap) TSubclassOf<class ATrap> NewTrap;

Simply duplicated variable!

more ▼

answered Aug 28 '16 at 10:39 AM

avatar image

Ignisor
93 3 7 16

(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