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"

Why can't I change variables in Editor?

Hey! I started working with C++ and had a small problem with my variables. They show up in the player's blue print, but I can't actually modify any of the variables. Anyone know why?

     // Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
     #pragma once
     
     #include "InstinctCharacter.generated.h"
     
     UCLASS(config=Game)
     class AInstinctCharacter : public ACharacter
     {
         GENERATED_UCLASS_BODY()
     
         /** Pawn mesh: 1st person view (arms; seen only by self) */
         UPROPERTY(VisibleDefaultsOnly, Category=Mesh)
         TSubobjectPtr<class USkeletalMeshComponent> Mesh1P;
     
         /** First person camera */
         UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
         TSubobjectPtr<class UCameraComponent> FirstPersonCameraComponent;
     
         /** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */
         UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
         float BaseTurnRate;
     
         /** Base look up/down rate, in deg/sec. Other scaling may affect final rate. */
         UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera)
         float BaseLookUpRate;
     
         /** Gun muzzle's offset from the characters location */
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
         FVector GunOffset;
     
         /** Projectile class to spawn */
         UPROPERTY(EditDefaultsOnly, Category=Projectile)
         TSubclassOf<class AInstinctProjectile> ProjectileClass;
     
         /** Sound to play each time we fire */
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
         USoundBase* FireSound;
     
         /** AnimMontage to play each time we fire */
         UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gameplay)
         UAnimMontage* FireAnimation;
     
         //Player health
         UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Health)
         INT64 plHealth;
     
         //Max Player health
         UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Health)
         INT64 plMaxHealth;
     
         //Initial Health
         UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Health)
         INT64 plInitHealth;
         
         UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Weapon)
         INT64 wpAmmo;
     
         UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Weapon)
         INT64 wpInitAmmo;
     
         UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Weapon)
         INT64 wpMaxAmmo;
     
         UFUNCTION()
         void dealDamage(INT64 Damage);
     
         virtual void BeginPlay() OVERRIDE;
     
     protected:
     
         /** Handler for a touch input beginning. */
         void TouchStarted(const ETouchIndex::Type FingerIndex, const FVector Location);
     
         /** Fires a projectile. */
         void OnFire();
     
         /** Handles moving forward/backward */
         void MoveForward(float Val);
     
         /** Handles stafing movement, left and right */
         void MoveRight(float Val);
     
         /**
          * Called via input to turn at a given rate.
          * @param Rate    This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
          */
         void TurnAtRate(float Rate);
     
         /**
          * Called via input to turn look up/down at a given rate.
          * @param Rate    This is a normalized rate, i.e. 1.0 means 100% of desired turn rate
          */
         void LookUpAtRate(float Rate);
     
     protected:
         // APawn interface
         virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) OVERRIDE;
         // End of APawn interface
     };
 

Thank you in advance!

Edit: Posted the whole header code due to a request.

Below: This is what I get in Blueprint. I can see it, but I cannot modify it. plHealth

Product Version: Not Selected
Tags:
plhealth.png (1.8 kB)
more ▼

asked Apr 26 '14 at 09:59 PM in C++ Programming

avatar image

Borzi
174 44 39 49

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

3 answers: sort voted first

Judging from my experiences and other tutorials, including the one from Epic Games, it seems normal that you are not able to edit the default values in the editor. I guess I will just have to use the .cpp file for that kinda stuff.

Example: https://www.youtube.com/watch?v=Q3AvZmZEPyc

When he creates the blueprint, you can see that the "rotation rate" variable is also greyisch like my variables, meaning he cant edit them either.

Edit - Nevermind, this got it to work somehow:

 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Health)

Jokes on me.

more ▼

answered May 01 '14 at 04:41 PM

avatar image

Borzi
174 44 39 49

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

Blueprint for some reason currently does not support int16 type, use int32 insted

more ▼

answered Apr 27 '14 at 12:08 AM

avatar image

Shadowriver
37.3k 936 172 1117

avatar image Borzi Apr 27 '14 at 10:09 AM

Well now I have

 //Player health
     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Health)
     int32 plHealth;

And it still just shows a grey "0" in the blueprint and no way that I can edit it.

avatar image Solid Snake Apr 27 '14 at 12:20 PM

Did you hot recompile or did you do a recompile and reload?

avatar image Borzi Apr 27 '14 at 01:52 PM

I have no idea :D I built the solution, compiled in the editor and they appeared as they should (just without being editable)

avatar image Solid Snake Apr 27 '14 at 02:10 PM

Right, so compiling in the Editor is hot recompile. Try compiling in Visual Studio and then restarting the Editor.

avatar image Borzi Apr 27 '14 at 03:53 PM

Thank you for your reply, but unfortunatly, this doesn't really change anything. I built the whole solution once and it still doesn't let me change the values.

avatar image Solid Snake Apr 27 '14 at 04:00 PM

Is it possible to post up your entire C++ source code for that file?

avatar image Borzi Apr 27 '14 at 05:28 PM

Yes sure, it's just a slightly modified version of the epic games first person character header anyway. Check the question, I updated it.

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

Try to specify size in bits - int32 plHealth:2;

more ▼

answered May 01 '14 at 08:01 AM

avatar image

Dimetcm
1

(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