Dynamic Buffer out of range

Funorama

New member
1740812339633.png
Getting DynamicBuffer out of range at Entity(42:1) from the Branch Component buffer attached. It appears the CheckBounds function is calling the error.1740812396504.png
 
This is coming from the Parallel task. If you look within the ParallelJob there are a number of instances where it sets the branch index. Can you insert a breakpoint and determine which condition is causing the out of range? The branch index should range from 0-4 in your case.

This can be a tricky issue to debug though so if it's possible to send me a repro scene that'll probably be the easiest.
 
Hi, so I did some digging and found it is trying to grab a childBrancComponent at index 65531 which is out of range in branch components which has a length of 20.

1740825823976.png1740825808095.png
 
Digging into it more, the Task Component Buffer it's pulling from is trying to get the 1st index (Element 1) and sure enough we can see it's Branch Index is the 65531, Element 0 is showing Branch Index at 0, so logically it should count up right?1740826250579.png
 
The ushort is likely going negative and overflowing to 65531. The Parallel job is retrieving that value, but it's not setting it. Where does it get set to 65531?

This is getting into the depths of the component structure. If there's a way to send a repro scene it'll be a lot easier for me to debug what is going on, and then I can also add a unit test to ensure this same thing doesn't occur in the future.
 
I've tried to create a repro scene, however, I can't get it to happen in an empty scene with just the behavior graph... I'm not sure what would be causing this to happen. The scene it breaks in has many other items at play, such as Photon Fusion.
 
If you need to send it with Fusion that's fine, just include instructions on how I can reproduce it. I think it'll be a lot easier for both of us doing it this way 🙂
 
Alright I'll work on that, however, I did find where it is being set. In BehaviorTree.cs:525 I think it's going into the negatives like you said, the first child to be created ends up with a calculation of 0 -6 + 1 which is -5 and it's our 65531 result.
1740827447158.png1740827470816.png
 
That does look like the area, though I will need to step through it to determine why it's going negative. If you can send that repro project that would be great - I'll remove it as soon as I get it solved. I also want to run my change against the unit tests since this is getting into the core part of the components.
 
For sure! I was able to cut out a lot of the bulk from my scene and still reproduce the error. Is there an easy way to export the scene + dependency scripts being used?
 
Unity packages will include the dependencies, but for larger projects it can miss things. Start with a unity package, and import it into a new project to see what it missed.
 
Sorry this took so long, I think I got a repro scene for you. When you start the game, click on "Enemy" and enable the BehaviorTree, this will throw the expected error. I'm on Unity 6000.0.24f1, let me know if there's any other unexpected errors. You will also have to import Behavior Designer Pro.
 

Attachments

Back
Top