Forum rules - please read before posting.

After Upgrade Touch Navigation Pauses

I have not worked on my game in over a year.

I finally decided to make some time to work on it.

I was using Unity 4 back then and had just the first scene with a ship and a player walking around on it with some triggers and inventory locations. Everything was working great.

I have upgraded to Unity 5 pro and am using 5.3.5p2.

I upgraded Adventure Creator to the latest.

It took a couple minutes to get my brain back into it and read the documentation on upgrading and figure out that I had to replace all the managers. At least it worked without any problems.

My game is functional in Unity 5 with AC 1.52. Yay!

I have one problem. Whether I am running on my Mac or on my Android tablet, when I touch the screen to make my player move to that location there is a couple second pause and then the player jumps.

It is as if something is doing a bunch of background processing and then finally catches up, but the player has been calculated to have moved already.

I get no errors in the console.

How do I figure out why it is doing this? It is every single time I touch (Android) or click on (desktop editor) the screen.

Comments

  • You can use the Unity Profiler to try to find what's causing the performance spike.

    Are you making a 2D game?  When pathfinding, the speed of the algorithm is exponentially linked to the number of vertices in your NavMesh.

    In v1.52, however, there are some additional options in the NavigationMesh Inspector to improve performance at the cost of accuracy.  Try experimenting with a lower accuracy value, and also by diabling the "Character evasion" setting if you don't need it.
  • Awesome fast response. I decided to take a look at the new 1.52 features first because that is when it started happening.

    It was the Character evasion. As soon as I turn that off everything is smooth.

    So the question is, can that even be used if it makes the game so glitchy? I am working on an i7 top of the line Macbook pro and it glitches. On top of that most of my users would be on mobile devices, so what about them?

    When would you use this if it takes so much processing power it doesn't work well? I noticed you even have a warning that comes up in the inspector saying how expensive it is for mobile.
  • Its not so much a glitch as it is an intensive process that occurs when building a new navigation path, and again, should be influenced by the complexity of the NavMesh itself - some NavMeshes won't have any trouble.

    That said, you shouldn't generally see any issue when running on a desktop.  How many vertices are in yours?  Are you able to simplify it at all?  Seeing a shot of it's shape, and the NavigationMesh Inspector may provide some clues.
  • There are 81 vertices. Is that a lot?
  • Here is my nav mesh.

    image
  • Here is a better link. Not sure that one works for outside google accounts.

    image
  • Try posting on imgur and copying the link - but yes, 81 is a lot, especially for mobile.
  • That is not good because this scene has the least complicated mesh that I need. There is a city scene I need to make next that will have a LOT more.

    Is AC maybe not the right tool to use for this?
  • Is there something I should do differently? Would it work better to break the mesh into multiple meshes? If so how would I go about moving from one area to another and activating each mesh while the player is in that area?

    Basically I have a large 2D top down city scene with buildings and the player moves around on the streets. They can go into the doors of some buildings which will transition to another inside building scene.

    I would like it to be seemless while they are walking around the city.
  • I would definitely advise splitting up your NavMesh, assuming the camera is zoomed in enough such that you can't see the whole thing at once.  Handily, the current NavMesh can be broken up into four clear sections - though you'll need the "tunnels" between each end to overlap one another.

    You can switch the active NavMesh by using the Scene: Change setting Action, and placing it in a Trigger that the player triggers when moving into the correct spot.  You'll need to ensure your Player has a Rigidbody2D component in order to detect Triggers.
  • To recap I should break up the navmeshes into sections. Make sure they overlap. Then I need a trigger to switch the navmesh using Scene: Change setting action.

    Would one trigger work or do I need one on each side of the boundary so I know which is the outgoing navmesh and which is the new one?

    If a single one then sample code would be helpful.
  • What is a good number of vertices in a navmesh for mobile games?
  • You could try placing a Trigger over each NavMesh, and have it switch to that NavMesh when the Player enters it.  Be sure to set the When running field of each Trigger to Run In Background.

    Though 2D Triggers are rectangles by default, you can make them take any shape by removing the Box Collider 2D component and replacing it with a Polygon Collider 2D instead - but make sure Is Trigger is checked.

    It's hard to say what a good number of vertices is, given the range of devices out there.  Maybe 25?  The 2D Demo only uses 16.
  • I will try that. Thanks!
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.