Hello mates.
I am new to the UE4 programming. Decided to make a start and got on this one.
Then I remembered with 4.6 some changes were made. Than followed here to make the necessary changes with cınstructor and pointers.
https://forums.unrealengine.com/showthread.php?53389-4-6-Transition-Guide
But I still get tremendous errors ( around 25) fır just a a .cpp and .h file that include around 20 lines of code or something. Serch around quite a bi but decided to ask it on forums to see if I can get some help.
I just created an Actor from editor just like the tutorial suggested and here is the .cpp and .h files, error log and a screenshot.
Visual Studio 2013, x64.
.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "Pickup.generated.h"
UCLASS()
class TUTORIALCODE_API APickup : public AActor
{
GENERATED_BODY()
APickup(const FObjectInitializer& ObjectInitializer);
/** True when the pickup is available to be picked, faşse if something deactivates the pickup. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
bool bIsActive;
/**Simple collision component to use as root component*/
UPROPERTY(VisibleDefaultOnly, BlueprintReadOnly, Category = Pickup)
USphereComponent* BaseCollisionComponent;
/**Static mesh to represent the pickup in the level*/
UPROPERTY(VisibleDefaultOnly, BlueprintReadOnly, Category = Pickup)
UStaticMeshComponent* PickupMesh;
/**Function to call when the pickup is collected*/
UFUNCTION(BlueprintNativeEvent)
void OnPickedUp();
};
.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "TutorialCode.h"
#include "Pickup.h"
APickup::APickup(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
/**The ickup is active when ceated*/
bIsActive = true;
/**Create the root SphereComponent to handle the pickup's collision*/
BaseCollisionComponent = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));
/**Set the SphereComponent as the root component*/
RootComponent = BaseCollisionComponent;
/**Create static mesh component*/
PickupMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
/**Turn physics on for the statşc mesh*/
PickupMesh->SetSimulatePhysics(true);
/**Attach static mesh to root component*/
PickupMesh->AttachTo(RootComponent);
};
void APickup::OnPickedUp()
{
/**There is no default behavior for a pickup when it is pickedup*/
};
Error Log:
Error 1 error : In Pickup: BlueprintReadWrite should not be used on private members C:\UE4\Projects\TutorialCode\Source\TutorialCode\Public\Pickup.h 18 1 TutorialCode
Error 2 error code: OtherCompilationError (2) C:\UE4\Projects\TutorialCode\Intermediate\ProjectFiles\Error TutorialCode
Error 3 error MSB3073: The command ""C:\UE4\Epic Games\4.6\Engine\Build\BatchFiles\Build.bat" TutorialCodeEditor Win64 DebugGame "C:\UE4\Projects\TutorialCode\TutorialCode.uproject" -rocket" exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 TutorialCode
4 IntelliSense: identifier "FGuid" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Core\Public\Serialization\ArchiveBase.h 561 26 TutorialCode
5 IntelliSense: identifier "FGuid" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Core\Public\Serialization\ArchiveBase.h 569 18 TutorialCode
6 IntelliSense: identifier "FGuid" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Core\Public\Serialization\ArchiveBase.h 770 24 TutorialCode
7 IntelliSense: identifier "FOnSelectedLevelsChangedEvent" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Classes\Engine\World.h 1976 2 TutorialCode
8 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 890 68 TutorialCode
9 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 903 68 TutorialCode
10 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 921 69 TutorialCode
11 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 933 42 TutorialCode
12 IntelliSense: no instance of constructor "FReadSurfaceDataFlags::FReadSurfaceDataFlags" matches the argument list c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Public\UnrealClient.h 57 92 TutorialCode
13 IntelliSense: no instance of constructor "FReadSurfaceDataFlags::FReadSurfaceDataFlags" matches the argument list c:\UE4\Epic Games\4.6\Engine\Source\Runtime\Engine\Public\UnrealClient.h 65 87 TutorialCode
14 IntelliSense: identifier "FMeshBatchElement" is undefined c:\UE4\Epic Games\4.6\Engine\Source\Runtime\ShaderCore\Public\VertexFactory.h 488 131 TutorialCode
15 IntelliSense: cannot open source file "Pickup.generated.h" c:\UE4\Projects\TutorialCode\Source\TutorialCode\Public\Pickup.h 6 1 TutorialCode
16 IntelliSense: "Super" is not a nonstatic data member or base class of class "APickup" c:\UE4\Projects\TutorialCode\Source\TutorialCode\Private\Pickup.cpp 10 3 TutorialCode
17 IntelliSense: no default constructor exists for class "AActor" c:\UE4\Projects\TutorialCode\Source\TutorialCode\Private\Pickup.cpp 11 1 TutorialCode
Here is a screenshot. Please notice the Private and Public parts on the left. I dşdn’t create those and in tut video it doesn’t look lşke that. Any ideas ?
thanks in advance for everyone who gives a hand