Errors since updating to Unity4

Options
Hello,

I've recently got back into game development and upgraded to Unity 4. However so far it's been nothing but headaches trying to get everything up and running again with what worked fine in Unity 3.4.

I've got two big problems at the moment:

#1 I have to continually re-specify the target framework to Mono/.NET 4.0 every time i re-open mono. This isn't a big deal but it's annoying.

#2 I cannot get a simple enabler script to work from i think the PUN tutorial:

[code2=csharp]using UnityEngine;
using System.Collections;

public class Enable : MonoBehaviour {

public GameObject game;
public GameObject mainMenu;
void Awake () {
if (PhotonNetwork.room != null)
{
game.SetActive(true);
Destroy(mainMenu);
}
else
{
Destroy(game);
mainMenu.SetActive(true);
}
Destroy(gameObject);
}
}[/code2]

I continually get the error "The name 'PhotonNetwork' does not exist in the current context" when I try and build in mono. However, the game compiles fine in unity, and runs fine.

My suspicion is this has something to do with a build order difference within mono (maybe it compiles Assembly-CSharp before Assembly-CSharp-firstpass because of alphabetical order in the list?). But I could be off base. Has anyone encountered this and fixed it?

Comments

  • Tobias
    Options
    It looks like you didn't import the PUN package to the project. Or did so twice or have other compile issues.

    Look into the console if this shows any errors. If not, you should re-import the PUN package. You can try version 1.18 which is not yet in the Asset Store but here:
    viewtopic.php?f=17&t=2333