I am creating a zombie type game and it’s going good. But I have this object that I want the player to look at and push F12 to play the music. (kinda like the easter eggs found in Call Of Duty zombie maps). This is what i have so far, but it keeps telling me to insert a semi colan. But there already is one!
var audio01 : AudioClip;
function Update () {
if (Input.GetKeyDown (“f12”))
{
audio.Marilyn Manson - Seizure Of Power(audio01);
}
}
P.S. it tells me to insert it at this line: audio.Marilyn Manson - Seizure Of Power(audio01);
P.S.S. Pictures and videos coming soon. Just really suck at weight painting the models and animating them.
oh ok. haha thank you!
but now i have another problem
when i save the script and everything i go to drag it on the trigger and it says that i cant put it on the object yet because it has not yet finished or completed the script. or something like that.
Any ideas whats wrong?
I don’t think any where. I just wanted a radar for my game so you could see where your team is and the zombies. So i searched on unity and found this one. It didn’t work. So I think I’ll just delete that one too.
If it’s not declared/defined anywhere, you’ll get an error. (Look at it this way - how will the compiler know what ‘blip2’ is supposed to refer to otherwise?)
Oh okay, I got you now. But one little problem. I want the play to look at the object and then F12 to play the music. Right now you can look anywhere, even the sky, and push F12 and it will still play the music.
It depends on what you mean by ‘look at’, but one option (assuming the object has a collider) would be to use raycasting to determine whether the player is looking more or less directly at the object.
Raycasting is done through code. A couple of tips:
Search the forums and the documentation for ‘raycast’.
Work through some of the various tutorials that are available (this will help you become more familiar with the basics of using Unity and with the basic concepts behind scripting and so forth).
Alright thank you I’ll give it a try. But now there is one other little problem (not with the trigger). The skybox. I go to create one and when i click skybox on the material. All the little squares don’t come up to where you drop your pictures in. Why? How do i fix it?
(Also the one that comes with unity is just all black and still has no squares, as well as the asset terrain package skyboxs)
you have to make the material a skybox. to do this, select you skybox material, click the thing that probably says diffuse of something like that (the little thing that you click thats right underneath the stuff that says the name of the material, but still in the grey box). go down to render fx, and select skybox in the little thing that pops out
hmm, do you have some errors in your codes at all? (maybe unity is acting funny and is not updating that because of those errors) if not, then there is probably something wrong with either unity (unlikely) or your install of unity (more likely), or even you just need to try again. if it does not work with you trying again, i would uninstall unity, and try reinstalling it.