0
Under review

Target Game Object does not have a CharacterShooter component

Simon 4 months ago in Shooter updated 3 months ago 7

Hi,

i don't understand why i am facing the following error:

however my character does have a CharacterShooter component

Is this a bug or something I did wrong?

Unity version:
2019.4.2f1
Game Creator version:
1.1.9
Under review

Looks like you're trying to shoot from another character (or object) that is not that one. Do you mind sharing a screenshot of the Shoot Action? Make sure it has the Player or a character with the Character Shooter component.

Hello,

sorry for the response time, i have not so much time at the moment to work on my game.

To present something specific to you, I created a "sandbox" project in which there is only a field, a player and a character.

I recreated a behavior for my enemy that you can see on this screenshot :

The behavior works since trees are highlighted during gameplay but the "draw weapon" action does not.

Here is the details of the actions draw a weapon and add ammos

Here is the details of the character  components

and finally, here is the result in game :

my player is facing the character and nothing append...

What am i doing wrong ? Could you help me please ?

EDIT : there is nothing in the console this time...

Sorry for the late reply. This is very strange. The only thing I see is that, under a Selector, you checking for opposite conditions on both branches: "Is Invoker Armed" and "Is Invoker Unarmed". You technically only need the left-most node to check the condition, as if it's false, it will automatically jump to the right one.

However, that's not what should be making the scene not work. Can you try equipping a weapon without the Behavior module? Using a simple action. My guess is that the problem is somewhere else rather than in the Behavior Graph.

Hi,

thank you for your reply.


I did what you suggested and created an "onStart" trigger on the Character which contains a condition "Can Invoker see Player" which triggers two actions: a message and the "draw weapon" action.

it still does not work.


I have the message but the character does not take out his weapon.

I even tried replacing "invoker" with the gameObject Character and it doesn't work ... I don't understand...


Are you using burst as the fire action mode?
I get the same message when trying to shoot with a weapon in burst mode before the weapon is equipped. Easily reproduced by opening example 5 and changing the shoot trigger to burst. 

Target Game Object does not have a CharacterShooter component
UnityEngine.Debug:LogError(Object)
GameCreator.Shooter.d__5:MoveNext() (at Assets/Plugins/GameCreator/Shooter/Mono/Actions/ActionWeaponShoot.cs:49)
GameCreator.Core.d__3:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IAction.cs:34)
GameCreator.Core.d__10:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:29)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
GameCreator.Core.ActionCoroutine:.ctor(IEnumerator) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:24)
GameCreator.Core.d__9:MoveNext() (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:109)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
GameCreator.Core.IActionsList:Execute(GameObject, Action, Object[]) (at Assets/Plugins/GameCreator/Core/ScriptableObjects/Interaction/IActionsList.cs:91)
GameCreator.Core.Actions:Execute(GameObject, Object[]) (at Assets/Plugins/GameCreator/Core/Mono/Interaction/Actions.cs:96)
GameCreator.Core.Trigger:Execute(GameObject, Object[]) (at Assets/Plugins/GameCreator/Core/Mono/Interaction/Trigger.cs:201)
GameCreator.Core.Igniter:ExecuteTrigger(GameObject, Object[]) (at Assets/Plugins/GameCreator/Core/Mono/Igniters/Igniter.cs:66)
GameCreator.Core.Igniter:ExecuteTrigger(GameObject) (at Assets/Plugins/GameCreator/Core/Mono/Igniters/Igniter.cs:59)
GameCreator.Core.IgniterMouseDown:Update() (at Assets/Plugins/GameCreator/Core/Mono/Igniters/IgniterMouseDown.cs:27)

Try changing the ActionWeaponShoot.cs line 59
From: 
        Debug.LogError("Target Game Object does not have a CharacterShooter component");
To: 
        if(shooter == null) Debug.LogError("Target Game Object does not have a CharacterShooter component");

I'm sorry Mathalous but that won't fix the problem ... it just hides the log. And I think my problem is different from yours ...