facebook twitter hatena line email

「Unity/Csharp/AddComponent」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「==BoxCollinder2dを追加== GameObject gameObj = new GameObject(); BoxCollider2D box = gameObj.AddComponent<BoxCollider2D>() as BoxCollider2D; gameObj.AddComponent<Tex...」)
 
(BoxCollinder2dを追加)
行1: 行1:
==BoxCollinder2dを追加==
+
==BoxCollinder2Dをコードで追加==
 
  GameObject gameObj = new GameObject();
 
  GameObject gameObj = new GameObject();
 
  BoxCollider2D box = gameObj.AddComponent<BoxCollider2D>() as BoxCollider2D;
 
  BoxCollider2D box = gameObj.AddComponent<BoxCollider2D>() as BoxCollider2D;
 
  gameObj.AddComponent<Text1Script>();
 
  gameObj.AddComponent<Text1Script>();

2017年9月21日 (木) 23:54時点における版

BoxCollinder2Dをコードで追加

GameObject gameObj = new GameObject();
BoxCollider2D box = gameObj.AddComponent<BoxCollider2D>() as BoxCollider2D;
gameObj.AddComponent<Text1Script>();