Quantcast
Channel: Questions in topic: "help me"
Viewing all articles
Browse latest Browse all 115

How to update a script to a network script

$
0
0
Hey, sorry to ask but I'm new at this and while my script works perfectly I've ran into an issue. As such I've made a basic script that creates a prefab object at the ray cast hit location and while it appears to the person whose placed it, I have no idea on how to make it appear for other players in the game. As all they see is when the placer is standing on it they are floating.....anyway I've tried a couple solutions yet I can never get it too work, so if anyone could please tell me how I would go about this, I would be most grateful. using UnityEngine; using System.Collections; public class delete : MonoBehaviour { RaycastHit hit; public Transform prefab; // Use this for initialization void Start () { } // Update is called once per frame void Update () { Ray ray = camera.ViewportPointToRay (new Vector3 (0.5F, 0.5F, 0)); Vector3 G = new Vector3 (Mathf.Round (hit.point.x), Mathf.Ceil (hit.point.y), Mathf.Round (hit.point.z)); if (Physics.Raycast (ray, out hit)) { if (Input.GetMouseButtonDown (2)) { Destroy (hit.collider.gameObject); } if (Input.GetMouseButtonDown (1)) { Instantiate (prefab, G, Quaternion.identity); } if (Input.GetMouseButton (1)) { animation.Play ("right_hand_build 1"); } } } }

Viewing all articles
Browse latest Browse all 115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>