gdquest-demos/godot-shaders

Dissolve2D demo crashes on launch

cogwoz opened this issue · 0 comments

I'm submitting a...

  • Bug report.
  • Feature request.

Bug report

What is the current behavior?
The Dissolve2D shader demo crashes on launch due to an "Invalid get index" error in Particles2D.gd.

# ...
func _physics_process(_delta: float) -> void:
	var data := emission_mask.get_data().data
	var width: int = data.width
	var height: int = data.height
	var raw: PoolByteArray = data.data

	var positions := PoolVector2Array()

	for x in width * height:
		for y in height:
			var idx: int = (y * width + x) * 4
			var byte: int = raw[idx] # <--- This line causes the error
			if byte > 128:
				positions.append(Vector2(x, y) * 8 - position)
	# ...	

Steps to reproduce

  • Run the Dissolve2D shader scene