TheDuckCow / godot-road-generator

A godot plugin for creating 3D highways and streets.
MIT License
328 stars 17 forks source link

Occassional Invalid set index 'low_poly' #8

Closed TheDuckCow closed 1 year ago

TheDuckCow commented 1 year ago

Sometimes while moving RoadPoints, there is a bad state where geometry doesn't update, and we get errors like:

res://addons/road-generator/road_network.gd:142 - Invalid set index 'low_poly' (on base: 'null instance') with value of type 'bool'.

My hunch is this is something to do with how the scene-tree initializes, but that would need further verification. When I faced this in the demo project and I opened a new scene and created a network from scratch (using spatials), I did not run into this issue.

Also unsure if related, but occasionally get the error:

res://addons/road-generator/plugin.gd:33 - Attempt to call function 'hide_gizmo' in base 'null instance' on a null instance.

Which again points towards a reference / initialization error, or at least an issue with the plugin's ability to correctly pick up the current state when being triggered to make a change.

TheDuckCow commented 1 year ago

Reframing this task to be more about addressing startup issues, such as warnings and errors on open.

On further exploration, it seems to be happening due to a variety of reasons:

While working on resolving the warnings, I may have actually eliminated the issue referenced here: https://github.com/TheDuckCow/godot-road-generator/issues/3

Once I added flags of:

if not is_instance_valid(network):
    return  # might not be initialized yet

to the RoadPoint class, it seemed to resolve point number 3.

TheDuckCow commented 1 year ago

Fixed with the above changes.