# Blueprint Nativization & TArray of TSubClassOf error

**URL:** <https://forums.unrealengine.com/t/blueprint-nativization-tarray-of-tsubclassof-error/392171>\
**Category:** Blueprint\
**Tags:** tarray, tsubclassof, unreal-engine, bug-report, Blueprint, question\
**Created:** [April 28, 2017, 3:30pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-tarray-of-tsubclassof-error/392171 "2017-04-28T15:30:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zamy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zamy](https://forums.unrealengine.com/u/zamy)\
**Post date:** [April 28, 2017, 3:30pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-tarray-of-tsubclassof-error/392171/1 "2017-04-28T15:30:18Z")

</div>

## Description

When a BlueprintCallable function returns a TArray of TSubclassOf(MyType), the nativization tries to manage it as a TArray of UClass\*, thus failing to assign it to a variable.

## How to reproduce

- create a new c++ blank project
- create a new c++ class (i used a StaticMeshActor as parent, but it’s the same)
- create a new function in the newly reated class as this one:

.h file

```
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Engine/StaticMeshActor.h"
#include "MyStaticMeshActor.generated.h"

/**
 * 
 */
UCLASS()
class NATIVETESTING_API AMyStaticMeshActor : public AStaticMeshActor
{
	GENERATED_BODY()

	UFUNCTION(BlueprintCallable, Category = "Test")
	TArray<TSubclassOf<AMyStaticMeshActor>> Test();
};

```

.cpp file

```
// Fill out your copyright notice in the Description page of Project Settings.

#include "NativeTesting.h"
#include "MyStaticMeshActor.h"

TArray<TSubclassOf<AMyStaticMeshActor>> AMyStaticMeshActor::Test()
{
	return TArray<TSubclassOf<AMyStaticMeshActor>>();
}

```

- now create a blueprint with the c++ class as parent, and create these nodes (note the variable type)

 ![135962-bugreportscreenshot.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/3/2a34279e99880909649fa09c2a909e5095de1a8a.png)

- set nativization as inclusive, and package the project, it will fail.

## Explanation

It generates this code

in .h the variable is declared as

```
TArray<UClass*> bpv __NewVar_0__ pf;

```

Note that the type is wrong.

in the .cpp it tries to assign it with:

```
b0l __CallFunc_Test_ReturnValue__ pf = AMyStaticMeshActor::Test();

```

that obviously fails.

## Expected behaviour

The generated code should remain true to the variable / return type, so use a TArray of TSbuclassOf instead of TArray of UClass\*

Hope this helps 🙂

Simone Daminato

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [April 28, 2017, 6:26pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-tarray-of-tsubclassof-error/392171/2 "2017-04-28T18:26:59Z")

</div>

Hey

Thank you for the report - I have reproduced this issue and have entered a report for it here: [Unreal Engine Issues and Bug Tracker (UE-44511)](https://issues.unrealengine.com/issue/UE-44511) .

Cheers
