Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
public class Decal : MonoBehaviour
{
public GameObject decalPrefab;
void Start ()
{
}
void Update ()
{
RaycastHit hit;
if (Physics.Raycast(camera.ScreenPointToRay(Input.mousePosition), out hit))
{
if (hit.collider.tag == "DecalOn" && Input.GetMouseButtonDown(0)){
var decal = Instantiate(decalPrefab, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
decal.transform.parent = hit.transform;
}
}
}
}
using System.Collections;
public class Decal : MonoBehaviour
{
public GameObject decalPrefab;
void Start ()
{
}
void Update ()
{
RaycastHit hit;
if (Physics.Raycast(camera.ScreenPointToRay(Input.mousePosition), out hit))
{
if (hit.collider.tag == "DecalOn" && Input.GetMouseButtonDown(0)){
var decal = Instantiate(decalPrefab, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
decal.transform.parent = hit.transform;
}
}
}
}
Подскажите как исправить ошибку?