C# coding problems

Here is a link to my TUT http://www.youtube.com/watch?v=WyjAKGqMwkM&feature=c4-overview&list=UUZ5ZqniO2wvv3Z7Jnm2G-yQ
@second 20 he puts the Prefab into the script, but I don’t have two scripts to put stuff in. I can’t put the Grass prefab into the building script. He puts it in the bottom right of the screen and adds his Prefab to his script, but I can’t, I don’t have the option he has. I think he is using Unity 3.5, but I’m using the latest version.

Here is my code

using UnityEngine;
using System.Collections;

public class BuildScript : MonoBehaviour {

RaycastHit hit;

public Transform prefab;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

Ray ray = camera.ViewportPointToRay (new Vector3 (0.5F, 0.5F, 0));

if(Physics.Raycast(ray, out hit)){

if(Input.GetMouseButtonDown(0)){
Destroy(hit.collider.gameObject);
print(“You Removed The Block :)<3”);

}

}

}
}

Please help someone!

Please use code tags. It helps a lot to make scripts more readable in the forum:
http://forum.unity3d.com/threads/143875-Using-code-tags-properly

You should clearly have that one as well. But it is not directly in the script. It is in a game object that contains the script. I am pretty sure we can guide you if you post a screenshot.

Here you go!!

This is where he is dragging the Prefab into the Script.

You may try to right click on the actual script and select “Reimport”. If that doesn’t help, make sure your actual script contains the prefab declaration line in this project.