Skip to main content

Useful Modules


Taking Character Photos

Capture character portraits at runtime with the GetCharacterPhoto() function.

Texture2D photoTexture = characterEntity.GetCharacterPhoto(Vector2 _imageSize, Color _bgColor, float _cameraAngle = 0F, bool _cameraLight = true);
  • _imageSize: A Vector2 specifying the width and height (in pixels) of the generated portrait texture.
  • _bgColor: The Color of the background of the portrait.
  • _cameraAngle: An optional float value (default: 0F) representing the offset angle around the Y-axis for the camera capturing the portrait.
  • _cameraLight: An optional bool value (default: true) to toggle an additional light source on during capture, useful if the character is in a dark environment.

Return Value: A Texture2D containing the character's portrait.


Animating Accessories (Back, Tail, Ears)

If your character's back, tail, or ear accessories have their own Animation components, you can directly access these components using the following functions:

Animation backAnimator = characterEntity.GetBackAnimationComponent();
Animation tailAnimator = characterEntity.GetTailAnimationComponent();
Animation headAccessoryAnimator = characterEntity.GetHeadAccessoryAnimationComponent();

Example (Playing a back accessory animation):

if (Player.GetBackAnimationComponent() != null){
Player.GetBackAnimationComponent().CrossFade("OpenFlap1", 0.25F);
}

Ensure you check if the component exists before attempting to access it to avoid potential null reference errors.


Managing Character Eyes

Control your character's gaze and eye expressions using these functions:

Look At Target:

characterEntity.SetLookAt(Transform _target); // Make the character look at the specified Transform.
characterEntity.SetLookAt(null); // Stop the character from looking at any target.

Blinking:

characterEntity.Blink(); // Trigger a blink animation.

Eye Openness:

characterEntity.SetEyeOpen(float _openPercentage); // Set the eye openness percentage (0f - 100f).

Applying Rim Effect

A rim effect can be used to highlight your character or provide visual feedback, such as when they are hit. Set Rim Color and Intensity:

characterEntity.SetRimColor(Color _color, float _intensity);
  • _color: The Color of the rim effect.
  • _intensity: A float value (typically between 0 and 1, though your original note mentioned 1~10, clarify the intended range).

Get Current Rim Color:

Color currentRimColor = characterEntity.GetRimColor();