Я только начинаю заниматься разработкой игр и работаю в Unity, 2d. Я работал над созданием простой сетки, чтобы создать поле зрения игрока и NPC. Весь мой код и настройки Unity такие же, как в учебнике, но сетка либо не отображается, либо просто невидима. Вот мой код.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerFOV : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Mesh mesh = new Mesh();
GetComponent().mesh = mesh;
Vector3[] vertices = new Vector3[3];
Vector2[] uv = new Vector2[3];
int[] triangles = new int[3];
vertices[0] = Vector3.zero;
vertices[1] = new Vector3(50, 0);
vertices[2] = new Vector3(0, -50);
triangles[0] = 0;
triangles[1] = 1;
triangles[2] = 2;
mesh.vertices = vertices;
mesh.uv = uv;
mesh.triangles = triangles;
}
// Update is called once per frame
void Update()
{
}
Я только начинаю заниматься разработкой игр и работаю в Unity, 2d. Я работал над созданием простой сетки, чтобы создать поле зрения игрока и NPC. Весь мой код и настройки Unity такие же, как в учебнике, но сетка либо не отображается, либо просто невидима. Вот мой код. [code]using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerFOV : MonoBehaviour { // Start is called before the first frame update void Start() { Mesh mesh = new Mesh(); GetComponent().mesh = mesh;
Vector3[] vertices = new Vector3[3]; Vector2[] uv = new Vector2[3]; int[] triangles = new int[3];
vertices[0] = Vector3.zero; vertices[1] = new Vector3(50, 0); vertices[2] = new Vector3(0, -50);