Script to disable third person/first person

Hi everyone! My friend Silvers gave me a script that I don’t really think is working. The script’s job is the enable/disable the first/third person players. For some odd reason, neither of the players can see each other even if they are directly staring at each other, but I can see both players’ third person model in the editor. Here’s my code:

var thirdPlayer: transform
var firstPlayer : transform;
function Update() {
if(networkView.isMine == true){	
			thirdPlayer = transform.FindChild("ThirdPerson");
			thirdPlayer.gameObject.SetActive(false);
		}

		else{
			firstPlayer = transform.FindChild("FPSPlayer");
			firstPlayer.gameObject.SetActive(false);
		} 			 		
}

Anyone have any advice for me?

Thanks,
jSoftApps

Bump

I see a couple issues:

  1. You’re turning the objects off, but never on. If networkView.isMine ever changes, that will be wrong.
  2. If networkView.isMine doesn’t change, this setup should be happening once (in Start, possibly) instead of every frame.
  3. Even if it should happen every frame, doing a transform find is expensive. The object should be stored, and only changed when necessary.