Adding Paper2d to Existing Code Project

I’ve created a Blank C++ project and already started working building out components. It occurred to me that I wanted to implement one piece of my level as a set of Paper2d sprites.

What are the steps that I need to go through in the Editor and Visual Studio to get the header files correctly linked, along with any other components, into my project?

Heya,

You need to depend on the Paper2D module and include the appropriate header(s).

Module (in your game Build.cs file):

PublicDependencyModuleNames.Add("Paper2D");

Header(s) (in some game .cpp or .h that needs a Paper2D type):

#include "PaperCharacter.h" (or whatever)

We did a pass to DLL-export more symbols in 4.4, but if you get any link errors please let us know and we’ll get them exported as well.

Cheers,
Michael Noland

Interestingly when I do this I still don’t see the headers in the External Deps folder in the solution explorer. No longer getting “header not found” errors though so this solves it, seems like.

Hi Thomas,

I’m not sure how that folder is populated by VS; it doesn’t have any impact on compilation (vcxproj files are purely for human consumption and are ignored by UBT). Maybe it’ll show up if you regenerate your project files?

Cheers,
Michael Noland

Rightclick on your project then go to Properties, NMake. There you can edit the include search paths and add

E:\UE4\Unreal Engine\4.4\Engine\Plugins\Experimental\Paper2D\Source\Paper2D\Public

and

E:\UE4\Unreal Engine\4.4\Engine\Plugins\Experimental\Paper2D\Source\Paper2D\Classes 

(or your equivalanet) to it.

in 4.17.2, same problem in VS, even I tried"

#include "../../Engine/Plugins/2D/Paper2D/Source/Paper2D/Classes/PaperSpriteComponent.h"

…but no win.
It compiles fine, but VS doesn’t comes up with clear declaration.

but when I add this. things works fime … ! …

#include "Runtime/Engine/Classes/Components/SphereComponent.h"

here is my .h file: pretty simple file …

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "../../Engine/Plugins/2D/Paper2D/Source/Paper2D/Classes/PaperSpriteComponent.h"
#include "Runtime/Engine/Classes/Components/SphereComponent.h"
#include "Ball.generated.h"


UCLASS()
class PONG_API ABall : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	ABall();

protected:

private:

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprite", meta = (AllowPrivateAccess = "true"))
		UPaperSpriteComponent* Sprite;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Sprite", meta = (AllowPrivateAccess = "true"))
		USphereComponent* Sphere;

};

can someone explain bit more, …