- Home /
Question by
thef1chesser · Nov 21, 2014 at 12:22 PM ·
c#cameramodellayer
How to put every modelpart in the correct layer in code?
I have a multiplayer game where players can turn invisible.
Each player will have their own layer and when the game starts, the models for the players need to be assigned to these layers when the game starts.
All I need to know is how to access all the object parts of the model so I can put the respective layers to the correct layer?
GameObject obj = (GameObject)Instantiate(Resources.Load<GameObject>("Prefabs/KartTall"), p1.transform.position, p1.transform.rotation);
obj.transform.parent = p1.transform;
obj.layer = p1.layer;
This is what I had and the kart just remains visible, so I know I need to get in the model to give the seperate parts the correct layer.
*p1 is an empty game object which has the spawn point and layer info for player 1.
Comment
Your answer
Follow this Question
Related Questions
Can I make the camera see only a part of an object? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Moving cam to upwards ? 0 Answers