Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by zak666 · Oct 16, 2015 at 04:43 AM · scripting problem

error CS0200: Property or indexer `UnityEngine.WWW.error' cannot be assigned to (it is read only)

Topened my script this morning and unity freaked out: private IEnumerator RegisterAcount(){ WWWForm Form = new WWWForm(); Form.AddField("Username", Username); Form.AddField("Pass", Pass);

         WWW RegisterAccountWWW = new WWW(RegisterURL, Form);
         yield return RegisterAccountWWW;
         if(RegisterAccountWWW.error = !null){
             Debug.Log("Cannot Connect");
         } else {
             Isloggedin.SetActive(true);
             IsNotLoggedIn.SetActive(false);
             Debug.Log("IS LOGGED IN... BITCHIES");
         }
     } // End IEnumerator.
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by NerdClown · Oct 16, 2015 at 10:00 AM

Maybe it should be like this?

 if (RegisterAccountWWW.error != null)
 {
   //...
 }


Comment
Add comment · Show 1 · 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 meat5000 ♦ · Oct 16, 2015 at 10:02 AM 0
Share

In the times when that doesnt work, just check for presence.

 if(thingToBeChecked != null)
 
 if(thingToBeChecked)
avatar image
1

Answer by Garazbolg · Oct 16, 2015 at 08:16 AM

Your trying to affect a value to a WWW.error in :

     if(RegisterAccountWWW.error = !null){

you are just missing a equal sign like this :

        if(RegisterAccountWWW.error != null){

         // or better 

         if (!string.IsNullOrEmpty(RegisterAccountWWW.error)){

'=' equal affectation (this = that; this become that)

'==' equal comparaison (this == that; is this equal to that)

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 Bonfire-Boy · Oct 16, 2015 at 08:50 AM 1
Share

Are you sure that your first alternative, if(RegisterAccountWWW.error == !null), works?

I don't think you can apply the ! operator to null.

avatar image Garazbolg Bonfire-Boy · Oct 16, 2015 at 09:21 AM 1
Share

Oh you're right.

Also I forgot error was a string, so what you should actually use is :

 if (!string.IsNullOrEmpty(RegisterAccountWWW.error)){

avatar image Bunny83 Garazbolg · Oct 16, 2015 at 11:01 AM 0
Share

Yep, IsNullOrEmpty is the best choice. However as far as i know it's usually null when no error happens, but IsNullOrEmpty is the better choice and your ready for a possible internal change of the WWW class in the future ^^.

btw: $$anonymous$$aybe edit your answer, add this example and remove the wrong one before you get a downvote? :)

Show more comments
avatar image Bonfire-Boy · Oct 22, 2015 at 08:27 AM 1
Share

For future reference, I think it's worth pointing out that the word "affectation" doesn't mean what you think it does (it actually means something more like "pretending to have a quality"). The standard word for what you mean there is "assignment".

avatar image Garazbolg Bonfire-Boy · Nov 05, 2015 at 03:20 PM 1
Share

Oh Thanks you i won't do it again, i just assumed it was like in my native language (French) where "assign a value" is "affecter une valeur", but apparently not.

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

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

(PLEASE HELP) hi guys! i have a problem with my Score text 1 Answer

My ball in pong passes through the paddles. 3 Answers

Add all objects of a type to a list before runtime 1 Answer

"There is no 'GameObject' attached to the "x" game object' 2 Answers

When pressing the space bar, the Unity editor detects it as the "O" key, how can I solve this? 2 Answers


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