UFPS – Tactical AI and Core Game Kit

Please follow the other information located on my Tactical Shooter AI and Dark Tonic Page

Asset Links
= Core GameKit by Dark Tonic
= Tactical Shooter AI by Squared55
= Ultimate FPS by Opsive.

It is important that you have followed the steps on my other page listed at the top of this page. I have a number of script changes so that Tactical Shooter AI will Spawn and Despawn with Core GameKit!

UFPS Target Script

I created this script by inheriting the Target Script and adding functionality for UFPS. This will probably work with other FPS shooters as well.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TacticalAI;

public class TargetScriptUFPS : TargetScript {

	public Transform m_Target=null;
	int myUniqueIDNonAI;
	GameObject m_Parent;

	void Awake()
			m_Parent = this.transform.parent.gameObject;
			m_Parent = this.gameObject;

	void OnEnable ()
		#region TargetInformation
		if(m_Target == null && m_Parent.GetComponentInChildren<BoxCollider>(true))
			m_Target = m_Parent.GetComponentInChildren<BoxCollider>(true).transform;
		else if(m_Target == null)
			m_Target = m_Parent.transform;
		myLOSTarget = m_Target;
		targetObjectTransform = m_Target;
		#region HealthInformation
		if(healthScriptHolder == null && m_Parent.GetComponentInChildren<vp_DamageHandler>(true))
			healthScriptHolder = m_Parent.GetComponentInChildren<vp_DamageHandler>(true).gameObject;
		else if(healthScriptHolder == null)
			healthScriptHolder = m_Parent;
		//Add ourselves to the list of targets
		#region AddToTargetList
		if (TacticalAI.ControllerScript.currentController)
			myUniqueIDNonAI = TacticalAI.ControllerScript.currentController.AddTarget(myTeamID, m_Target, this);
			UnityEngine.Debug.LogWarning("No AI Controller Found!");
	void OnDisable ()
	public void RemoveThisTargetFromPlay()
		if (TacticalAI.ControllerScript.currentController != null && isPlayingNonAI)
	//Stop errors when you quit the game early
	bool isPlayingNonAI = true;
	void OnApplicationQuit()
		isPlayingNonAI = false;
	void OnSpawned()
	void OnDespawned()

UFPS Editor Target Script

Place this script inside of an Editor folder. This script will only expose a couple of variables.

  • Team ID – Set this to your friendly team, OR a new Team ID but add this number to any team you don’t want to attack you.
  • Everything else will auto-populate. NOTE: if you populate these items, they will not get overwritten so be careful.
  • Target – I have this auto-finding the first child Box Collider. I would advise either using this OR putting this on a object that is above the ground (like spine or hips), otherwise the AI will shoot at the feet.
using UnityEngine;
using System.Collections;
using UnityEditor;

public class TargetScriptUFPSInspector : Editor
    SerializedObject targetScript;
    SerializedProperty targetObjectTransformProp;
    SerializedProperty targetPriorityProp;
    SerializedProperty myLOSTargetProp;
    SerializedProperty healthScriptHolderProp;
    SerializedProperty myTeamIDProp;

    void OnEnable()
        targetScript = new SerializedObject(target);
        targetObjectTransformProp = serializedObject.FindProperty("m_Target");
        targetPriorityProp = serializedObject.FindProperty("targetPriority");
        myLOSTargetProp = serializedObject.FindProperty("myLOSTarget");
        healthScriptHolderProp = serializedObject.FindProperty("healthScriptHolder");
        myTeamIDProp = serializedObject.FindProperty("myTeamID");

    bool showLinks = false;

    public override void OnInspectorGUI()

		EditorGUILayout.PropertyField(myTeamIDProp, true);
		EditorGUILayout.PropertyField(targetPriorityProp, true);

        showLinks = EditorGUILayout.Foldout(showLinks, "Show linked Auto-Populated components");
        if (showLinks)
			EditorGUILayout.PropertyField(targetObjectTransformProp, true);
			EditorGUILayout.PropertyField(myLOSTargetProp, true);
            EditorGUILayout.PropertyField(healthScriptHolderProp, true);

        if (EditorGUI.EndChangeCheck())

    public void DrawArray(SerializedProperty prop)
        EditorGUIUtility.labelWidth = 0;
        EditorGUIUtility.fieldWidth = 0;
        EditorGUILayout.PropertyField(prop, true);