public void BuildPlane() { GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane); plane.layer = 11; Renderer renderer = plane.GetComponent <Renderer>(); ScaleObject(renderer, mapBmp.width, mapBmp.height); renderer.material.mainTexture = mapBmp; Transform planeT = plane.transform; planeT.localRotation = Quaternion.Euler(new Vector3(0, -180.0f, 0)); planeT.position = new Vector3(mapBmp.width / 2, 0.01f, mapBmp.height / 2); ImageRayDetector detector = plane.AddComponent <ImageRayDetector>(); detector.cam = cam; }
// Use this for initialization void Start() { instance = this; }