Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
public class RUBKA : MonoBehaviour {
public GameObject derevor;
public GameObject drova;
public int livederevo;
void Update()
{
if(Input.GetMouseButtonDown(1))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit,100 ))
{
if(hit.transform.gameObject == derevor)
{
Destroy(hit.transform.gameObject);
}
}
}
}
}
using System.Collections;
public class RUBKA : MonoBehaviour {
public GameObject derevor;
public GameObject drova;
public int livederevo;
void Update()
{
if(Input.GetMouseButtonDown(1))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit,100 ))
{
if(hit.transform.gameObject == derevor)
{
Destroy(hit.transform.gameObject);
}
}
}
}
}