sample random pitch on trigger...?

Hi there…I have a similar issue to the footsteps question before…would like to vary a sound’s pitch each time it is triggered…tried to modify the script for the footsteps pitch variation…but does not compile…

function Start(){

        audio.clip = squeakysample[Random.Range(0, squeakysample.length)];
        audio.Play();
       
    }

Also…do I attach this to the sample itself?

Apologies for newbiness…just beginning unity recently…cheers!

In ecs you communicate with entities by changing their data OR create dedicated entities that pass the message.

I can help you with this but I have a very vague idea of what you want here. "chunk" and "to make bigger", without context, mean everything and nothing to me. Sure there are ways to scale thousands of entities but I'm not sure where to begin without seeing more precise question or related code first.

2 Answers

2

You should definitely check out the car tutorial. There’s a script in there that changes the pitch of the car’s engine as it revs, and it’s one that I’ve taken apart and learned all sorts of things about audio.

Best of luck.

Thanks very much…will go see,
Cheers,
Lew.

lewchico: fyi, it's best to post responses as a comment ('add new comment') rather than a new answer if they're not an answer - and be sure to mark an answer as thumbs up if it answers your questions, since there's a list of unanswered questions that the site generates.