As a newbie, I cannot get a character to swing a friggin' katana

TimeChasm

New member
I just purchased the First Person Controller pack and was able to get the example character model in and moving around. With minimal effort I was even able to create a new katana item and make the character hold it. But FOR THE LIFE OF ME, I cannot make the character's swing animation play. I've gone over the tutorial videos numerous times, following step by step and still no luck.

Using Unity 2018.3.8f1

Repro steps:

1. Create a new scene
2. In UCC menu: Add Managers, Setup Camera, Add UI
3. Setup a new character with the following options:
Screen Shot 2019-03-16 at 9.28.17 PM.png

4.Set up a katana item using the following options:
Screen Shot 2019-03-16 at 9.29.28 PM.png

5. I try running the game and everything gets set up correctly, the character is holding the katana item, but no animation plays when clicking. Character movement works as expected otherwise.

PS - Should also be noted that when I add the Third Person Objects in the Character Manager, it seems to disable the arm rig at runtime...

PPS - I also get 2 errors when running the game:

NullReferenceException: Object reference not set to an instance of an object Opsive.UltimateCharacterController.Character.Abilities.Ability.CanInputStartAbility (Opsive.UltimateCharacterController.Input.PlayerInput playerInput) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:295) Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:127) Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:99) Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:73)

and

Error: The collider on the melee hitbox is null. UnityEngine.Debug:LogError(Object) Opsive.UltimateCharacterController.Items.Actions.MeleeHitbox:Initialize(Transform) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:91) Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonMeleeWeaponProperties:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/FirstPersonController/Items/FirstPersonMeleeWeaponProperties.cs:33)

Any help would be appreciated!
 
As a disclaimed, I ain't no pro on using this tool, either =)

But I have been working with several iterations of this tool for about 2 years so, here goes....

I'd say your issue is in those errors, both of 'em. The top one's a kind elusive, bet the dev'd know off the top of his head what's not set there, I'll come back to that.

The bottom error is because you have not set the melee hitbox of your weapon, in my opinion. I am using the third person version of this, sounds like you're using first person, but there needs to be a Collider (Trigger=FALSE) on the visible object:

1552842314248.png

... and then that needs to be set on the Melee Weapon Properties component:

1552842514791.png


As for the first error, it looks like it's telling you something isn't set correctly (NullReferenceException) in your character Abilities. Here's what the Ability foldout in UltimateCharacterLocomotion component looks like on mine that works for melee weapons:

1552842942752.png

... I feel like it's probably something very simple, but the whole thing being so huge, easy to miss. Did you make sure to add it to your Character's ItemSets component? Something's missing, feels like it should be either on the Item or in the ItemAbilities.

Double-checked the Item.AnimatorItemId is indeed 24, and had a peek @ line 295 in Ability that's dying:
Code:
/// <summary>
/// Can the input start the ability?
/// </summary>
/// <param name="playerInput">A reference to the input component.</param>
/// <returns>True if the input can start the ability.</returns>
public virtual bool CanInputStartAbility(PlayerInput playerInput)
{
     if (m_StartType == AbilityStartType.Custom) {
         return m_Starter.CanInputStartAbility(playerInput);
     }


... which makes me wonder if the Input is set up correctly, since it looks like it's dying trying to reference the PlayerInput component.

Anyways, I'll be around to see if I can provide any more help, best of luck! It's a great tool, but the weapon setup's something of its own art that I'm still learning, too.
 
Last edited:
Thanks for the reply!

Adding the collider fixed the second error! Still having trouble finding the source of the null reference. My settings match the ones in the screenshots you posted.

I noticed 2 things, which may be completely unrelated:

1. The UltimateCharacterLocomotionHandler component just has a greyed out Default state. Should there be something else here?
Screen Shot 2019-03-17 at 1.11.36 PM.png

2. The ItemSetManager component has two slots, Slot0 has the Katana, Slot1 has None. Does that need to be something or removed?
Screen Shot 2019-03-17 at 1.09.00 PM.png
 
Both of those screenshots look good. On the Use ability ensure all of the Start Types are set to Button Down - it looks like one got switched to Custom with no starter data.
 
Awww snaps, Justin for the save =)

Agreed, seems like it must be the on the UltimateCharacterController.ItemAbilities input:

1552858372028.png
 
Awesome, that got rid of the remaining error!

Now whenever I right click, the block animation plays, but left clicking does nothing still? I have tried changing the InputName and it doesn't seem to do anything. Also tried changing the ItemStateIndex of the Aim ability (currently Fire2 or right click) and it still plays the same animation. Is there some special way I have to apply these changes or is there something I am missing?

My inspector settings look like this:



Screen Shot 2019-03-17 at 3.03.03 PM.png
 
That's great to hear!

Sorry, just realized I had the wrong "Use" ItemAbilities selected above for an example =)

I think you need to add the an additional "Use" to it that that looks like this:

1552871888629.png

... which, and I may be wrong, is kind of a generic Use ItemAbility, where the one you have set up is doing something more specialized, using ActionId# 5 and ItemStateIndex# 1.
 
YES!

It works!!!

tenor.gif


Thanks so much for the help, guys!
 
You guys have any idea why this error would pop up when using a sword?
I have 2 items, a gun and a sword..... when I equip the sword then swing, it swings...... then throws up errors.
1526
 

Attachments

  • Error01.PNG
    Error01.PNG
    12.9 KB · Views: 5
Top