# Failed ensure() when using certain property type in UStruct

**URL:** <https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623>\
**Category:** Blueprint\
**Tags:** UProperty, unreal-engine, crash, bug-report, question, Blueprint, CPP\
**Created:** [February 6, 2016, 8:02pm UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623 "2016-02-06T20:02:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [February 6, 2016, 8:02pm UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/1 "2016-02-06T20:02:39Z")

</div>

I have a UStruct with a non-standard integer UProperty as follows:

```
USTRUCT(BlueprintType)
struct FMyStruct
{
  GENERATED_BODY()

  UPROPERTY()
  int64 MyProperty;

  // Other data
};

```

As far as I can tell, this is supported so long as the property itself is not exposed through BlueprintReadWrite/EditAnywhere or related specifiers. For the most part everything is working as I’d expect, including replication of this struct.

There is a minor issue however. If I have a UFUNCTION taking this struct as an input parameter, and I call the function in blueprint without connecting anything to the pin, on blueprint compile the engine fails an [ensure in KismetCompilerVMBackend.cpp](https://github.com/EpicGames/UnrealEngine/blob/97c8d3ef55e869e17ef149903eae2a33101381c9/Engine/Source/Editor/KismetCompiler/Private/KismetCompilerVMBackend.cpp#L629). It appears the function in question is expecting only blueprint compatible properties.

---

<div class="post-metadata">

**Author:** ![teak421](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/teak421/32/902996_2.png) [@teak421](https://forums.unrealengine.com/u/teak421)\
**Post date:** [February 7, 2016, 12:56am UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/2 "2016-02-07T00:56:16Z")

</div>

Need to put into UPROPERTY(BlueprintPure)???

---

<div class="post-metadata">

**Author:** ![teak421](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/teak421/32/902996_2.png) [@teak421](https://forums.unrealengine.com/u/teak421)\
**Post date:** [February 7, 2016, 12:59am UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/3 "2016-02-07T00:59:14Z")

</div>

Also, doesn’t GENERATED\_BODY() need to be GENERATED\_USTRUCT\_BODY()? Have you seen Rama’s tutorial? It’s here…:[A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums](https://wiki.unrealengine.com/Structs,_USTRUCTS(),_They're_Awesome)

---

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [February 7, 2016, 1:54am UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/4 "2016-02-07T01:54:02Z")

</div>

No, the GENERATED\_BODY macro has superseded all the older versions. There’s very little practical difference, but GENERATED\_BODY should be used in all cases, as of 4.7 or so. Unfortunately that wiki page and many others are rather outdated now.

As for the UPROPERTY specification, BlueprintPure is only for functions, but anyway the point in this case is that while the struct is a blueprint type, the property itself is not exposed to blueprint. Being a 64 bit int, it can’t be.

---

<div class="post-metadata">

**Author:** ![teak421](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/teak421/32/902996_2.png) [@teak421](https://forums.unrealengine.com/u/teak421)\
**Post date:** [February 8, 2016, 7:13am UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/5 "2016-02-08T07:13:05Z")

</div>

Looks like I’m clueless… And, the documentation needs a bit of updating. And (one more)… I shouldn’t comment unless I’m pretty sure of things.

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [February 8, 2016, 9:07pm UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/6 "2016-02-08T21:07:35Z")

</div>

Hello,

Marking something as a UPROPERTY exposes it to the editor, which is most likely why you are seeing this ensure fail on your end. Try removing the UPROPERTY() from line 6, and seeing if you still get the same error.

As you’ve said, the 64 bit int is not supported in blueprint, which would explain why it is causing errors when you are trying to pass it into a function that is being called in blueprint.

Have a great day

---

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [February 8, 2016, 9:51pm UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/7 "2016-02-08T21:51:15Z")

</div>

Hi Sean.

I need it to be a UPROPERTY for serialization/replication support. Since it is not marked as Editable/Visible, nor BlueprintRead/Writable, the property itself is not exposed on the blueprint graph. As far as I understand, this shouldn’t preclude the struct from being a blueprint type, it will just mean this particular property cannot be accessed. I’ve done this many times before, the only difference here is that it’s a 64 bit integer. Since the property hasn’t been exposed to blueprint, I don’t think this should make a difference.

Anyway, regardless of what may or may not be supported, the point is that something which compiles without problem is causing a reproducible editor crash. So either there’s a bug in the function I linked, or UHT should be telling me that I can’t do what I’m doing at compile time.

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [February 10, 2016, 7:31pm UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/8 "2016-02-10T19:31:46Z")

</div>

The reason that the code compiles successfully is because that type is supported when using it in code. The ensure comes from attempting to use the unsupported type in a blueprint (as you have mentioned before).

I recommend using an int32 instead of int64, as this seemed to work correctly for me while I was testing.

Have a great day

---

<div class="post-metadata">

**Author:** ![kamrann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kamrann](https://forums.unrealengine.com/u/kamrann)\
**Post date:** [February 17, 2016, 10:33am UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/9 "2016-02-17T10:33:54Z")

</div>

Hi Sean.  
I realize an int32 would work, however I’m using int64 for a reason, and anyway that’s not what my report relates to.

There is a difference between declaring a struct as

```
USTRUCT(BlueprintType)
struct FMyStruct

```

and declaring a property within a struct as

```
UPROPERTY(BlueprintReadWrite)
int64 MyProperty;

```

The former allows variables of this struct type to be used in blueprints. The latter exposes an individual property to be read/written in blueprint - in this case it would result in a compiler error since int64 is not blueprint compatible. In the code posted in my initial question however, the property is not exposed, and the code compiles.

This ensure leads to an editor crash in editor code. It doesn’t make sense to say that it’s expected because I did something I wasn’t supposed to. If it is actually the case that having an unexposed int64 property within a BlueprintType struct is not allowed, then this should be flagged at compilation time.

This is by no means a major bug, but I find it strange that you would maintain it is expected behaviour for the editor to crash without any prior warning. Ensures are checks against conditions that should never happen - if they trigger, it implies there is something wrong with the code which has allowed it to trigger, not user error. The latter should be handled via either compilation failure or controlled editor feedback.

---

<div class="post-metadata">

**Author:** ![Sean\_Flint](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sean\_Flint](https://forums.unrealengine.com/u/Sean_Flint)\
**Post date:** [February 17, 2016, 7:17pm UTC](https://forums.unrealengine.com/t/failed-ensure-when-using-certain-property-type-in-ustruct/346623/10 "2016-02-17T19:17:48Z")

</div>

I have been able to reproduce the crash that occurs when attempting to pass that struct into a blueprint function, and have entered a bug report (UE-27073). Thank you for your report and for providing the necessary information. I will provide updates on this issue as they become available.

Have a great day
