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"

UPROPERTY Compiler Error with BlueprintReadWrite

I made c++ class that uses ue4's Actor as the parent. I am trying to make the variables usable within blueprints. Whenever I try to add any blueprint key words into UPROPERTY() it gives me a compiler error. I can use VisibleAnywhere, EditAnywhere, Category, etc, without any compiler errors at all.

Gives me compiler errors

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "MyActor.generated.h"
 
 UCLASS()
 class JUNGLE_DUNGEON_API AMyActor : public AActor
 {
     GENERATED_BODY()
 
     
 public:    
     // Sets default values for this actor's properties
     AMyActor();
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
     
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Int")
         int16 MyInt;
 };

No Compiler errors

 #pragma once
 
 #include "GameFramework/Actor.h"
 #include "MyActor.generated.h"
 
 UCLASS()
 class JUNGLE_DUNGEON_API AMyActor : public AActor
 {
     GENERATED_BODY()
 
     
 public:    
     // Sets default values for this actor's properties
     AMyActor();
 
     // Called when the game starts or when spawned
     virtual void BeginPlay() override;
     
     // Called every frame
     virtual void Tick( float DeltaSeconds ) override;
 
     
     UPROPERTY(EditAnywhere, Category = "Int")
         int16 MyInt;
 };

What am I doing wrong?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 20 '15 at 03:29 AM in C++ Programming

avatar image

DxP Black Death
8 1 2 4

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

1 answer: sort voted first

Hi,

Your variable "MyInt" is of type int16, which is not supported in Blueprints. The only numerical types supported in Blueprints are uint8, int32 and float.

Also see this Question: https://answers.unrealengine.com/questions/98206/missing-support-for-uint32-int64-uint64.html

So basically you need to change your variable to int32 and everything should work fine.

Cheers, Elewyth

more ▼

answered Aug 20 '15 at 11:16 AM

avatar image

Elewyth
412 24 19 34

avatar image DxP Black Death Aug 20 '15 at 08:24 PM

Thanks for the help.

avatar image Elewyth Aug 21 '15 at 07:19 AM

If that solved your problem, would you mind accepting my answer? That way anyone with a similar problem can see right away, that the problem has been solved, and will more likely click on this question, when looking for an answer :)

avatar image Ethergeist May 17 '16 at 01:45 AM

Thanks for this, I spent half an hour googling with nothing coming up. This info really should be added to the Blueprint specifiers in the UPROPERTY docs.

(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