Problem updating to 3.5

Just updated to 3.5 and I’m getting some errors.

Error 10 Field ‘Pathfinding.RVO.Sampled.Agent.VO.cutoffDir’ must be fully assigned before control is returned to the caller \Assets\AstarPathfindingProject\Core\RVO\RVOAgent.cs 313 6 UnityVS.MMMPrototype.CSharp
Error 11 Field ‘Pathfinding.RVO.Sampled.Agent.VO.cutoffLine’ must be fully assigned before control is returned to the caller\Assets\AstarPathfindingProject\Core\RVO\RVOAgent.cs 313 6 UnityVS.MMMPrototype.CSharp
Error 12 Field ‘Pathfinding.RVO.Sampled.Agent.VO.dir2’ must be fully assigned before control is returned to the caller Assets\AstarPathfindingProject\Core\RVO\RVOAgent.cs 313 6 UnityVS.MMMPrototype.CSharp
Error 13 Field ‘Pathfinding.RVO.Sampled.Agent.VO.line2’ must be fully assigned before control is returned to the caller Assets\AstarPathfindingProject\Core\RVO\RVOAgent.cs 313 6 UnityVS.MMMPrototype.CSharp
Error 9 Field ‘Pathfinding.RVO.Sampled.Agent.VO.sqrCutoffDistance’ must be fully assigned before control is returned to the caller Assets\AstarPathfindingProject\Core\RVO\RVOAgent.cs 313 6 UnityVS.MMMPrototype.CSharp

Any ideas?

Awesome. It seems to be working great with Grid-graph so far. I’m going to add more agents and see what happens. You’ve been very helpful, thanks!

Absolutely will! Another quick question, instead of opening a new thread for this. Is the RVO compatible with Grid graphs as well as Nevmesh based graphs?

The local avoidance is at this stage completely separate from the pathfinding part of the project since obstacles are not supported yet, only the movement script needs to care about it. So… Yes!

Vectors are initialized to zero mostly. But in struct constructors, you need to explicitly set all members of the struct, otherwise the compiler will treat it as an error.

Aha, another compiler, that explains it.

I hope you find it useful :slight_smile:
PS: If you do, it would be really awesome if you would rate it/write a review on the AssetStore!

Cheers,
Aron

Hi

Hm… well, that’s certainly a bug. The interesting this is, why doesn’t Unity throw any compile errors for me… I tested the project in several unity versions and several clean imports, all those tests used the same code, but it never gave me that error.

The fix is easy though.
Open the RVOAgent.cs script, locate line 313 and add this right before the “return” statement.

cutoffDir = Vector2.zero; cutoffLine = Vector2.zero; sqrCutoffDistance = 0; dir2 = Vector2.zero; line2 = Vector2.zero;

Thank you kindly! Error-free! I had a feeling that was the issue, but very confused as to why that was throwing an error as well. I’d never seen something like that before, I always thought Vectors would initalize to zero automatically…but anyway.

I am using UnityVS, which I’m pretty sure uses a slightly different C# compiler or something. So that could possibly have something to do with that.

Regardless, thanks for the help! Looking forward to try out the new RVO stuff! :slight_smile:

I did some research on this before I found the thread.

Basically the issue is the return statement inside the constructor.

Here are some threads with information:

What I did to resolve this, is mentioned in both threads:

`public VO ( Vector2 center, Vector2 offset, float radius, Vector2 sideChooser, float inverseDt ) :this()
            {`

Just added the :this() after the constructor declaration.

@Skalev

Nice fix! I hadn’t thought about that you could inherit from the default constructor.