複数のコンポーネントの取得 Unity
http://unity3d.com/support/documentation/ScriptReference/Component.GetComponents.html- いままで単数形
hingeJoint = GetComponent<HingeJoint>();
- このようにGetComponent"s"と複数形「s」がいる
hingeJoints = GetComponents<HingeJoint>(); foreach (HingeJoint joint in hingeJoints) { joint.useSpring = false; }
- インデクシングも使える
hingeJoints[0];
UnityのJSの型キャスト Unity
ジェネリックスのキャストとas使うのがある。GetComponent<ExampleScript>(); // ジェネリックス GetComponent() as ExampleScript; // as使う
日本語がファイルに書き込めない 修正 Python
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)
これがうざい
# -*- coding: utf-8 -*- sys.setdefaultencoding('utf-8') f = codecs.open("./test.txt","w","utf-8")
とかで直るらしいがダメじゃん
reload(sys) sys.setdefaultencoding('utf-8')
reloadってのやればいけた
スクレイピング Python BeautifulSoup
参考:http://itpro.nikkeibp.co.jp/article/COLUMN/20080407/298191/?ST=develop&P=2http://www.crummy.com/software/BeautifulSoup/
↑ここからDL(Downloadフォルダへ入った)
展開
tar zxvf BeautifulSoup-3.2.0.tar.gz
TARGET_PATH=/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ cd $TARGET_PATH sudo mv ~/Downloads/BeautifulSoup-3.2.0/BeautifulSoup.py .