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 Draghou · Apr 01, 2013 at 07:37 PM · parsing errorimage loader

Parsing error cs8025

 private void LoadImages()
 
 string pathPrefix = @"file://";
 string pathImageAssets = @"C:\Assets\Pictures\";
 string pathSmall = @"small\";
 string filename = @"1";
 string fileSuffix = @".jpg";
 
 for (int=0; i<2; i++);
 {
 string indexSuffix = "";
 float logIdx = Mathf.Log10(i+1);
 if (ligIdx < 1.0)
 indexSuffix += "00";
 else if (logIdx < 2.0)
 indexSuffix += "0";
 indexSuffix += (i+1);
 
 string fullFilename = pathPrefic +pathImageAssets + pathSmall + filename
 WWW www = new WWW(fullFilename)
 Texture2D texTmp = new Texture2D(320, 320, TextureFormat.DXT1, false)
 www.LoadImageIntoTexture(texTmp);
 
 imageBuffer.Add(texTmp);
 }

It says there's a parsing error at (3,6) I want to cleare it to test if it works. And I don't want to load into a texture, rather to a spec. place on the screen, how shall I rewrite? It's enough to answer just my first question, I will find out the rest :) But your help would be appreciated.

Comment
Add comment · Show 3
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 fafase · Apr 01, 2013 at 07:39 PM 0
Share

You seem to be missing the { after the method declaration. Is it just missing here or also on your script? EDIT: you are missing a looooot of things there...ok here it how it should go without considering it makes any actual sense or not, just syntax:

 private void LoadImages(){  
     string pathPrefix = @"file://";
     string pathImageAssets = @"C:\Assets\Pictures\";
     string pathSmall = @"small\";
     string filename = @"1";
     string fileSuffix = @".jpg";
  
     for (int=0; i<2; i++);{
         string indexSuffix = "";
         float logIdx = $$anonymous$$athf.Log10(i+1);
         if (ligIdx < 1.0)
             indexSuffix += "00";
         else if (logIdx < 2.0){
             indexSuffix += "0";
             indexSuffix += (i+1); // I reckon they go together
         }
    }// I also reckin you stop the loop here (?)
    string fullFilename = pathPrefic +pathImageAssets + pathSmall + filename;
    WWW www = new WWW(fullFilename);
    Texture2D texTmp = new Texture2D(320, 320, TextureFormat.DXT1, false);
    www.LoadImageIntoTexture(texTmp);
  
    imageBuffer.Add(texTmp);
 }
avatar image Draghou · Apr 01, 2013 at 07:50 PM 0
Share

I tried to write that a lot of places. Where do you exactly think I should write it?

avatar image Draghou · Apr 01, 2013 at 08:01 PM 0
Share

Yeah, thanks :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Yokimato · Apr 01, 2013 at 07:51 PM

CS8025 is a parsing error, meaning that your syntax is incorrect. This can always be equated to a mistake when writing the code (as opposed to a runtime error). In you're case, you're missing some curly braces. Here is Fixed code:

 private void LoadImages()
 { // <-------------------------Missing Curly
 string pathPrefix = @"file://";
 string pathImageAssets = @"C:\Assets\Pictures\";
 string pathSmall = @"small\";
 string filename = @"1";
 string fileSuffix = @".jpg";
  
 for (int=0; i<2; i++);
 {
 string indexSuffix = "";
 float logIdx = Mathf.Log10(i+1);
 if (ligIdx < 1.0)
 { //<--------------------missing curly (though, optional)
 indexSuffix += "00";
 } //<--------------------missing curly
 else if (logIdx < 2.0)
 { //<--------------------missing curly
 indexSuffix += "0";
 indexSuffix += (i+1);
 } //<--------------------missing curly
 } //<--------------------missing curly (ends for loop)
 string fullFilename = pathPrefic +pathImageAssets + pathSmall + filename
 WWW www = new WWW(fullFilename)
 Texture2D texTmp = new Texture2D(320, 320, TextureFormat.DXT1, false)
 www.LoadImageIntoTexture(texTmp);
  
 imageBuffer.Add(texTmp);
 }

My suggestion is to format your code better using indentation on scope changes so that you can easily spot these errors.

i.e:

 private void LoadImages()
 { // <-------------------------Missing Curly
     string pathPrefix = @"file://";
     string pathImageAssets = @"C:\Assets\Pictures\";
     string pathSmall = @"small\";
     string filename = @"1";
     string fileSuffix = @".jpg";
 
     for (int=0; i<2; i++);
     {
         string indexSuffix = "";
         float logIdx = Mathf.Log10(i+1);
 
         if (ligIdx < 1.0)
         { //<--------------------missing curly (though, optional)
             indexSuffix += "00";
         } //<--------------------missing curly
         else if (logIdx < 2.0)
         { //<--------------------missing curly
             indexSuffix += "0";
             indexSuffix += (i+1);
         } //<--------------------missing curly
     } //<--------------------missing curly (ends for loop)
 
     string fullFilename = pathPrefic +pathImageAssets + pathSmall + filename
     WWW www = new WWW(fullFilename)
     Texture2D texTmp = new Texture2D(320, 320, TextureFormat.DXT1, false)
     www.LoadImageIntoTexture(texTmp);
 
     imageBuffer.Add(texTmp);
 }
Comment
Add comment · Show 6 · 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 Draghou · Apr 01, 2013 at 08:05 PM 0
Share

Now I get the following errors: Parsing erroe (2,1) but I think that { should be there. (1,14) CS0116: A namespace can only contain types and namespace declarations - This error hadn't showed up. Sometimes it does when I change something but I don't see the problem there. Or the problem is somewhere in the script?

avatar image fafase · Apr 01, 2013 at 09:56 PM 0
Share

It is nice you turn my short comment as a long answer but make sure you pick the whole thing up.

You forgot the ; after the two lines:

 string fullFilename = pathPrefic +pathImageAssets + pathSmall + filename
 WWW www = new WWW(fullFilename)
avatar image fafase · Apr 01, 2013 at 10:02 PM 0
Share

Concerning your namespace error, you would not have removed the class declaration by any chance?

avatar image Draghou · Apr 01, 2013 at 10:36 PM 0
Share

;-s are there but still get the (2,1) parsing error

Code hasn't been touched expect the curles so it's the same by functionality. I will gnaw it through or write an other script later but I am a bit tired right now. Any idea please let me know.

avatar image fafase · Apr 01, 2013 at 10:49 PM 0
Share

Just to make sure you have a .cs script and it starts with a few using UnityEngine; and using System.Collection; or other usings of the type and then you get public class ClassName:$$anonymous$$onoBehaviour{} and inside of this you have your method.

Show more comments

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

12 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 avatar image avatar image

Related Questions

Draw using android openGL? 1 Answer

someone please help with my C# parsing error 2 Answers

What parsing errors do i have 1 Answer

Image appear on click 0 Answers

How to fix "there is a problem parsing the package"? 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