For some reason this is no longer working. Ive used this in MANY scripts and they work fine. But for some reason, since 3.5 came a few of my newer scripts and long with some that were just before 3.5 do not assign the player tag. What is going on here?!
I would suggest spliting your code into two statements. This will help debugging:
Transform t = null;
GameObject taggedObject = GameObject.FindWithTag("Player");
if (taggedObject != null)
{
t = taggedObject.transform;
}
else
{
Debug.Log("Object not found");
}
if (t != null)
{
// do something
}
Secondly, check the TagManager to ensure the tag exists.