質問するログイン新規登録

質問編集履歴

1

色コード追記。

2019/11/02 09:38

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -56,4 +56,33 @@
56
56
  line.GetPositions(out positions);
57
57
  Debug.Log(positions.length);
58
58
  ```
59
- ご教示お願い致します。
59
+ ご教示お願い致します。
60
+
61
+ ### 追記。
62
+
63
+ 色がなぜか反映されませんでした。
64
+
65
+ ```C#
66
+ void Start()
67
+ {
68
+ GameObject newLine = new GameObject ("Line");
69
+ LineRenderer line = newLine.AddComponent<LineRenderer> ();
70
+ line.positionCount = 3;
71
+ line.startWidth = 0.2f;
72
+ line.endWidth = 0.2f;
73
+ line.startColor = Color.red;
74
+ line.endColor = Color.blue;
75
+ Vector3 pos1 = new Vector3 (0.0f, 0.0f, 0.0f);
76
+ Vector3 pos2 = new Vector3 (5.0f, 5.0f, 0.0f);
77
+ Vector3 pos3 = new Vector3 (3.0f, 2.0f, 1.0f);
78
+ line.SetPositions(new Vector3[]{pos1, pos2, pos3});
79
+ /*
80
+ Vector3[] positions = new Vector3[line.positionCount];
81
+ line.GetPositions(positions);
82
+ foreach(Vector3 vertex in positions){
83
+ Debug.Log(vertex);
84
+ }
85
+ */
86
+ }
87
+ ```
88
+ ![イメージ説明](fbdc16a7952f8a8c94eaffee01cb8ad9.png)