I have found this script online and I saw it being used in a video working fine. I am trying to make a minecraft parody.
when i tried to use it, Assets/Place Script.js(15,52): BCE0044: unexpected char: 0xAD.
please help.
var range : float = Mathf.Infinity;
var hit : RaycastHit;
var BlockTexture : Texture;
function Update()
{
if(Input.GetMouseButtonDown(1)){
Build();
}
}
function Build()
{
if(HitBlock()){
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.renderer.material.mainTexture = BlockTexture;
cube.transform.position = hit.transform.position + hit.normal;
}
}
function HitBlock() : boolean
{
return Physics.Raycast(transform.position, transform.forward, hit, range);
}
wait, my line was line was 15. I just delete it and retype it? it is just that I just did and nothing happened. please help.
– DungeonIm sorry but nothing has happened when I retyped the code
– DungeonOh yes! Thank you so much. Can you explain what you did? if not, that's alright. Thank you!
– DungeonI did just as I indicated to you in my answer. I loaded the script above into Mono, in Unity I got the error. I double clicked on the error to take me to that line. I opened up a new line. I typed in an exact duplicate of the line. I deleted the original line. If this answered your question, click the check mark next to the answer.
– robertbu