GraphUpdateScene not appearing

Hi, I’m trying to integrate the ASPP into our project and I started with the Example12_Procedural as it seems to fit our requirements.

The difference is that I’m evaluating the possibility to use GraphUpdateScene as descriptor of the areas I can’t go (like Props in the map) as they are more flexible in terms of “editing” for the artists.

The code in that example works just fine with Colliders, but it doesn’t work with GraphUpdateScene objects.

So my question is what is the right way to go about this ?

Currently I’m doing something like this at the end of the UpdateGraphCoroutine():

GraphUpdateScene[] updates = GameObject.FindObjectsOfType<GraphUpdateScene>();

for ( int i = 0; i < updates.Length; i++ )
{
    updates[i].Apply();
}

But I find it rather ugly, although I can optimize the FindObjectsOfType thingy as the areas of the map load and unload at my will, I can cache them on that event. But I think the ASPP system should have something similar to automatically do this job, or am I wrong ?

Thanks in advance.

I’m not a pro at this but some things you can try…

  1. do a Debug.Log(updates.length) and see if there’s anything in there.
  2. add as GraphUpdateScene to ensure it strongly types it.

and if all those fail, Do you have room to add a tag and do a findbytag? it would be faster than a find by type.

I’ve also noticed a few things that I can’t explain but some child objects get skipped with the find. Like I have a canvas object that is a child of another object. If I do a find on that, it returns nothing because it skips searching children of canvases.

Thank you for the quick reply, but you got me wrong:

What I’m doing works, there is no problem there, the question was if there was a better way to do it, like with a built-in function on the grahp, something like:

mGridGraph.ApplyAllGraphUpdatesOnScene();

or

AstarPath.active.ApplyAllGraphUpdatesOnScene();

Instead of me collecting the GUS objects and applying them myself.

Cheers.

Hi

You should really be using colliders as obstacles instead. To use graph update scene components you would have to update them every time the graph is moved, and that would be very very slow (comparatively). Using colliders can’t be that much harder can it?

Thank you Aron,

Indeed, I noticed the performance drop, although it was very small.

I will probably end up using a combination of both, colliders and GUS components as GUS provide a more flexible artist-friendly interface, specially for some of the most complex props we will use.

I just wanted to know if by that code I was doing it as I was supposed to, and by your answer I can tell it’s the way to go. Now I need to optimize that a little.

Thank you for your time.

Cheers.

1 Like