- Home /
Problem with Camera instantiating
Hello..
Im instantiating my character.. (Its working really fine).
But how to assign the camera to the character now? The camera and the player are in the same prefab. I tried to use Parenting, but now the camera is always looking at the newest created player.
Im using this on the camera:
var target : Transform;
target = GetComponent(Transform).parent;
Is there a better way for instantiating? I just found "Find by tag" but isnt it the problem that it will search one of the many players and not the newest?
Thank you very much. I would be glad for a little easy example.
My second problem: Im using
function Awake(){
if(!networkView.isMine){
enabled=false;
}
}
//Other script
function Awake(){ Spawnplayer(); }
function Spawnplayer(){ var myNewTrans : Transform = Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0); }
I get every time a player connect a new Object.. the problem is that all other players (Exept the newest one are loosing networkView.Ismine ... why?
Answer by YeOldeSnake 1 · Jan 29, 2011 at 07:32 PM
Where is the
if(!networkView.isMine){
enabled=false;
}
located , if its in an empty game object which serves as a manager or something you should put the code in OnLevelWasLoaded , since awake will only execute the code when it gets instantiated by whatever player
Your answer
Follow this Question
Related Questions
Spawning problems with cameras 1 Answer
Needs help to instantiate camera as child of player 0 Answers
[UNET] How to know the connectionID of a player ? 2 Answers
Instantiating prefab camera 2 Answers
Can't move instantiated prefab 2 Answers