回答編集履歴
1
追記
test
CHANGED
@@ -45,3 +45,29 @@
|
|
45
45
|
gameObj.GetComponent<RectTransform>().sizeDelta = new Vector2(texture.width, texture.height);
|
46
46
|
|
47
47
|
```
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
---
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
追記:
|
56
|
+
|
57
|
+
サイズについて、以下のようにすれば、Texture2Dは不要でした。
|
58
|
+
|
59
|
+
```C#
|
60
|
+
|
61
|
+
// サイズを取得し、変更する
|
62
|
+
|
63
|
+
float width = sprite.rect.width;
|
64
|
+
|
65
|
+
float height = sprite.rect.height;
|
66
|
+
|
67
|
+
gameObj.GetComponent<RectTransform>().sizeDelta = new Vector2(width, height);
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|