
Sound States On Grab Script
- Item name
- Sound States On Grab Script
- Category
- Scripts
- Sold by
- MorganeParis
- Min. resale price
- 50
- Listed
- 10/24/2025
Description
Version 1.1.2 Put this script on a lantern, a music box, a toy, any prop your visitors can pick up: a base sound plays while the object is free (a hum, an ambience, a music pad), a held sound takes over while it is carried, and a release sound plays when it is let go, once or looped until the base sound comes back after a delay you choose. The sounds play from the object's Audio component, so they follow it around the scene. No scripting skills needed. New in 1.1.2: a quick release, grab and release keeps the full timing (the release sound plays its whole time and the base sound starts once), a volume of 0 really plays no sound, warnings in the script console for a missing Audio component, a wrong component name, an object that cannot be grabbed or a release loop too short to be heard, and a Debug Logging switch. Settings grouped by category in the Build panel. Fully standalone. ________________________________________ Key Features Three sound states • Base: while the object is not held, looped or once (at scene start and after each release) • Held: while the object is carried, looped or once per grab • Release: when the object is let go, once or looped until the next grab or the base resume Timing and volume • Resume Base After Release with its own delay (0 to 5 s): set it to the length of your release sound • Volume per sound from 0 to 200 percent (100 = as recorded, 0 = no sound) Audio component • Sounds play on the object's Audio component and follow it; name the component to use, or the first one is taken • Without an Audio component, the sounds play at the object position ________________________________________ Technical Details • 13 settings in five groups: Audio, Base, Held, Release, Debug • Requires a grabbable physics object (RigidBody); an Audio component is recommended • Volumes converted to decibels (200 % = about +6 dB, half the amplitude at 50 %) • Warnings at start: no Audio component, component name not found, object not grabbable, release loop shorter than a second with the base resume On • Optional Debug Logging: chosen Audio component and every sound start ________________________________________ Example Uses • A lantern that hums, clicks when grabbed and whooshes when released • A music box that gets louder in the hands • A magic orb with an energy loop and a long reverb tail • Toys, tools and instruments in an interactive scene ________________________________________ Full documentation online: https://mpp-mainstore.com/sansar/SoundStatesOnGrab/ ________________________________________ Updating from 1.1 • Your settings are kept when you update the script: the 13 settings keep their values, only their labels change and move into groups. Take a screenshot of the Build panel first, update one object and check it before doing the others. • What changes: a volume of 0 plays nothing (1.1 played the sound almost silently); a fast release, grab and release keeps the full delay and starts the base sound once. Changelog — Version 1.1.2 • Version number only. Changelog — Version 1.1.1 • Quick release / grab / release: the release sound plays its full time, the base sound starts once. • Volume 0 = no sound, for the three sounds. • Warnings at start for a wrong setup; Debug Logging switch. • Settings grouped by category, clearer tooltips. Changelog — Version 1.1 • Release sound looped or one-shot, base resume with a delay. Changelog — Version 1.0 • First release. ________________________________________ Enjoy and Keep Good Vibes. Hugs from Morgane. ________________________________________