I am attempting to spawn a unit and then send that unit to a target. I have included a NavMesh and made sure that my unit can walk around the entire area up and around the target. However, when I run, my guy simply spawns and does not move. To clarify I am using the free ASP-character provided on the market.
LogNavigation:Warning: UNavigationSystem::SimpleMoveToLocation called for Controller:None controlling Pawn:NULL (if any of these is None then there’s your problem
Regarding the first picture I provided I assume it’s that empty controller slot.
However, considering I don’t actually have the unit as a direct selection, only as something spawned with the SpawnActor. I have no idea what should connected to the controller slot.
Try to add the controller of the Character by using GetController(). Any controller must have a Pawn linked to it, the engine will do that automatically if you specify you character and AI controller in the game mode you are using or in the WorldSettings override within your level.
I’ve been trying, but the only way I can reference the asp_character is by casting it right? Because I’m spawning the character so it can’t be referenced directly. However, every time I try to cast anything into the controller port it still won’t work.
Ah ok I see, you are not possessing the character with a controller! Ok lets see, the way to do that is to spawn first the controller, if it where successful spawn the character, if it where successful posses the new character using the newly spawned controller. There are methods from the pawn or the controller to both posses and unposses a pawn.
If the spawning fails (blocking collision, telefrag etc) make sure to delete the actors that you left over, if not they will be there until the next map change.
Crating a Bluprint Library you can add function which you can use elsewhere. Just create a BP library and add a ‘Spawn’ function that does all the heavy lifting of spawning a controller, spawning and possessing the pawn.
Moss, I’m not sure if you can still see this but after getting everything to actually work I noticed the instances you spoke of that would require me to remove the actors. I put my branch initially after it attempted to actually spawn the character. (so it would spawn the controller, then the character then check)
However, I don’t think it’s working right because I’m using a while loop that has a delay put into the macro. Which works 100% fine at 1 second delay with the branch condition box [X] <— checked, however if I leave it unchecked then it deletes actors even though it normally has ample time.
For some reason it just likes to run false, usually twice after the first actor and I don’t know why. (I’m running a max of 3 at the moment)
Could it be that you are spawning the character in the same spot? You should get a message in the log indicating why it was not able to spawn. Also verify that you are not saving a reference to the controller into a variable so you could accidentally delete the wrong controller.
I don’t think it could be a variable because I never made one for it. Shouldn’t be a big deal overall though, because I plan on having at least 3 spawn points with a fair delay. I’ll let you know.
In your bot/Ai charater settings you need two things. Of course your Aicontroller, but for undertaking any action with this controller, you must check in Class Defaults: Pawn > Auto Posses AI change default - placed in world to spawned. Or maybe last one - both.
I think you can use other solution, in Ai Controller settings it can be attached to owner, but in my case it solved problem.