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 the uproperty donest work

alt text

In C++ I set the UProperty like above picture. But i cannt edit the Camera property in blueprint, even cannt see.... why!

alt text

Product Version: UE 4.16
Tags:
more ▼

asked Jun 16 '17 at 08:10 AM in Using UE4

avatar image

Amylee
8 1 5

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

2 answers: sort voted first

Did you create the Camera in your .cpp file with CreateDefaultSubobject?

more ▼

answered Jun 16 '17 at 08:26 AM

avatar image

Ninjin
4.1k 88 38 151

avatar image Amylee Jun 16 '17 at 08:32 AM

AMyFpsCharacter::AMyFpsCharacter(const FObjectInitializer& PCIP) : Super(PCIP)

{

this->FirstPersonCameraComponent = PCIP.CreateDefaultSubobject(this, TEXT("FirstPersonCamera"));

this->FirstPersonCameraComponent->AttachTo(this->GetCapsuleComponent());

this->FirstPersonCameraComponent->bUsePawnControlRotation = true;

}

avatar image Ninjin Jun 16 '17 at 08:59 AM

This is what I'm using:

FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("MyCamera"));

I also recommend getting rid of "this->". Everyone knows the context. Also instead of AttachTo, you are using SetupAttachement in the constructor. If that was helpful, make sure to mark this as answer! <3

avatar image Amylee Jun 19 '17 at 07:11 AM

i found ue4 source code,DEPRECATED(4.12, "This function is deprecated, please use AttachToComponent instead.") bool AttachTo(........); so... thx!

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

You may want to try a few different things.

A.) You can make the class public like this

 public:
 
      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
      class UCameraComponent* FirstPersonCameraComponent;

B.) Make a public accessor for your protected class member

 protected:
 
      UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
      class UCameraComponent* FirstPersonCameraComponent;
 
 public:
 
      FORCEINLINE class UCameraComponent* GetFirstPersonCamera() const 
      {
           return FirstPersonCameraComponent;
      }


I expect that will get you up and running in the editor.

more ▼

answered Jun 16 '17 at 07:40 PM

avatar image

ZeroParadigm
270 8 9 16

avatar image Amylee Jun 19 '17 at 07:10 AM

thx!!!!!!!

(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