Version: 2023.1
언어: 한국어
public static void PlaceGameObject (GameObject go, GameObject parent);

파라미터

go The GameObject to be initialized.
parent An optional GameObject to be set as the parent.

설명

Place the given GameObject in the Scene View using the same preferences as built-in Unity GameObjects.

Use this method to create GameObjects centered in the Scene View or at world origin, depending on user preference. This method also ensures that the GameObject has a unique name, also as defined by preferences.

using UnityEditor;
using UnityEngine;

// Creates a new GameObject with the same preferences that built-in GameObjects instantiate with. class CreateGameObjectExample { [MenuItem("GameObject/3D Object/My Cube")] static void CreateCube(MenuCommand command) { var gameObject = ObjectFactory.CreatePrimitive(PrimitiveType.Cube); ObjectFactory.PlaceGameObject(gameObject, command.context as GameObject); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961