# APlayerStart Subclass works in editor, ignored on standalone

**URL:** <https://forums.unrealengine.com/t/aplayerstart-subclass-works-in-editor-ignored-on-standalone/302545>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 27, 2014, 6:17pm UTC](https://forums.unrealengine.com/t/aplayerstart-subclass-works-in-editor-ignored-on-standalone/302545 "2014-12-27T18:17:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [December 27, 2014, 6:17pm UTC](https://forums.unrealengine.com/t/aplayerstart-subclass-works-in-editor-ignored-on-standalone/302545/1 "2014-12-27T18:17:25Z")

</div>

I created a subclass of APlayerStart so that I could add a few extra properties to it. The game is a turn-based strategy, which would require some extra properties like grid location, type of units to spawn for asymmetric game modes, and so forth.

Deleting the regular PlayerStart and adding my own works great in editor. If I attempt to run standalone (either with “Launch” or by compiling the project without the editor) then my PlayerPawn is NULL and I just get a camera at 0,0,0. When I use a normal PlayerStart, it’s fine.

For now, I expect that I will work around this issue by creating an actor that spawns a normal APlayerSpawn in its constructor and manages its properties (location, direction, tag, etc.). Alternatively, I could just fork the engine and modify PlayerStart to suit my purposes, but I obviously want to keep using Epic’s canonical builds for as long as possible.

And really, I’m more curious about why it works great in the editor but not in game. I was looking through Epic’s code and cannot really see where it’s going wrong. Note that TileManager is an Actor that spawns (and stores a list of) tiles that pieces can (or cannot) move to.

ChessBattlePlayerStart.h

```
#pragma once
#include "GameFramework/PlayerStart.h"
#include "ChessBattlePlayerStart.generated.h"

/**
 * 
 */
class ATileManager;

UENUM(BlueprintType)
namespace EStartViewDirection
{
	enum Direction
	{
		North UMETA(DisplayName = "North"),
		East UMETA(DisplayName = "East"),
		South UMETA(DisplayName = "South"),
		West UMETA(DisplayName = "West")
	};
}

UCLASS()
class CHESS_API AChessBattlePlayerStart : public APlayerStart
{
	GENERATED_BODY()

public:
	//Will determine the starting tiles of this player start;
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = PlayerStartProperties)
	int32 StartTileX;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = PlayerStartProperties)
	int32 StartTileY;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = PlayerStartProperties)
	TEnumAsByte<EStartViewDirection::Direction> StartDirection;

	AChessBattlePlayerStart(const FObjectInitializer& ObjectInitializer);

#if WITH_EDITOR
	virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
	void MoveToCoordinate(int32 x, int32 y, TEnumAsByte<EStartViewDirection::Direction> Direction);
	ATileManager* GetTileManager();
#endif
};

```

ChessBattlePlayerStart.cpp

```
 #include "Chess.h"
#include "ChessBattlePlayerStart.h"
#include "TileManager.h"
#include "Tile.h"

AChessBattlePlayerStart::AChessBattlePlayerStart(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	StartTileX = -1;
	StartTileY = -1;
	StartDirection = EStartViewDirection::North;
}

#if WITH_EDITOR
void AChessBattlePlayerStart::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{
	Super::PostEditChangeProperty(PropertyChangedEvent);
	MoveToCoordinate(StartTileX, StartTileY, StartDirection);
}

void AChessBattlePlayerStart::MoveToCoordinate(int32 x, int32 y, TEnumAsByte<EStartViewDirection::Direction> Direction)
{
	ATileManager* TileManager = GetTileManager();
	//If invalid coordinate, don't bother.
	if (x < 0 || y < 0 || x >= TileManager->GetMaxX() || y >= TileManager->GetMaxY())
	{
		return;
	}

	ATile* CurrentTile = TileManager->GetTileAtCoordinate(x, y);
	float xLoc = CurrentTile->GetActorLocation().X;
	float yLoc = CurrentTile->GetActorLocation().Y;

	FVector location = FVector(xLoc, yLoc, 100.f);

	//StartDirection is 0 (North) through 3 (West). Should be just multiplying by 90 deg (float).
	//North is +X
	float viewDir = (float)StartDirection * 90.f;

	FRotator rotation = FRotator(0.f, viewDir, 0.f);
	this->SetActorLocationAndRotation(location, rotation);
}

ATileManager* AChessBattlePlayerStart::GetTileManager()
{
	for (TActorIterator<ATileManager> ActorItr(()); ActorItr; ++ActorItr)
	{
		//Return (pointer to) the last actor of type ATileManager in the world.
		ATileManager* output = *ActorItr;
		return output;
	}

	return NULL;
}
#endif

```

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [December 27, 2014, 8:12pm UTC](https://forums.unrealengine.com/t/aplayerstart-subclass-works-in-editor-ignored-on-standalone/302545/2 "2014-12-27T20:12:12Z")

</div>

APlayerStart is not really needed, aspecially when you make staticly postioned player

---

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [December 27, 2014, 11:39pm UTC](https://forums.unrealengine.com/t/aplayerstart-subclass-works-in-editor-ignored-on-standalone/302545/3 "2014-12-27T23:39:38Z")

</div>

Actually the player is not stationary. It can float over the map.
