Skip to main content

UILensDistortion

Post-processing lens distortion effect exposed by the Java runtime.

Create in the Editor

  1. Ensure there is a UIController in the scene.
  2. Create a GameObject and add UIRect.
  3. Add the UILensDistortion component.

How to Use

  1. Get the component with myObject.findComponent(UILensDistortion.class).
  2. Read or write the component properties to control behavior.
  3. Test input or layout in Play mode.

Java Example

SpatialObject myObject = /* your object */;
UILensDistortion comp = myObject.findComponent(UILensDistortion.class);
if (comp != null) {
// set the border value:
comp.border = 0.5f;
// read the border value:
float borderValue = comp.border;

// set the center value:
comp.center = new Vector2(0.5f, 0.5f);
// read the center value:
Vector2 centerValue = comp.center;

// set the intensity value:
comp.intensity = 1f;
// read the intensity value:
float intensityValue = comp.intensity;

// set the mode value:
comp.mode = UILensDistortion.Mode.Barrel;
// read the mode value:
UILensDistortion.Mode modeValue = comp.mode;
}