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"

Converting source files from previous versions

Dear UE4 Community,

I'm trying to convert a header and cpp file syntax from an older version to 4.9, Can you please help me? Thanks. Iknow that USphereComponent is now declared as a pointer, but can't figure out the rest, thanks again.

Header File

 UCLASS()
 class GOLDENEGG_API ANPC : public ACharacter
 {
   GENERATED_UCLASS_BODY()
   // This is the NPC's message that he has to tell us.
   UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =   
   NPCMessage)
   FString NpcMessage;
   
   // The sphere that the player can collide with to get item
   UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category =   
   Collision)
   TSubobjectPtr<class USphereComponent> ProxSphere;
   
   // The corresponding body of this function is 
   // ANPC::Prox_Implementation, __not__ ANPC::Prox()!
   // This is a bit weird and not what you'd expect,
   // but it happens because this is a BlueprintNativeEvent
   UFUNCTION(BlueprintNativeEvent, Category = "Collision")
   void Prox( AActor* OtherActor, UPrimitiveComponent* OtherComp,   
   int32 OtherBodyIndex, bool bFromSweep, const FHitResult &   
   SweepResult );
 };

 

CPP FILE

 ANPC::ANPC(const class FPostConstructInitializeProperties& PCIP) : 
 Super(PCIP)
 {
   ProxSphere = PCIP.CreateDefaultSubobject<USphereComponent>(this,   
   TEXT("Proximity Sphere"));
   ProxSphere->AttachTo( RootComponent );
   ProxSphere->SetSphereRadius( 32.f );
  
   // Code to make ANPC::Prox() run when this proximity sphere
   // overlaps another actor.
   ProxSphere->OnComponentBeginOverlap.AddDynamic( this,   
   &ANPC::Prox );
   NpcMessage = "Hi, I'm Owen";//default message, can be edited
   // in blueprints
 }


Product Version: UE 4.9
Tags:
more ▼

asked Oct 06 '15 at 08:30 PM in C++ Programming

avatar image

WTony12
1 1

avatar image Shadowriver Oct 06 '15 at 08:50 PM

Does it build? If it builds and you don't have any warnings (In UE4 before something is removed or changed it's depricated and shows warning during compilation) then everything is ok

avatar image WTony12 Oct 06 '15 at 09:00 PM

Hey Shadowriver, thanks for the quick reply.

Yeah its giving me lots of errors unfortunately and doesn't build:

link text

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

0 answers: sort voted first
Be the first one to answer this question
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