Bongoさんのコードをもとに挙動を確認しようとしたのですが
Assets/teach2/Graphic.cs(106,22): error CS0019: Operator `*' cannot be applied to operands of type `UnityEngine.Vector3' and `UnityEngine.Vector2'
と
Assets/teach2/Graphic.cs(114,21): error CS0019: Operator `*' cannot be applied to operands of type `UnityEngine.Vector3' and `UnityEngine.Vector2'
とエラーが出てしまいました。
var p = (vertex * headScale) + headOffset;
と
var p = vertex * shaftScale;
がだめらしいです。
どうすればいいですか・・・?
だめでした・・・
同じところでエラーが出ますね。
unityのバージョンは2017.2.0f3 Visualstudioを使っています。
Vector2同士って掛け算できないんでしょうか
リファレンス見る限りだとpublic static Vector2 operator * (Vector2 a, float d);
となっていました。
Assets/teach2/Graphic.cs(106,22): error CS0019: Operator `*' cannot be applied to operands of type `UnityEngine.Vector2' and `UnityEngine.Vector2'
Assets/teach2/Graphic.cs(114,21): error CS0019: Operator `*' cannot be applied to operands of type `UnityEngine.Vector2' and `UnityEngine.Vector2'
var p = (vertex * headScale) + headOffset;
var p = vertex * shaftScale;
Vector2のリファレンスを一番下までスクロールすると出てくるpublic static Vector2 operator * (Vector2 a, Vector2 b);を使いたかったのですが、先ほど過去バージョンのリファレンスを見てみたところ2017.4以前には載っていませんね...
ともかくエラーが出るからには、Vector2同士をそのまま掛け算するのはあきらめて
var p = new Vector2(vertex.x * headScale.x, vertex.y * headScale.y) + headOffset;
var p = new Vector2(vertex.x * shaftScale.x, vertex.y * shaftScale.y);
でどうでしょう。Vector2同士の乗算演算子でも内部的には同様になっているようですので、このように書き換えても動作上問題はないかと思います。