- Home /
Question by
padraig102 · Apr 20, 2014 at 02:50 PM ·
javascriptprefabaudio
Scale messing with code
I have a coin in my game that when collected(using trigger) gives the player points and also an audio play.
The coin was small so I increase the scale to 4.
but now audio and points are 4 times the amount they should be.
eg. instead of 1 point you get 4 and instead of 1 audio it plays 4 times.
Here's my code:
for score:
var score = 0;
function OnTriggerEnter( other : Collider ) {
if (other.tag == "Coin") {
score += 1;
Destroy(other.gameObject, .9);
}
and audio:
var flushClip:AudioClip;
function OnTriggerExit(o:Collider){
audio.PlayOneShot(flushClip);
}
I'm guessing I have to change the scale back to 1 but then the prefab is too small.
Comment
I'm really confused on how the scale of an object affects score += 1;
. If you want to keep the scale ingame to 1, change the import settings; for 3D models, it's just a variable called import scale in the inspector, if it's an image, use any image editing software to change the resolution