Infinite errors about snapping
Closed this issue · 14 comments
Recently got back into an older project and decided to update to the latest Asset Placer. Upon doing so I am greeted by infinite errors about a null snap object in the console
GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 24
modules/mono/glue/runtime_interop.cpp:1324 - System.NullReferenceException: Object reference not set to an instance of an object.
at AssetPlacer.Snapping._Process(Double delta) in /mnt/Productivity/Gamemaking/Godot/Projects/PDCEscape/addons/assetplacer/snapping/Snapping.cs:line 58
at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/Node.cs:line 2087
at AssetPlacer.Snapping.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /mnt/Productivity/Gamemaking/Godot/Projects/PDCEscape/Godot.SourceGenerators/Godot.SourceGenerators.ScriptMethodsGenerator/AssetPlacer.Snapping_ScriptMethods.generated.cs:line 138
at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret) in /root/godot/modules/mono/glue/
This is in Godot 4.1.2, the addon seems to function fine ignoring the errors though. I have tried rebuilding to no avail.
Edit: Eventually it also lead to a crash likely due to overloading the debugger.
Hello @ZachAR3, how exactly did you replace the versions? It is important that you disable the plugin first, then you can safely replace the files (with the project closed to be extra safe), and before you re-enable it, you need to press the "Build" button again. Also, make sure that the file path to the plugin is exactly the same as before, i.e. res://addons/assetplacer
I hope this helps, and sorry for the late reply!
It's in the same location, can't remember if I disabled before updating but I have tried disabling and enabling between launches without avail. E.g I can launch with it disabled, no errors, enable it in settings, build and still get the errors.
Please try again, following the steps exactly as described. It looks like the error is due to the resource not being loaded properly when the old instance is not cleared up properly. It might help if you delete the mono folder inside .godot before relaunching and rebuilding.
I uninstalled the plugin rebuilt, re-launched, followed the install instructions to reinstall still gave the issue, deleted mono folder still gave the issue, I even deleted the project folder app data since that caused problems last time with pathing errors and still get the issue.
Which version of the AssetPlacer are you using exactly? Does it work if you use it in a new project?
1.1.0, same thing happens even in a new project.
That is strange. Which platform are you on, and do you have any other plugin installed? Also, is there any error in the beginning, before the spam about the NullReferenceException?
The error does not appear when I test it, and nobody else has yet reported it, so it might take some more exhaustive investigation to fix.
I have tried in new projects with no other addons installed... I do get a few other errors at the very beginning of the log
Cannot load shader: res://addons/assetplacer/Gizmos/GridDistanceFade.gdshader
Failed loading resource: res://addons/assetplacer/Gizmos/GridDistanceFade.gdshader. Make sure resources have been imported by opening the project in the editor at least once.
scene/resources/resource_format_text.cpp:592 - res://addons/assetplacer/gizmos/Grid.tscn:8 - Parse Error:
Failed loading resource: res://addons/assetplacer/gizmos/Grid.tscn. Make sure resources have been imported by opening the project in the editor at least once.
Error loading resource: 'res://addons/assetplacer/gizmos/Grid.tscn'.
modules/mono/glue/runtime_interop.cpp:1324 - System.NullReferenceException: Object reference not set to an instance of an object.
at AssetPlacer.Snapping._Process(Double delta) in /mnt/Productivity/Gamemaking/Godot/Projects/BrokenPinJoints/addons/assetplacer/snapping/Snapping.cs:line 58
at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/Node.cs:line 2087
at AssetPlacer.Snapping.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /mnt/Productivity/Gamemaking/Godot/Projects/BrokenPinJoints/Godot.SourceGenerators/Godot.SourceGenerators.ScriptMethodsGenerator/AssetPlacer.Snapping_ScriptMethods.generated.cs:line 138
at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 24
Interesting, can you open the scene res://addons/assetplacer/gizmos/Grid.tscn and tell me what you see, or what error you get?
It fails to open it giving:
Cannot load shader: res://addons/assetplacer/Gizmos/GridDistanceFade.gdshader
Failed loading resource: res://addons/assetplacer/Gizmos/GridDistanceFade.gdshader. Make sure resources have been imported by opening the project in the editor at least once.
scene/resources/resource_format_text.cpp:592 - res://addons/assetplacer/gizmos/Grid.tscn:8 - Parse Error:
Failed loading resource: res://addons/assetplacer/gizmos/Grid.tscn. Make sure resources have been imported by opening the project in the editor at least once.
The shader file itself opens fine so it's quite strange. Strangely enough manually editing the dependency and reselecting the shader fixed this. After doing this the plugin isn't spitting out errors anymore either! Thanks for the help, seems to be godot scene links breaking for some odd reason, its possible they corrupted but I downloaded it only a few weeks ago and all the data is there so quite strange.
I'm relieved that you found a solution @ZachAR3! Would you mind telling me also what OS you're on, such that I may be able to troubleshoot this completely if it ever comes up again?
I'm relieved that you found a solution @ZachAR3! Would you mind telling me also what OS you're on, such that I may be able to troubleshoot this completely if it ever comes up again?
Sure, I'm running Endeavour OS on Kernel 6.5.8-zen1-1-zen and Godot 4.1.2.mono
I just bought this yesterday and I am having this exact issue. Fails to load shader and 60fps NPE spam leading to total system memory consumption after a couple hours.
OS: Ubuntu 23.04
Godot: v4.2.1.stable.mono.official [b09f793f5]
I believe the problem is a path casing error in the Grid*.tscn
files. Check this out:
The scene file has Gizmos
, with a capital G
, but it's small-g gizmos
on my filesystem and in the zip I downloaded from itch.io. Oddly, the line right below it has correct case so I'm not quite sure how we ended up here lol
[ext_resource type="Shader" path="res://addons/assetplacer/Gizmos/GridDistanceFade.gdshader" id="1_iubw6"]
[ext_resource type="Script" path="res://addons/assetplacer/gizmos/GridVertices.cs" id="2_084j1"]
In any event, a patch would be appreciated. I imagine this must affect all linux/mac users.
Thank you for this hint @tctimmeh, a patch is out now! Good luck with your project :)