This script is in a prefab. When I run the script, Unity says... "NullReferenceException: Object reference not set to an instance of an object"
Any help would be greatly appreciated.
asked Sep 23 '10 at 06:50 AM
Make sure that your camera is tagged as MainCamera, or "Camera.main" won't work. Otherwise, I've verified that your script is fine. Although, you could simplify it to:
(Note that you don't even need the campos variable, but for readability you could easily justify keeping it)