Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser

Quick Information

A Java-style Optional<T> implementation for Godot Engine (GDScript). Helps you safely wrap nullable values and avoid unsafe null checks.
License
This project is licensed under the MIT License.
Optional for Godot (GDScript)
A Java-style Optional<T>
implementation for Godot Engine (GDScript). Helps you safely wrap nullable values and avoid unsafe null checks.
Features
Optional.of(value)
β requires a non-null valueOptional.of_nullable(value)
β wraps value, allows nullOptional.empty()
β explicitly empty optionalunwrap()
β get the value or assertunwrap_or(default)
β get value or fallbackmap(func)
β transform value if presentflat_map(func)
β transform with function returning Optional
Example
var maybe_number = Optional.of_nullable(42)
maybe_number.if_present(func(v): print("Value is: ", v))
var result = maybe_number.map(func(v): return v * 2).unwrap_or(0)
print(result) # -> 84
Installation
- Copy the
addons/optional/
folder into your project. - Enable the plugin in Project Settings β Plugins.
- Use
Optional
in your scripts.
A Java-style Optional
Reviews
Quick Information

A Java-style Optional<T> implementation for Godot Engine (GDScript). Helps you safely wrap nullable values and avoid unsafe null checks.