- Home /
A* pathfinding doesn't work on mobile devices.
Hello all! :) I'm creating a 2d game, using NGUI and A* pathfinding algorithm. Everything was fine, until one day, I started my game on phone and AI objects didn't run. After some researches, I found out that it's a problem with A* function "OnPathComplete". It just doesn't call when we get path back. Everything works fine on PC, but with this problem on devices (Samsung Galaxy mini 2; Samsung Galaxy Tab 2). I had tried to reload A* package to recover all scripts but it didn't help. Who knows why this problem appears - help me, please :)
Answer by Bunny83 · Dec 13, 2013 at 10:28 AM
First A* is just an algorithm and there are tons of implementations of it. You probably talk about one implementation of arongranberg.
I can tell you for sure that it works on Android ;) In my last company we used it and ir worked as it should on Android (different models) and iPad.
You probably doing something wrong. Well now i can stop here since we don't know what your code looks like or where it goes wrong.
Some additional points:
Do you have any platform dependend compilation? (`#if UNITY_ANDROID` ...)?
Do you have checked your logcat for any errors?
Thanks for reply :) Yes, you're right, I'm using arongranberg's implementation. I know that it works for Android, it worked on my devices too, but something happened and it stopped working :(
Do you have any platform dependend compilation? (#if UNITY_ANDROID ...)? - Yes, some string in NGUI scripts, but it worked before, and I didn't add anything like this Do you have checked your logcat for any errors? - For debug, I just showed strings on the screen like Debug.Log, and the string from OnPathComplete didn't showed up.
I see something happened ;) All we know is that the A* framework does work as it should. So it has to be "something" in your project. $$anonymous$$aybe you call StopAllCoroutines on the A* gameobject or you delete the wrong object at the wrong time. You might get a null reference somewhere. Since your project is probably quite complex there's nothing we can do.
We could start enumerate through all the "general common program$$anonymous$$g mistakes" but that would probably lead nowhere since there are simply too much and in the end it might be a not so common one ;)
Your answer
Follow this Question
Related Questions
Unity3d: NGUI + A* pathfinding 1 Answer
NPCs random movement 2 Answers
Change texure on NGUI BUTTUN press 0 Answers
How To Disable Auto-capitalization when using TouchScreenKeyboard 0 Answers
NGUI sprite movement 1 Answer