Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  NullReferenceException in ObiRopeCursor (build)
#3
Thanks for your reply!

I tried moving that part of code to the Start method. Now I get NullReferenceException in this line in my code (in Editor):

Code:
int solverIndex = actor.solverIndices[i];

In debugger it shows that actor is good, but solverIndices is null. Seems like actor is not initialized all the way when I try to work with it inside my Start() method.

This is the whole codeblock I use -  it loads positions and velocities from json file and should set them to the rope:

Code:
var positions = reader.Read<List<Vector3>>("tether_positions");
var velocities = reader.Read<List<Vector3>>("tether_velocities");
for (int i = 0; i < positions.Count; ++i)
{
   int solverIndex = actor.solverIndices[i];
   actor.solver.positions[solverIndex] = positions[i];
   actor.solver.velocities[solverIndex] = velocities[i];
}
cursor.ChangeLength(reader.Read<float>("tether_length"));


Actually, while debugging - drom actor I see that solver's initialized flag is false
Reply


Messages In This Thread
RE: NullReferenceException in ObiRopeCursor (build) - by natko1412 - 15-05-2023, 01:20 PM