=( Scripts working in editor but not in executable

I need quick help…
I have scripts that work in the editor-test-mode but they dont seem to work in the final executable. Can someone tell me why?

Are you referencing Application.loadedLevel? There is a known bug with this where it returns -1 unless you must reload the first level when the executable initially starts.

We are loading a level and this works fine! The level is rendered correctly, no problems there! but the KI script is not working properly altough it did so in the editor!

Are you using the Awake function at all, I’ve had issues with that, moving everything to Start sorted it out.

one thing i realized it that some script-components work and others dont…
EDIT: No awake…

check the inspector, had similar problem before.

some components are unchecked or checked, some are parented to others. not sure if you have the same problem but it looks like it.

Ray

Well but then it wouldn’t work in the editor too.

I had an issue were running on the game view works but when building it did not produce the same result.

I found out in the inspector that I had some script checked and some was referencing other GO. how did it happen, not sure but probably some keyboard shortcuts that I was doing messed some stuff up.

just an idea btw.

Ray

So i found the bug =/
This works in the editor:
var gameobject : Gameobject;
:arrow: if(gameobject!=0)
but not in a compiled game
so i just changed it to
:arrow: if(gameobject)
EDIT: in a compiled game gameobject is always !=0

Maybe you want gameobject!=null. I’m not sure 0==null, so that could have been why.