I use Follower Entity (3D) for my objects, but there’s really no height difference in my game, just a plane. My objects appear in the correct position most of the time when they are generated, but occasionally they will deviate from the correct position and look like they are moving a large distance towards their destination.
Here’s what I’ve confirmed:
if objects Spawn with CanMove turned off, they will definitely appear in the correct position. If you turn CanMove back on after they’ve spawned for a while, they also move normally.
this has nothing to do with obstacles in the scene, I tried turning off all obstacles, but the situation remains the same.
This has nothing to do with whether the objects overlap or not, I tried having all the objects overlap and the probability of them generating correctly and incorrectly doesn’t seem to change.
i don’t seem to observe any noticeable lag or anything like that when something goes wrong.
I use prefab to generate them. Use an object pool or not dosent affect this issue.
Here’s the game recording, it may look blurry, if you can’t read it just the text description on it should suffice.
In the video, the objects are supposed to spawn in the red orb, but sometimes they spawn closer to the center (which is where their destination is).
Do you mind sharing their pathfinding and possibly spawning code? With Astar disabled on these agents I’m assuming it also works fine, right? Since it works with canMove turned off… Also can you take some screenshots when they first spawn of the Debug info menu?
(And one last question to round out my many many questions already haha- what verions of Unity and Astar are you on)
Thanks for respond!!
1.
The way I generate agents can be understood as follows:
GameObject.Instantiate(prefab, parent);
I instantiate a prefab with Follow Entity component on it
2.If Astar is disabled, they spawn at the correct place.
3.
4.
A* Version: A* Pathfinding Project Pro 5.2.4
UnityVersion: 2022.3.50f1
Here is some information that I’m not sure if it’s useful for you: the game scene is called MainScene, and the prefab that is causing the error is called Monster. The code that generates the monsters is in MonsterManager.
Sorry, this is because Chinese was used in this script (apologies again). However, the content in this script is not used anywhere, so you can leave it alone or delete it. Thank you very much ;w; !!!
I’m having some issues getting the project to open still. Now the Utility.cs file is causing issues- what’s that file used for, is it necessary for the project to run?
u mean those lines? I think they are part of A* Pathfing Project’s Debug Drawing. U can turn them off by change this to “Nothing”
It is on Prefab “Monster” component “FollowerEntity”(FollowerEntity is part of A* Pathfinding Project)
My previous message replied to this post instead of replying to you, so I’m a bit concerned whether you saw my message. I’m replying to you here just in case. Sorry if this bothers you, and thank you again for your patience.
You’re fine I am usually not available on weekends is all. Getting around to this now.
Looking into this and I’m not sure this is an Astar issue. It may be only noticed with Astar, but I think this may have more to do with your spawning code than anything. Try this: Replace your Monster Prefab with one that has default a FollowerEntity values, and don’t change any settings on FollowerEntity and see if it still spawns incorrectly? You may also want to do the same for your graph- if you reset them both to default and they still cause issues, we can continue to look into this