Build settings are incorrect

Hello,
When i play my game/project in unity, everything works fine.

But when i build and run the game/project things begin to just randomly not work. e.g. No Muzzle flash , GuiText does not work, a spinning object beings to spin 10x than what it script tells it to.

What am i doing wrong? or is this a fault with unity?

Thanks

The spinning object going 10X faster than it does in the editor suggests that your code isn’t properly framerate-independent. Use Time.deltaTime where necessary.

–Eric

That can also happen if you do some physic stuff inside Update instead of Fixedupdate.
And use Time.FixedDeltaTime whenever you are in FixedUpdate.

Thanks so far,

But why does the text not appear?
e.g.
Its the simple code from the FPS tutorial to display how many bullets left.

( Btw i think if i build the game, and run it on another computer, it works fine )

I think you OS are not compatible with this sotfware so this prevent to show your text code

Something odd is amiss if you have UnityGUI code not appearing, can you share the code you’re using for that?

– This is not the entire script, only the piece that i think may be problematic –

( In unity everything works, in a built version it does not, the guitext appears but without any of the variables (numbers, something wrong with ‘ToString?’ or maybe both clips bullet left being in the same update function could be a problem? )

(Script on character controller) - Part 1

private var machineGun : MachineGun;

function UpdateGUI () {

  • // Update machine gun gui*
  • // Machine gun gui is simply drawn with a bullet counter text*
  • if (machineGun) {*
  • clipGUI.text = machineGun.GetClipsLeft().ToString();*
  • bulletGUI.text = machineGun.GetBulletsLeft().ToString();*
  • }*

( Machine gun script ) - Part 2

var bulletsPerClip = 40;
var clips = 20;
private var clipsLeft : int = 0;
private var bulletsLeft : int = 0;

function GetClipsLeft () {
return clips;
}
function GetBulletsLeft () {

  • return bulletsLeft;*
    }

There i think thats the highlights of the script,
Thanks

The significant bit of the code was the OnGUI function, actually. A problem can sometimes occur if you use fixed pixel offsets to position GUI elements. The screen size is often different in the built player than in the editor. GUI elements that are positioned in a corner, say, can be offscreen in the finished player. Use the Screen class to position elements relative to the current screen size.

No no, the gui text appears, ( i can see it )

It is just displaying incorrect data when built

Ok so, Bump!

On play in Unity - GuiText = 40 ( The variable that is supposed to come up )

On play on exe - GuiText = Ammo ( The name )

What is the issue?