ACableActor undeclared

Hello,

I am trying to create cables with this code:

 ACableActor *cable1 = TheWorld->SpawnActor<ACableActor>(Loc, Rot);
            
            UGameplayStatics::FinishSpawningActor(cable1, FTransform());
            cable1->SetMaterial(cableMat);
            cable1->SetEndLocation(Loc2);

However they dont show up and the compiler throw these errors:

/Users//Documents/PLGTest/Source/PLGTest/BSPLevelCell.cpp:149:13: error: unknown type name 'ACableActor'
            ACableActor *cable1 = TheWorld->SpawnActor<ACableActor>(Loc, Rot);
            ^
/Users//Documents/PLGTest/Source/PLGTest/BSPLevelCell.cpp:149:56: error: use of undeclared identifier 'ACableActor'
            ACableActor *cable1 = TheWorld->SpawnActor<ACableActor>(Loc, Rot);
                                                       ^
/Users//Documents/PLGTest/Source/PLGTest/BSPLevelCell.cpp:149:68: error: expected unqualified-id
            ACableActor *cable1 = TheWorld->SpawnActor<ACableActor>(Loc, Rot);
                                                                   ^
3 errors generated.
-------- End Detailed Actions Stats -----------------------------------------------------------
Cumulative action seconds (8 processors): 0.00 building projects, 8.78 compiling, 0.00 creating app bundles, 0.00 generating debug info, 0.00 linking, 0.00 other
UBT execution time: 19.03 seconds
Compiling with Mac SDK 10.9
Deploying now!
Command /Users/Shared/UnrealEngine/4.2/Engine/Build/BatchFiles/Mac/RocketBuild.sh emitted errors but did not return a nonzero exit code to indicate failure

How can I resolve this??

Greetings,

You probably need to include a reference to ACableActor in the class you are trying to spawn this instance from, e.g.

#include "CableActor.h"

No, its not one of my classes, its a plugin from Epic. I tried this but it cannot find the file CableActor.h

I’m not so good in working with c++, but here is the CableActor.h.
I got it after spawning a cable actor in my Game from the upper left panel (where you can get boxes etc from) and clicking on the sourcefile.

It’s placed here:

C:/Program Files/Unreal Engine/4.3/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Classes/CableActor.h

Maybe that helps you. I’m not able to find the CableActor.h through the include…
Maybe its only an Editor thing atm :confused:

Ok, for everyone here is how to do it (note I am not going in to detail, feel free to ask me if you have problems):

  1. Download the source from Github
  2. In C:/Program Files/Unreal Engine/4.3/Engine/Plugins/Runtime/CableComponent/Source/CableComponent grab CableComponent.cpp and .h and CableActor.cpp and .h import them into your project.
  3. Update them according to the errors that the compiler throws. (e.g. import your PCH header)