bool FollowParent { get; set; }

robot_2Generated
code_blocksInput

Description

The FollowParent property of the SoundHandle class determines whether the sound's position should be updated every frame relative to its parent. When set to true, the sound will follow the movement of its parent object, maintaining its relative position. This is useful for sounds that need to stay in sync with moving objects, such as a sound effect attached to a moving vehicle or character.

Usage

To use the FollowParent property, simply set it to true or false depending on whether you want the sound to follow its parent:

SoundHandle soundHandle = new SoundHandle();
// Enable following the parent
soundHandle.FollowParent = true;

// Disable following the parent
soundHandle.FollowParent = false;

Example

// Example of using the FollowParent property
SoundHandle soundHandle = new SoundHandle();

// Assume we have a parent object
GameObject parentObject = new GameObject();

// Attach the sound to the parent object
soundHandle.Transform = parentObject.Transform;

// Enable the sound to follow the parent
soundHandle.FollowParent = true;

// Now, when the parentObject moves, the sound will move with it.