お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Closeオブジェクトがディスク上に保存されているかを確認します
通常はプレハブ、テクスチャ、オーディオクリップ、アニメーションクリップ、マテリアルのようなアセットがディスクに保存されます。 シーン上のオブジェクトの場合はfalseを返します。一般的にシーン上のというのはゲームオブジェクトまたはコンポーネントのことを指しますが、 コードからマテリアルを作成し、このマテリアルは未だディスクリ保存されていないというオブジェクトのことも 指します。
// Tells if an Object is stored on disk or not. class PersistentInfo extends EditorWindow { @MenuItem("Examples/Object on Disk?") static function CheckPersistent() { var persistent : boolean = EditorUtility.IsPersistent(Selection.activeObject); Debug.Log(Selection.activeObject.name + ": " + persistent?"Stored on disk":"Not on disk"); } @MenuItem("Examples/Object on Disk?", true) static function ValidateCheckPersistent() { return Selection.activeObject != null; } }