Question by
Dhanu0922 · Sep 26, 2017 at 12:49 PM ·
missing-reference
UnityEngine.Component' does not contain a definition for `main' and no extension method `main' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?
how can i correct this? I'm trying to build a VR maze game. This is my code.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class controller : MonoBehaviour {
private bool walking = false;
private Vector3 spawnPoint;
// Use this for initialization
void Start () {
spawnPoint = transform.position;
}
// Update is called once per frame
void Update () {
if (walking) {
transform.position = transform.position + camera.main.transform.forward * .5f * Time.deltaTime;
}
if (transform.position.y < -10f) {
transform.position - spawnPoint;
}
Ray ray = Camera.main.viewportPointToRay (new Vector3(.5f,.5f,0));
RaycastHit hit;
if (Physics.Raycast (ray, out hit)) {
if (hit.collider.nameContains ("plane")) {
walking = false;
} else {
walking = true;
}
}
}
} ,
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612135652im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Disable Gizmo objects. Rig and Rig Builder weird icons in scene 1 Answer
Mising(GameObject) not firing in if statement 0 Answers
Missing Prefabs, Avatars, Meshes 0 Answers
I want to check if variable is missing(not null),Can't check if object has missing variable 0 Answers
References missing after stop hosting through NetworkLobbyManager. Bug? 1 Answer