Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. void Instantiate_Empty(){
  2. GameObject my_instantiate = Instantiate (my_instantiate_prefab, new Vector3 (0, 0, 0), Quaternion.identity)as GameObject;
  3.         my_instantiate.transform.SetParent (my_parent.transform);
  4.         NetworkServer.Spawn (my_instantiate); //How can i change transform of this spawn object?
  5.  
  6.         if (NetworkServer.active) {
  7. //Here i reference the position , rotation and parent to send it if im a client or if im the server
  8.             Rpc_Instanciate_Empty (new Vector3 (-0.019f,0.006f,-0.0878f), new Vector3 (-24.8839f,-180f,90f),my_instantiate,my_parent);
  9.         } else if (!NetworkServer.active) { //if i'm client
  10.         Cmd_Instanciate_Empty_Mains (new Vector3 (-0.019f,0.006f,-0.0878f),new Vector3 (-24.8839f,-180f,90f),my_instantiate,my_parent);
  11.         }
  12. }
  13.  
  14. Void Rpc_Instantiate_Empty(Vector3 localpos ,Vector3 localrot,GameObject my_instantiate,GameObject my_parent){
  15.        my_instantiate.transform.parent = my_parent.transform; //This doesnt work , i dont know how change transform of the spawn object
  16.         my_instantiate.transform.localPosition = localpos;//Here too
  17.         my_instantiate.transform.localEulerAngles = localrot;//Here too
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement