Animation Event script (java)

I am trying to follow these two videos.

It seems that adding the ‘-’ before the ‘{’ is not working but it’s not working at all.

I assume it is due to being an old example but how do I update the code to work with the current version of Unity?

function PlayAudio (aud:AudioClip)
{
    audio.clip = aud;
    audio.Play();
    }

    Function PlayParticle (par:GameObject)
    {
    Instantiate(par,transform.position,transform.rotation);
    }

you’ve not said what problems you’re having, and giving us the tutorials you’re trying to follow doesn’t tell us what you’re doing…

having said that, “function” not “Function” code is case sensitive

Well in the tutorial it is lower cased… and the scripts do not work.

“UCE0001: ‘;’ expected. Insert a semicolon at the end.”
“BCE0043: Unexpected token: par.”
“UCE0001: ‘;’ expected. Insert a semicolon at the end.”

Like I stated it looks like it is just outdate code but I don’t know how to update it?

I am not familiar with Java but this *supposed to be) simple script would fit just right if it worked…

in your code snippet one of the functions is with a capital “F”, so it’s not being treated as the keyword “function” which is confusing the compiler and causing it to throw odd errors about elements later on in the line.

Thank you LeftyRighty… sorry for some reason Java does not autocomplete in monodevelope at all so my low level scripting skills are not kindly adjusted like in c#

Your where of course correct :wink:

1 Like