Agreed w/ A.Killingbeck, how do you know it's being called twice? Are you sure you don't have 2 of the same script attached to gameobjects in your scene?
There's probably just something weird I'm doing. But putting a flag to make sure awake doesn't get called more than twice fixes it all. And I know there's not some strange second script somewhere cause the flag fixed it. If there were two separate scripts then I would have seen the message logged twice.
That's just a bandaid... you should figure out why Awake is being called more than once. Because it shouldn't be. Are you calling 'SendMessage("Awake")' anywhere? What does your code look like?
Nevermind. I wrote a search script which searched for any given script in the scene. Looks like I accidentally dropped the script on something else buried in the hierarchy so there were two instances (facepalm).
Hi. Recently I also had such an issue. Awake() was called twice when I exited from play mode. After some research through SmartGit change-logs found out that the error was after I had added Code (CSharp): [ExecuteInEditMode] for the Script. I hope this will help others also.
My problem was the same, did you find a workarround to fix it without removing the [ExecuteInEditMode] ?
In my case it was ok to remove [ExecuteInEditMode]. But you can run the body of Awake() method only when application is in "playing" state. Code (CSharp): private void Awake() { if (Application.isPlaying) { // Do Something } }