Opsive Integration Task: Should all of them search parents for UCC like Is Alive does?

echtnice

Member
Hi,

i'm having some trouble with the UCC Integration tasks as all of them try to retrieve the UltimateCharacterController component from the Target GameObject and not from the parents of the Target GameObject. The IsAlive task is the only exception as far as I can see.

I wonder if it would be a good idea to always search the Target GameObject and its parents for a UltimateCharacterController component like IsAlive does.

A concreate use case:
I adapted your example BehaviourTree for enemies. My variable Target contains the head bone's GameObject. (it got set via
"Can See Object" with "Use Target Bone = Head"). For IsAlive, I can just use Target, but for all others (e.g. Is Ability Active), I have to somehow retrieve the UCC component from parent of the target.

Code:
diff --git a/Assets/Behavior Designer/Integrations/UltimateCharacterController/Scripts/Tasks/IsAbilityActive.cs b/Assets/Behavior Designer/Integrations/UltimateCharacterController/Scripts/Tasks/IsAbilityActive.cs
index 19ec41008..95788eb3d 100644
--- a/Assets/Behavior Designer/Integrations/UltimateCharacterController/Scripts/Tasks/IsAbilityActive.cs    
+++ b/Assets/Behavior Designer/Integrations/UltimateCharacterController/Scripts/Tasks/IsAbilityActive.cs    
@@ -29,7 +29,8 @@ public override void OnStart()
         {
             var target = GetDefaultGameObject(m_TargetGameObject.Value);
             if (target != m_PrevTarget) {
-                m_CharacterLocomotion = target.GetCachedComponent<UltimateCharacterLocomotion>();
+                // GUNFU:HACK https://www.opsive.com/forum/index.php?threads/opsive-integration-task-should-all-of-them-search-parents-for-ucc-like-is-alive-does.6365/#post-31576
+                m_CharacterLocomotion = target.GetCachedParentComponent<UltimateCharacterLocomotion>();
                 // Find the specified ability.
                 var abilities = m_CharacterLocomotion.GetAbilities(TaskUtility.GetTypeWithinAssembly(m_AbilityType.Value));
                 if (abilities == null) {

Thanks
 
Last edited:
Top