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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Instanced class TArray not showing classes

For a spawner system in a game I'm working on, I want designers to be able to place Spawners in the level. These Spawners will then spawn enemies based on one or multiple SpawnTypes. To do this, I created a Spawner C++ class from which the Spawner Blueprint is derived which contains the following variable:

 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "AI Spawner", Instanced)
  TArray<class USpawnTypeCPP*> SpawnCondition;

This array shows up like this in the editor:

Editor view

The problem with it is that when you click the drop-down menu to select the Spawn Condition to set, no options show up, even though there are 3 SpawnType blueprints based on the USpawnTypeCPP class. Once the SpawnType blueprints are opened, they do show up in the drop-down menu. Why is this happening and how do I fix it?

Alternatively, is there another way to do this? Basically what I want is an array of SpawnTypes which will for example check based on distance to the player, check if the player is in a certain position etc. When the SpawnType is set to check the distance, I want a distance variable to show up in the editor. When the SpawnType is set to area, I want a TriggerVolume variable to show up in the editor (and no distance variable) etc.

The full AISpawner C++ class: http://pastebin.com/8Sja9K2z

The SpawnType C++ UObject header: http://pastebin.com/nFJnbJPi

The SpawnType C++ UObject class: http://pastebin.com/DLMt614J

Product Version: UE 4.15
3uoohuq.png (3.1 kB)
more ▼

asked Mar 13 '17 at 11:10 AM in Using UE4

avatar image

11 1 5

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

1 answer: sort voted first

This should fix it:

 TArray<TSubclassOf<USpawnTypeCPP>> SpawnCondition;

In order for the editor class selection to work properly you have to use "TSubclassOf".

more ▼

answered Mar 13 '17 at 02:31 PM

avatar image

1.2k 46 29 59

avatar image Wuppy29 Mar 13 '17 at 02:37 PM

I tried that as one of the solutions and it will show all the SpawnType blueprints. However, the variables for each SpawnType don't show anymore and you can only select the class type.

The current setup:

Variable setup

Designers need to be able to change the distance variable individually for each spawner.

(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