While following the "3rd Person Power-Up Game with C++ Video Tutorials using Xcode, I have been unable to proceed pass the third video. I am using OSX Yosemite Version 10.10.3, Xcode 6.1, and Unreal Engine 4.7.6. The UE4 Editor will only compile from Xcode before I add the code to the Pickup class in Xcode given in the 3rd Video of the Series. So, I was going though the code line by line comment and remove comments to see if I could figure out why it would not open the UE4 Editor from Xcode after successfully compiling before code was added. The following lines of code are causing problems and the last one is caused the crash:
from the Header File
UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = Pickup);
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup);
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup);
UFUNCTION(BlueprintNativeEvent);
from the Source File
BaseCollisionComponent = PCIP.CreateDefaultSubobject(this,TEXT(“BaseSphereComponent”));//Compile Failure;
RootComponent = BaseCollisionComponent; // Crash
Header File:
UCLASS()
class TUTORIALCODEMOBILE4_API APickup : public AActor
{
GENERATED_BODY()
/** True when the pickup is able to be picked up, false if something deactivates the pickup. */
UPROPERTY(EditAnywhere,BlueprintReadWrite, Category = Pickup);
bool bIsActive;
/** Simple collision primitive to use as the root component. */
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup);
TSubobjectPtr<USphereComponent> BaseCollisionComponent;
/** StaticMeshComponent to represent the pickup in the level. */
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup);
TSubobjectPtr<UStaticMeshComponent> PickupMesh;
/** Function to call when the Pickup is collected. */
UFUNCTION(BlueprintNativeEvent);
void OnPickedUp( );
public:
// Sets default values for this actor’s properties
APickup();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};
Pickup class Source File:
// Sets default values
APickup::APickup()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don’t need it.
PrimaryActorTick.bCanEverTick = true;
//The pickup is valid when it is created
bIsActive = true;
// Create the root SphereComponent to handle the pickup’s collision
BaseCollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT(“BaseSphereComponent”));//Compile Failure
// Set the SphereComponent as the root component
RootComponent = BaseCollisionComponent;
// Create the static mesh component
PickupMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT(“PickupMesh”));
// Turn physics on for the static mesh
PickupMesh->SetSimulatePhysics(true);
// Attach the StaticMeshComponent to the root component
PickupMesh->AttachTo(RootComponent);
}
void APickup::OnPickedUp_Implementation(){ //There is no default behavior for a Pickup when it is picked up. }
// Called when the game starts or when spawned
void APickup::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void APickup::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
Error below:
ExternalBuildToolExecution TutorialCodeMobile4Editor\ -\ Mac
cd /Users/Shared/UnrealEngine/4.7
export ACTION=
/Users/Shared/UnrealEngine/4.7/Engine/Build/BatchFiles/Mac/RocketBuild.sh TutorialCodeMobile4Editor macosx DebugGame /Users/ArmorBearer/Documents/Unreal\ Projects/TutorialCodeMobile4/TutorialCodeMobile4.uproject
Setting up Mono
Building TutorialCodeMobile4Editor…
Compiling game modules for hot reload
Compiling with Mac SDK 10.10
Parsing headers for TutorialCodeMobile4Editor
/Users/ArmorBearer/Documents/Unreal Projects/TutorialCodeMobile4/Source/TutorialCodeMobile4/Pickup.h(15) : Error: In Pickup: BlueprintReadWrite should not be used on private members
Error: Failed to generate code for TutorialCodeMobile4Editor - error code: OtherCompilationError (2)
UnrealHeaderTool failed for target ‘TutorialCodeMobile4Editor’ (platform: Mac, module info: /Users/ArmorBearer/Documents/Unreal Projects/TutorialCodeMobile4/Intermediate/Build/Mac/TutorialCodeMobile4Editor/DebugGame/UnrealHeaderTool.manifest).
Command /Users/Shared/UnrealEngine/4.7/Engine/Build/BatchFiles/Mac/RocketBuild.sh failed with exit code 2