在unity3d5.0中 renderer后面不能使用material
需要通过GetComponent来获取组件
所以代码应该这样写:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class touch3d : MonoBehaviour {
Ray ray;
RaycastHit rayhit;
// Use this for initialization
void Start () {
}
void Update()
{
if (Input.GetMouseButtonUp(0))
{
int target = LayerMask.GetMask("target");
Debug