Hello. I came up with a problem I cannot seem to figure out on myself no matter how hard I try.
I have a simple script which uses button/mouse input to run an AnimationClip. It works flawlessly in the editor and gives me 0 errors in the console, but once I build the game for Standalone or Web platform, nothing happens on the input. The animation works without the script when set to play automatically, so I think the problem is with the script, but I just can’t figure out what’s wrong with it.
Here’s the script:
#pragma strict
var OpenSound : AudioClip;
function Update()
{
if (Input.GetButton("Fire1")) {
audio.PlayOneShot(OpenSound);
animation.Play("Hitweapon1");
}}
PS. The AnimationClip is marked as Legacy since it doesn’t work without doing so.
PPS. I’ve tried modifying the script using “GetButtonDown” instead of “GetButton”, using a specific KeyCode instead of “Fire1”, using a variable for the AnimationClip, none of these make a difference, it does not work once I build it for Standalone or Web.