Fix example in `NoiseTexture` doc

This commit is contained in:
Yuri Roubinsky 2021-11-06 19:49:22 +03:00
parent 4651b2ae5c
commit 9b0dddd8e5
1 changed files with 3 additions and 2 deletions

View File

@ -8,8 +8,9 @@
NoiseTexture can also generate normal map textures.
The class uses [Thread]s to generate the texture data internally, so [method Texture2D.get_image] may return [code]null[/code] if the generation process has not completed yet. In that case, you need to wait for the texture to be generated before accessing the image and the generated byte data:
[codeblock]
var texture = preload("res://noise.tres")
yield(texture, "changed")
var texture = NoiseTexture.new()
texture.noise = OpenSimplexNoise.new()
await texture.changed
var image = texture.get_image()
var data = image.get_data()
[/codeblock]