Forum rules - please read before posting.

NPC won't move in specific scene despite all attempts at correcting it

This is absolutely driving my insane, I've exhausted all options so here I am.

I am pretty far in my game's development and have my NPCs' set up in prefabs that I can drag and drop into new scenes. In my plethora of other scenes, I have no issue with NPC movement whatsoever, however in one specific scene I'm working on now, literally nothing will get the NPC character to move.

The Player walks through the scene just fine, and can follow paths, responds to move to point commands, etc. The NPC however ignores literally any command that would move it to another place on screen, whether it's move along path, move to point, etc. It does respond to changing animation commands, and it does play the walk animation, so it's TRYING to move, but it just won't.

I can't even get the character to move with the "Object: Teleport" command, which I've used on both NPC and non-NPC objects plenty of times without relying on the nav mesh without issue. I've brought in other NPCs and they all refuse to move as well--but again, the player character moves without issue. The demo character Brain also works, but it doesn't help me much in regards to debugging because Brian is a player character and not an NPC. From what I can tell though, the settings of my NPCs in regards to their colliders and general settings match both my Player prefab and Brain's prefab exactly.

I've looked at every other thread with character moving issues and tried to address it with the methods suggested in those threads (unchecking the root motion box, deleting and reimporting the character prefab from the scene, recreating the navmesh from scratch twice.)

I'm just not sure what to do next. I can provide screenshots of anything you want to see that might help debug. Thank you.

Comments

  • Is it just one particular NPC, or do other NPC prefabs dropped into the scene have the same issue? And does this NPC have trouble in other scenes?

    That you mention Brain being a Player, I'm assuming you're referring to a 2D game/scene. What are your AC and Unity versions?

    Let's see screenshots of your NPC's full Inspectors (the whole root, sprite child, and any other GameObjects on him). Any Console messages appear when he tries to move?

    As a test: temporarily remove his 2D collider and rigidbody components - they're not strictly necessary for 2D movement to work, and this'll help narrow down potential causes.

  • Yes, my other NPC characters also won't move in this scene specifically. No, the problem NPC (and the other NPCs) all move fine in other scenes they're in. I'm using Unity 2018 3.9 and AC v1.65.2.

    I went to disable the rigidbody and 2D collider as you suggested when I noticed that none of my NPCs have the rigidbody element attached to them--should they by default? I used the Character Wizard to create the NPCs and I don't think it added this component to them originally. My Player character does have one, however.

    When I added the rigidbody element to my character, he still isn't moving, but now it looks like he's TRYING to move--he's like spazzing around in one spot flipping between left and right as if he's stuck on something (but he shouldn't be, because he's within the navmesh, I have the action saying teleport to the start of the path, and there's nothing for him to collide with.) Without the rigidbody, it doesn't spazz around, it just plays the animation in one place. (Ignore that the MC doesn't have animations in my gifs/the outfit change on the NPC, we're in the middle of swapping/redoing some animations right now haha)

    Here are the screenshots of the inspectors of the NPC object and it's sprite object. I skipped screenshotting the dialogue busts because my NPCs have a lot of them but if you need to see them I can screenshot them too.




    When I added the rigidbody, it was to the bottom of the NPC object with the default settings.

  • I went to disable the rigidbody and 2D collider as you suggested when I noticed that none of my NPCs have the rigidbody element attached to them--should they by default?

    No, at least not unless you have special requirements, e.g. character evasion.

    How about if you disable "Retro-mode pathfinding"? You are using an outdated AC release and some issues related to this have since been fixed. I would recommend you duplicate the project, and import the latest AC into it and then test - so that we can see if this is an issue that has since been fixed.

  • No go on the retro-style movement being disabled, so I'll go ahead and upgrade and get back to you on it asap. Thanks for the help!

  • Hey, sorry to necro this thread but I found the solution to the problem while working on something else and wanted to post it in case anyone else runs into a similar issue!

    So it turns out, if you have more than one "Follow Sorting Map" script active within a character, it causes the character to completely freeze up and not be able to move around in scenes.

    In my case, I had a "Follow Sorting Map" script active on both the main NPC object as well as the sprite renderer object. Disabling the one on the main object made it so my character was able to move again.

    This also happens on the Player as well--if you have more than one "Follow Sorting Map" script on a Player object, ac will not recognize the Player object as the player on loading the scene and it won't let your Player move around. This is actually how I figured out this issue to begin with.

    Hopefully this helps someone in the future!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.