adssencee

Thursday, May 21, 2020

How to setup Audio unity 2d game development?

How to setup Audio unity 2d game development



Hello, friend this me, Gour Hari Ghosh. so  I told you how to set up unity 2d game engines create Audio 

system for unity. fist create your unity game engine the First project You do not learn how to create your project please visit my 

Youtube channel Dbz shiva here you see the 2d game development tutorials here is you learn the project how to create 2d game project

setup And Camera setup unity 2d game development. how to create Andriod Button unity cross-platform 

input manager. And Other features so let's go below the Images.  



So Friends you see Red color text what are doing here. So I told you first create unity 2d game engine 

Hierarchy panel right  mouse click create Two GameObject  first name Music and the second  name is

SFX. After that go to Game control script unity game Engine Open Visual studio open the Scripts.

See the picture



 [Header("audio")] you look image this your Audio header After creating Two variables  public

AudioSource SFX clip;  public AudioSource musce; Now Save you scrips And build Script. What Are

want. Now got your unity game Engine  you See Audio header below SFX And musce  now drag you

game Object .muse to muse And SFX to SFX before muse Game Object Add Component Audio Source

Sfx GameObject AddComponet Audio Source.now go to your Visual Studio And you see the

same create player variables the  just like  public AudioClip jump clip; public AudioClip Attackclip;

public AudioClip[] footstep; then save your Game Controller Scripts. and got unity 2d game engine

you look game controller Scripts Sfx And musice below three create variables jump clip And Attack

Setup, foot setup. now dag your Asset folder your Audio clip. now unity 2d game engines Import

your Audio clip. Select your jump Audio clip and drag it the game controller variables jump clip transform

second Attack setup drags your Audio file yo game controller Attack setup transform. now See the

Image 


create your musce reference for your Audio clip just like see the Abobe Image:-   public void

plysfx(AudioClip audio, float voulim)
    {
        sfxclip.PlayOneShot(audio, voulim);

    }

This reference used for player-controlled Scrips. now look the Image player Controller jump Scripts

See the Images




this coading create first now go tour jump setup see the Image



if (CrossPlatformInputManager.GetButtonDown("Attack")&& isAtttack==false)
        {
            _Gamecontrler.plysfx(_Gamecontrler.Attackclip, 0.5f);

About the Image this variables types now go to your unity 2d game engines And play your game you

see the gameplay now press jump Button you hear your sound clip. now same pose your Attack sound

System. Foot Step Sound System So deferents  you see the Images this variables use your footstep


 public AudioClip[] footstep; now Select your character go to Animation walk And run Setup frame

who's the frame you Sound it See the Image 

+ click And function button select Footstep. now go your player controller Scripts now create new

function   void Footstem()
    {
        _Gamecontrler.plysfx(_Gamecontrler.footstep[Random.Range(0, _Gamecontrler.footstep.Length)], 0.5f);

    }
this your foot Step function After that go to your unity game engine play your game you hare your Foot

Step Sound more About Information Vist my Youtube channel Dbz shiva See the video Sound Setup for

100 % sure Working your sound  more About Information see the video




friends unity game development Other Search you see my blog please visit Oteh post.














No comments:

Post a Comment

Please do not Enter any Spam link in the Comment Box