# pawns spawn with 2 controllers

**URL:** <https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184>\
**Category:** UDK Programming and UnrealScript\
**Tags:** unreal-engine\
**Created:** [September 21, 2016, 9:04am UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184 "2016-09-21T09:04:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_cae7faa3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cae7faa3](https://forums.unrealengine.com/u/anonymous_user_cae7faa3)\
**Post date:** [September 21, 2016, 9:04am UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/1 "2016-09-21T09:04:12Z")

</div>

has anyone noticed that pawns spawned through kismet have 2 controllers unless the controller type in the actorfactory is set to none?

I am trying to trace the cause of a spike in performance at 1 second intervals.

for debugging I had been tracking a certain controller type and I always got the correct number.but when I added a second type of ai and changed the foreach to count all controllers instead of this 1 specific 1, I noticed that the number was doubled and when I kill a zombie,only 1 controller is destroyed.this leaves me with a steady build up of unused controllers hanging around.the more I kill the bigger the spike.

this also happens with a utbot and utpawn combination in kismet so im sure im not the first to suffer from this.

unfortunately,we still cant access the udk forums-where im sure I could find an answer.

I tried this to destroy the controllers I don’t want but I get the comparison will always succeed error.

```auto

function destroycontrollers()
{
    local controller atc;
    
       foreach WorldInfo.Allcontrollers(class'controller',atc)
		{						
			if(atc != class'boltonszombie_ai') 
                        {
                           atc.destroy();
                        }
		}

}

```

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [September 21, 2016, 9:39am UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/2 "2016-09-21T09:39:47Z")

</div>

wouldn’t know as I don’t spawn pawns via Kismet.

can you check if the Controller has a valid Pawn as the criteria for destroying it?

---

<div class="post-metadata">

**Author:** ![Yummy-Vegetables](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yummy-Vegetables](https://forums.unrealengine.com/u/Yummy-Vegetables)\
**Post date:** [September 21, 2016, 11:33pm UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/3 "2016-09-21T23:33:32Z")

</div>

Can’t say I’ve noticed that, I always specify a controller with the pawn class

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cae7faa3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cae7faa3](https://forums.unrealengine.com/u/anonymous_user_cae7faa3)\
**Post date:** [September 22, 2016, 8:28am UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/4 "2016-09-22T08:28:28Z")

</div>

,I will try when I get a minute today,good suggestion.

Yummy-Vegetables.so do I,both in script and within kismet.i thought this may be the problem and removed the reference in script,but no change.

I tried spawning through my gameclass instead of kismet but always get “pawn was destroyed because of collision at spawn point” or something similar,no matter where I spawn.

---

<div class="post-metadata">

**Author:** ![Yummy-Vegetables](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yummy-Vegetables](https://forums.unrealengine.com/u/Yummy-Vegetables)\
**Post date:** [September 22, 2016, 12:54pm UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/5 "2016-09-22T12:54:27Z")

</div>

I assume you use the actor factory node not the ex node (not used that) and then select the actor factory AI.

Why not copy a factory node to a default clean map and spawn an AI and see if you get the 1 or 2 controllers. It’ll be easier to debug on a clean map if it fails or go through and disable all factory nodes except 1 in a map that fails and check there. In case there’s a bug in your kismet logic at least you can break it down to a single kismet node.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cae7faa3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cae7faa3](https://forums.unrealengine.com/u/anonymous_user_cae7faa3)\
**Post date:** [September 22, 2016, 3:53pm UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/6 "2016-09-22T15:53:18Z")

</div>

already done that,as you say its much easier to monitor in a clean map.

it is an actor factory and not an actor factory ex.but I have been using UTactorfactoryai and not actorfactoryai inside the actor factory.i just swapped over and voila!

I now have the correct amount of controllers,but the pawns don’t move till I shoot them,still,one step closer.

thanks.

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [September 22, 2016, 4:09pm UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/7 "2016-09-22T16:09:32Z")

</div>

on your AI’s Possess function make sure you call Pawn.SetMovementPhysics() on them 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cae7faa3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cae7faa3](https://forums.unrealengine.com/u/anonymous_user_cae7faa3)\
**Post date:** [September 22, 2016, 4:42pm UTC](https://forums.unrealengine.com/t/pawns-spawn-with-2-controllers/74184/8 "2016-09-22T16:42:42Z")

</div>

strangely,it doesn’t work if I do it in script,but it does if I set pawns physics in kismet.nice 1.

thanks.

edit:works in script in pawn rather than controller.
