- Home /
Unity project 3.5 to 4 issues
I have been working on a project in unity 3.5. After upgrade to unity 4 I've encountered a null reference exception from one my scripts using GameObject.FindWithTag("MainCamera"). but I have my camera as a prefab tagged as "MainCamera". I also have another issue with box colliders set to be triggers but still acting like colliders. If anyone knows why this would be happening I would be very happy to know.
Please let me know if this isn't enough information to go off of.
Thanks in advance for your time.
for GameObject.FindWithTag("$$anonymous$$ainCamera") try retyping it in the tag of the game object. Also make sure it isn't like this "$$anonymous$$ainCamera ". Unity is very picky, double checking won't hurt. If not try posting some pictures or code to see if someone could help resolve the issue. What you've done is right and should work.
I was just playing around with it and found that when I have the camera prefab selected (Visible in the inspector). Then run the game, GameObject.FindWithTag("$$anonymous$$ainCamera") works. But I can't open the inspector and select the prefab every time I want to play the game.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091017im_/https://answers.unity.com/themes/thub/images/avi.jpg)