Post

Unblocked!

Originally posted on itch.io

Originally posted on itch.io

Unblocked!

Ran into an annoying InvalidCastException recently – turned out that I had changed the type of a node from Node2D to Camera2D but without updating the attached script from 

1
2
public partial class CameraMovement : Node2D

to

1
2
public partial class CameraMovement : Camera2D

This meant that when I would “get” this object, either by direct reference, or a helper method like GetViewport().GetCamera2D, it would fail the cast and spam an exception every frame.

It took me a while to spot it, partly because I’m working on this project so sporadically so I had completely forgotten the node type change, but it was a quick fix at least!

New build runs as expected, at last! Feel much better being unblocked.

All rights reserved by the author.