Migrating Turret

This guide will explain how to get the turret into any Unreal project.

Convert To C++ Project If Needed
Firstly the AutoTurret can only be migrated to an Unreal C++ project. A Blueprint project can be converted to a C++ project, here is Unreal's official guide on how:

https://wiki.unrealengine.com/How_to_Convert_a_BP/Content_Project_to_a_C%2B%2B_Project_in_8_Steps

Migrating Files
Unreal Engine's official wiki contain information on migrating files from both C++ and Blueprints to another project:

https://wiki.unrealengine.com/Migrate_content_between_projects#Migrating_from_C.2B.2B_Project_to_C.2B.2B_Project

However I will explain my method below as I find this much quicker and easier (tested in Unreal version 4.16.3):

1. Go into the Unreal file you wish to migrate the Turret to and create the following C++ Classes, make sure you name the classes the same as me otherwise this method will not work:

2. Copy and paste the code from the same .h and .cpp files from the Turret_API to the C++ classes you have just created.

3. Under each .h file at the top of the Class file you will see "TURRET_API" (see picture below in red square). Change this to the name of you project. 4. Compile and save the project (make sure there is no errors) - go into your Unreal project files YOURPROJECT / Config > DefaultEngine.ini. Open this in a notepad or something similar and add these lines of code at the bottom: [/Script/Engine.Engine]

+ActiveClassRedirects=(OldClassName="AutoTurret",NewClassName="/Script/YOURNEWPROJECTNAME.AutoTurret")

+ActiveClassRedirects=(OldClassName="AutoTurretAimingComponent",NewClassName="/Script/YOURNEWPROJECTNAME.AutoTurretAimingComponent")

+ActiveClassRedirects=(OldClassName="AutoTurretBarrel",NewClassName="/Script/YOURNEWPROJECTNAME.AutoTurretBarrel")

+ActiveClassRedirects=(OldClassName="AutoTurretProjectile",NewClassName="/Script/YOURNEWPROJECTNAME.AutoTurretProjectile")

+ActiveClassRedirects=(OldClassName="AutoTurretRotator",NewClassName="/Script/YOURNEWPROJECTNAME.AutoTurretRotator") Note that were it says "YOURPROJECTNAME" you must replace this with the same name as your project (Caps in the right place) - this will make sure that when you migrate the blueprint classes the engine knows how to connect it to the C++ Class it derived from.

5. Finally go back into the Turret project and migrate all the content folders including all the materials, meshes, and Blueprint Classes into your new project. They should now work.

The Turret_BP may need some blueprint code deleting and re-adding in order to compile - this is a know Unreal bug

Now you have successfully migrated the Turret, you may want to look at the guide on how to use it.

A useful link from a forum post on migrating C++ and Blueprint classes - https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/24493-migrate-code-based-blueprint?53785-migrate-code-based-blueprint=