Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Dungeon · Mar 24, 2013 at 07:58 PM · minecraft

Block Placing script error

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); }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by robertbu · Mar 24, 2013 at 08:07 PM

These errors occur when characters with higher values (likely above 128) find their way into the script. You can see the offending characters in many word processors like Word, or any program that displays binary data. The fix is to delete and then retype the offending line. Often there will be several lines in a file that have that problem. To find the line, double click on the error in the Unity Console, and the line with the error will be highlighted in Mono.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dungeon · Mar 24, 2013 at 08:26 PM 0
Share

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.

avatar image Dungeon · Mar 24, 2013 at 09:18 PM 0
Share

Im sorry but nothing has happened when I retyped the code

avatar image robertbu · Mar 24, 2013 at 10:28 PM 0
Share

Here is a cleaned up copy of the code:

 var range : float = $$anonymous$$athf.Infinity;
 var hit : RaycastHit;
 var BlockTexture : Texture;
 
 function Update() { 
     if(Input.Get$$anonymous$$ouseButtonDown(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);
 }
avatar image Dungeon · Mar 24, 2013 at 10:54 PM 0
Share

Oh yes! Thank you so much. Can you explain what you did? if not, that's alright. Thank you!

avatar image robertbu · Mar 25, 2013 at 12:24 AM 0
Share

I did just as I indicated to you in my answer. I loaded the script above into $$anonymous$$ono, 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.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

UV mapping 5 Answers

Realistic block placing/building 1 Answer

Blocky terrain optimization 1 Answer

[Script] place block(prefab) align to grid like minecraft? 4 Answers

This script does not work propely in my game 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges