PointerPrefab
How do I use Pointer Prefab
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
18 | GameObject markerObject = (GameObject) GameObject.Instantiate(this.PointerPrefab); | 1 |
File name: HighlightOwnedGameObj.cs
Copy
12 private void Update()
13 {
14 if (photonView.isMine)
15 {
16 if (this.markerTransform == null)
17 {
18 GameObject markerObject = (GameObject) GameObject.Instantiate(this.PointerPrefab);
19 markerObject.transform.parent = gameObject.transform;
20 this.markerTransform = markerObject.transform;
21 }
22
23 Vector3 parentPos = gameObject.transform.position;
24 this.markerTransform.position = new Vector3(parentPos.x, parentPos.y + this.Offset, parentPos.z);
25 this.markerTransform.rotation = Quaternion.identity;
26 }
27 else if (this.markerTransform != null)
28 {
29 Destroy(this.markerTransform.gameObject);
30 this.markerTransform = null;
31 }
32 }
PointerPrefab 121 lượt xem
Gõ tìm kiếm nhanh...