I've just added my own sprite to the 2D demo and have spent some time getting it to work properly, but there's a couple of things I'm confused and stumped with. For some reason, the character always appears at the bottom of the screen even if the player starting position and off-scene arrows are in the same place for Brain. I have to literally move them so they're just above the hill in the background for my sprite to come onto the scene in the right position. My character is smaller than Brain, too.
The other issue is that my character keeps walking through the bird NPC no matter where they stand. It sometimes happens with the tree, even if I adjust the Sorting Map. The Sorting Map has to be really squashed down or the top one has to be pushed further up. Will I need to create another one just for the bird as well?
Comments
Make sure that the sprite child has a local position of (0,0,0) - you'll get a warning in the Console at runtime if it isn't. Also make sure that the pivot point of the sprite itself is at the bottom, by their feet. You can view the Brain sprite Inspectors for reference.
The Sorting Map has no effect on character evasion / pathfinding. Make sure that the Bird NPC has a Circle Collider 2D on them and that your Default NavMesh has "Character evasion" enabled.
If you need more help, please post images so that we can see exactly what's going on.
The bird NPC has a Circle Collider 2D and I've even tried increasing it, but it doesn't make much difference - my character still clips through it if I click around it. The Default NavMesh has Only Stationary Characters selected for the Character Evasion.
https://imgur.com/a/tHV6A
You say that the sprite doesn't have an "outer box" - I don't know what exactly you mean by that, but if you don't have a pivot point then that's likely the cause. The importing and configuring of sprites is all on the Unity side of things, not specifically to do with AC.
Does the character evasion work correctly when Brain is used? If so, the issue will be with your own character - in which case, please share screens of their full Inspector: both the root object and the sprite child.
Brain's evasion works perfectly, yeah. I've attached a couple of screens with the Inspector. As an aside, I've started working on my character's animation in Blender instead...
https://imgur.com/a/fLQYX
The sprite child's local position is non-zero, but (-2.97,0,0) - though perhaps that was to illustrate the sprite for the purposes of the screenshot. Regardless, it's clear that the sprite's pivot is in the centre, not at the feet.
I'm not sure why the Pivot can't be changed - you're clicking "Apply" afterwards to save the change? Again, this is an issue with Unity / the sprite's import settings - but if you want to post a shot of the sprite asset's Inspector I can see if anything looks wrong.
I'm not getting an Apply button when I change the Pivot. Okay, I've sorted out the pivot on all the sprites. I selected all of the frames for each animation, went to the Inspector and changed the Pivot from there to bottom. I re-did all the animations and my character is now appearing in the right place at the start.
Just need to sort out the clipping problem now. My character is avoiding the Bird better, but they're still going through the tree. I've tried deleting my NavMesh and Tree Base and re-created them, but it hasn't helped much. If I drag the TreeBase game object into the Hole box, it causes the clipping. If I don't add it, my character is going round the tree better, but they occasionally get stuck and their animation keeps going.
By clipping, you mean the sprites are not correctly showing in the correct order? That's not to do with any NavMesh, but the SortingMap / FollowSortingMap components - which control the "Order in Layer" value of your character's Sprite Renderer as he/she moves around the scene.
If Brain works OK, take a note of his order value at each point in the scene, and compare it with your own character's. What's the difference?
My character sprite is still walking and standing in the tree, so yeah I think it's the SortingMap. I think I tried using the same properties as Brain, but will have another look tonight.
Thanks for all your help!