Hi!
My Adventure Creator is 1.78.4. and Unity 2021.3.16f and there's a constant struggle with NPCs' sizes.
In this following video, you can see that I can't change the NPC's order in layer and can't position her behind the desk. Sometimes it stays at 0, but when I press play, it shoots back 6 or 7:
https://drive.google.com/file/d/18ysIkwJAq71K8UoEw_LEj06AuN9EFOcQ/view?usp=sharing
Another example can be seen here:
In editor:
https://drive.google.com/file/d/1TrBi-tCHM5cukJlj8Ng2VyX77pHRWmYL/view?usp=sharing
And in game:
https://drive.google.com/file/d/1rrz5MpQR7UPrXzzwzlRJkDerJ3fEvBSz/view?usp=sharing
Another problem concerns the item in hand when using action list. It works but how does one change the position or the angle of the item in hand? Pic and problem here:
https://drive.google.com/file/d/1bFwdQiwlK3AERd8aLlmk8Htb5vXzzHXH/view?usp=sharing
And here are one of the NPC's inspector pics:
https://drive.google.com/file/d/1_XzZEPj5p2ahS0CKzUXdAM7fUJEw74L1/view?usp=drive_link
https://drive.google.com/file/d/1bSjiQwvkewPabUU-70ZoNo5T9YD6ZZV-/view?usp=drive_link
https://drive.google.com/file/d/1oEWd0HtYGquU3zPterEJghZb-A6sxdG_/view?usp=drive_link
Best regards,
Sneb
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @Sneb.
The NPC size/ordering issues you're experiencing are a result of them being a part of the scene's Sorting Map - which will be the case for any character that has the "Follow Sorting Map" component.
The Sorting Map is a tool to help fake depth effects in 2D games, and is a means of telling characters what size and/or order they should be given their position in the scene. A tutorial on its usage can be found here.
If you have no need to either scale or re-order a character in this way, you can either remove their "Follow Sorting Map" component - or, if no characters require one - remove the scene's "Sorting Map" completely.
Separately: I'm also seeing that your NPC's origins appear to be in the centre of their sprites. This is OK if your characters are stationary, but will cause issues if you mean for them to walk around.
This is because AC considers a character's position to be by their feet - meaning their origin is what will need to be inside the scene's NavMesh when pathfinding.
If possible, I'd recommend raising their sprites upward so that their origin positions (shown by the yellow circle + audio icon in the Scene window) are by their feet. If their graphics consist of a single sprite, you can also do this by adjusting the sprite's Pivot Point - as is the case with the 2D Demo's Player character, Brain2D.
The 2D Primer video covers these topics and more - you may find it useful if you're just getting started with AC.
Which Actions are you relying on to place the item in the character's hand?
If you're using the Character: Hold object action, this Action requires your character to have appropriate child Transforms assigned in their "Left/Right hand bone" fields.
These Transforms needn't necessarily be their literal hand bones if the character is skeleton-based - it's often easier to create an additional child object of each hand, and assign that. That way, you can adjust this child object's position/rotation without it being affected by the hand's animation.
This principle is used by the 3D Demo, when its Player character, Tin Pot, picks up the Sword. The technique is the same in both 2D and 3D.