VisualEffectAsset
Represents a VFX profile resource.
| Type | Name | Interface Description |
|---|---|---|
| Functions | constructor() | |
| Functions | getBool(name: string): boolean | undefined | • Function: Gets a named boolean value from VFX Profile. The key must match an exposed boolean property name from the VFX profile. Parameters • Returns The value of the boolean property or undefined. |
| Functions | getColor(name: string): Color | null | • Function: Gets a named color value from VFX Profile. Color keys are exposed color properties stored in the profile's vec4-backed property map and must match exactly. Parameters • Returns The value of the color property, or |
| Functions | getFloat(name: string): number | undefined | • Function: Gets a named float value from VFX Profile. Parameters • Returns The value of the float property or undefined. |
| Functions | getInt(name: string): number | undefined | • Function: Gets a named integer value from VFX Profile. The key can be either an exposed integer property name or a supported derived spawn key such as Parameters • Returns The value of the integer property or undefined. |
| Functions | getTexture(name: string): Texture | null | • Function: Gets a named texture value from VFX Profile. Texture keys must match exposed texture property names from the VFX graph/profile exactly. Parameters • Returns The value of the texture property, or |
| Functions | getVector(name: string): Vector2f | Vector3f | Vector4f | null | • Function: Gets a named vector value from VFX Profile. Vector keys must match exposed vector property names from the VFX graph/profile exactly. Returns Vector2f for vec2 keys. For vec4-backed keys whose name starts with Parameters • Returns The value of the vector property or null. |
| Functions | hasBoolKey(name: string): boolean | • Function: Checks if the VFX profile has a boolean key. The key must match an exposed boolean property name from the VFX profile. Parameters • Returns A boolean indicating whether the property exists in the VFX Profile. |
| Functions | hasColorKey(name: string): boolean | • Function: Checks if the VFX profile has a color key. Color keys are exposed color properties stored in the profile's vec4-backed property map and must match exactly. Parameters • Returns A boolean indicating whether the property exists in the VFX Profile. |
| Functions | hasFloatKey(name: string): boolean | • Function: Checks if the VFX profile has a float key. The key can be either an exposed float property name or a supported derived spawn key. Parameters • Returns A boolean indicating whether the property exists in the VFX Profile. |
| Functions | hasIntKey(name: string): boolean | • Function: Checks if the VFX profile has an integer key. The key can be either an exposed integer property name or a supported derived spawn key such as Parameters • Returns A boolean indicating whether the key exists in the VFX Profile. |
| Functions | hasTextureKey(name: string): boolean | • Function: Checks if the VFX profile has a texture key. Texture keys must match exposed texture property names from the VFX graph/profile exactly. If multiple context blocks expose the same key, this method returns true when any matching block contains it. Parameters • Returns A boolean indicating whether the property exists in the VFX Profile. |
| Functions | hasVectorKey(name: string): boolean | • Function: Checks if the VFX profile has a vector key. Vector keys must match exposed vector property names from the VFX graph/profile exactly. This method checks vec2, vec3, and vec4-backed exposed properties. Parameters • Returns A boolean indicating whether the property exists in the VFX Profile. |
| Functions | setBool(name: string, value: boolean): void | • Function: Sets a named boolean value on the VFX Profile. The key must match an exposed boolean property name from the VFX profile. Parameters • • |
| Functions | setColor(name: string, value: Color): void | • Function: Sets a named color value to VFX Profile. Color keys are exposed color properties stored in the profile's vec4-backed property map and must match exactly. If multiple context blocks expose the same key, this method updates every matching block. Parameters • • |
| Functions | setFloat(name: string, value: number): void | • Function: Sets a named float value to VFX Profile. Parameters • • |
| Functions | setInt(name: string, value: number): void | • Function: Sets a named integer value to VFX Profile. The key can be either an exposed integer property name or a supported derived spawn key such as Parameters • • |
| Functions | setTexture(name: string, value: Texture): void | • Function: Sets a named texture value to VFX Profile. Texture keys must match exposed texture property names from the VFX graph/profile exactly. If multiple context blocks expose the same key, this method updates every matching block. Parameters • • |
| Functions | setVector(name: string, value: Vector2f | Vector3f | Vector4f): void | • Function: Sets a named vector value to VFX Profile. Vector keys must match exposed vector property names from the VFX graph/profile exactly. For vec2-backed keys, pass Vector2f. For vec4-backed keys, pass Vector4f, or pass Vector3f only for keys that use the Parameters • • |
Examples
constructor()
let obj = new APJS.VisualEffectAsset();
setBool(name: string, value: boolean): void
export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set specific property to true
const asset = this.visualEffectComponent.asset;
if (asset.hasBoolKey('Bool_0_0') && !asset.getBool('Bool_0_0')) {
asset.setBool('Bool_0_0', true);
}
}
}
}
setColor(name: string, value: Color): void
export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set Color to red
const asset = this.visualEffectComponent.asset;
const red = new APJS.Color(1.0, 0, 0, 1.0);
const current = asset.getColor('Color_0_0');
if (asset.hasColorKey('Color_0_0') && current && !current.equals(red)) {
asset.setColor('Color_0_0', red);
}
}
}
}
setFloat(name: string, value: number): void
export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set specific property to 100.0
const asset = this.visualEffectComponent.asset;
if (asset.hasFloatKey('Float_0_0') && asset.getFloat('Float_0_0') < 100.0) {
asset.setFloat('Float_0_0', 100.0);
}
}
}
}
setInt(name: string, value: number): void
export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set specific property to 10
const asset = this.visualEffectComponent.asset;
if (asset.hasIntKey('Int_0_0') && asset.getInt('Int_0_0') !== 10) {
asset.setInt('Int_0_0', 10);
}
}
}
}
setTexture(name: string, value: Texture): void
export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
.....
if (conditions) {
// Set Texture to newTexture
const asset = this.visualEffectComponent.asset;
if (asset.hasTextureKey('Texture_0_0') && !asset.getTexture('Texture_0_0')) {
asset.setTexture('Texture_0_0', newTexture);
}
}
}
}
setVector(name: string, value: Vector2f | Vector3f | Vector4f): void
export class NewScriptComponent extends APJS.BasicScriptComponent {
......
onUpdate(deltaTime: number) {
if (conditions) {
// Set Vector3f to (1.0, 0, 0)
const asset = this.visualEffectComponent.asset;
const value = new APJS.Vector3f(1.0, 0, 0);
const current = asset.getVector('Vector3f_0_0');
if (asset.hasVectorKey('Vector3f_0_0') && current && !current.equals(value)) {
asset.setVector('Vector3f_0_0', value);
}
}
}
}
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use VisualEffectAsset here
}
onUpdate(deltaTime: number) {
}
}