Fix example in NoiseTexture
doc
This commit is contained in:
parent
4651b2ae5c
commit
9b0dddd8e5
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user