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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by ByteVault · Mar 20, 2014 at 06:50 PM · variablegetcomponentnullwwwform

Use variable from another script with WWW give NULL?

Hi, I'm trying to use a variable from another script attached to "Main Camera". I do get the variable to output correctly on Debug.Log and GUI.Label but I can't get it to work with WWW...

EDIT NOTE: At this point I have already successfully logged in with the Wusername. I'm trying to query another DB with a already successfully used variable.

 public string Wusername;
 
 Wusername = GameObject.Find("Main Camera").GetComponent<login>().userNameGet;
 
                 WWWForm form = new WWWForm();
                 form.AddField(Wusername, Wusername);
                 form.AddField("securityKeyGetCharInfo", securityKeyGetCharInfo);
                 WWW GetCharacterAPI = new WWW(secureKeyGetCharInfoURL, form);
                 StartCoroutine(GetCharacter(GetCharacterAPI));


The web page is receiving Wusername as null. What could I do to fix this?

I want this to be able to work without having to type it in a textfield again. If it can't be done I'd like to know another way to do this.

Thanks in advance for your time and help! :)

Comment
Add comment · Show 1
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 JChilton · Mar 21, 2014 at 05:09 PM 1
Share

do you mean on line 6 for it to be

 form.AddField("username", Wusername);

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer Wiki

Answer by ByteVault · Mar 21, 2014 at 05:24 PM

A slight typo. With a fresh mind which had gotten It's sleep found the problem to be the missing quotes.

form.AddField("Wusername", Wusername);

This works as intended now and I will keep fixing. Thanks JChilton, sorry I missed it!

Comment
Add comment · Show 2 · 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 JChilton · Mar 21, 2014 at 05:29 PM 0
Share

:c thanks for acknowledging me 20 $$anonymous$$utes ago lol

avatar image ByteVault · Mar 21, 2014 at 08:10 PM 0
Share

Oh, really.. Sorry dude. I never got the mail saying someone commented! Sure, you were right though. Thanks for the help!

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

21 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

Related Questions

How could you access a script of varying name? 5 Answers

Get variable from another object 1 Answer

How can i make GetComponent(SCRIPT) apply to ONLY ONE object that has the script? 1 Answer

Can't understand generic getComponent for Js 1 Answer

Changing variables in another script 3 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