Version: 2021.3
언어: 한국어

Vector3IntConstructor

매뉴얼로 전환
public Vector3Int (int x, int y, int z);

파라미터

x The X component of the Vector3Int.
y The Y component of the Vector3Int.
z The Z component of the Vector3Int.

설명

Initializes and returns an instance of a new Vector3Int with x, y, z components.

// Attach this script to a GameObject.
// Attach a Tilemap component to the GameObject (Click Add Component button in the Inspector window and go to 2D<Tilemap)
// This script sets a Tile at a Vector3Int position
using UnityEngine;
using UnityEngine.Tilemaps;

public class Vector3IntCtorExample : MonoBehaviour { Vector3Int m_Position; Tilemap m_Tilemap; Tile m_Tile;

void Start() { // Position to set the Tile at m_Position = new Vector3Int(1, 5, -2); // Fetch the Tilemap you attach to the GameObject m_Tilemap = GetComponent<Tilemap>(); // Create a Tile m_Tile = ScriptableObject.CreateInstance<Tile>(); }

void Update() { // Sets a Tile at the position if a Tile does not exist at the position on the Tilemap if (!m_Tilemap.HasTile(m_Position)) m_Tilemap.SetTile(m_Position, m_Tile); } }

public Vector3Int (int x, int y);

파라미터

x The X component of the Vector3Int.
y The Y component of the Vector3Int.

설명

Initializes and returns an instance of a new Vector3Int with x and y components and sets z to zero.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961