Code Monkey home page Code Monkey logo

sfxmanager's Introduction

UNITY SFX MANAGER

by Varollo


What is it?

Unity SFX Manager is a Sound Manager for 2D sounds, like Background Music and Sound Effects, that uses a Scriptable Object based manager, meaning you don't need any instances of it on your scene.

How to install it?

You can clone this repository or add it to your project with Unity's Package Manager if you have git installed on your machine.

How to use it?

Somewhere in your project, right click and go to:

Create/Varollo/SFX Manager/New SFX Mananger

This will create a instance of the ScriptableSFXManager class. Inside it you can create multiple SFXTrack objects, and for each, multiple Sound objects.

To play a sound from a track you can call Play(trackName, soundName), or you can call with one single parameter Play(track_sound). track_sound being a string with the track name and sound name separated by a _ character. This means a tracks cannot be named with _ character. Sounds don't have that problem.

Once you call Play on that instance of the Manager, if not already, a new AudioSource will be instantiated in your scene for the playing track, and the sound parameters will be loaded into that AudioSource.

The created object is persistent between scenes, and will only be recreated if it ever get's destroyed.

The C# class Generator

You can also (if you choose) generate a C# class containing const string values for each song, inside a struct for each track. Just check the Generate Cs Class field in the inspector.

But WARNING: The generated class must be in the same folder as the scriptable object instance!

Disclaimer

I am not supporting this that much, it's just a thing for me to use in multiple projects, but none the less, you can use it if you don't mind the lack of support from my side.

I also plan on making a custom editor for it in the future, but don't get your hopes to high.

sfxmanager's People

Contributors

varollo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.