言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Undo.RegisterCreatedObjectUndo

Suggest a change

Success!

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

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function RegisterCreatedObjectUndo(objectToUndo: Object, name: string): void;
public static void RegisterCreatedObjectUndo(Object objectToUndo, string name);
public static def RegisterCreatedObjectUndo(objectToUndo as Object, name as string) as void

Parameters

objectToUndo 作成されたオブジェクト
name メニューに表示される "Undo ...." のアクション名

Description

新しくオブジェクトを生成する時のUndo操作を登録します

このUndoを実行した時、オブジェクトは削除されます。 全ての新しく生成したオブジェクトはこの関数を使用してUndo可能な状態にするべきです。

// Creates a new game object as an operation that can be undone

using UnityEditor;
using UnityEngine;

class CreateGameObjectMenu
{
	[MenuItem ("Example/Create GameObject")]
	static void CreateGameObject ()
	{
		GameObject go = new GameObject ("my GameObject");
		go.transform.position = new Vector3 (5, 5, 5);
		go.RegisterCreatedObject (go, "Create object");
	}
}
no example available in C#
no example available in Boo