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 /
  • Help Room /
avatar image
0
Question by KnightRiderGuy · Jan 02, 2016 at 06:23 PM · c#scripting problemscripting beginnercodepage

Can Someone Explain Why Message does not show Anything In Inspector

OK This is confusing enough at the bets of time but can some please explain why Message3 does not show anything in the inspector.

How the heck does Unity know the difference between the different message , message2, message3 anyways. I don't get it.

 public string message2;
     public string message3; //Not sure why this was here as it does not seem to make a difference??
     public string message4;
 
     //Button States
     bool button01State = false;
 
 
     float timePassed = 0.0f;
     // Use this for initialization
     void Start () {
         StartCoroutine(OpenConnection());
         lightSlider = GetComponent<Slider> ();
         if(slider == null) slider = GetComponent<Slider>(); // search slider in this object if its not set in unity inspector
         if(source == null) source = GetComponent<AudioSource>(); // search audiosource in this object if its not set in unity inspector
 
         }
     
     // Update is called once per frame
     void Update () {
         try
         {
             string message3 = sp.ReadLine(); //get the message...
             if(message3 == "") return; //if its empty stop right here
             print(message3);
             DirectionArrow (message3.Trim());
         }
         catch (System.Exception ex) {
             //print (ex.Message);
             return;
         }
 
         //HOW DO I GET THE TEMPERATURE DATA FROM THE SERIAL AND DISPLAY IT ON THIS UI TEXT?
         //Without is conflicting with the LDR data
         //Also HOW the heck does UNITY know to read out the LDR information as Message2?
         //when message3 (Buttons inputs) is working but not displaying anything in the inspector?
 
         TemperatureText.text = TempSensorData.ToString ();
 
 
 
             //print("BytesToRead" +sp.BytesToRead);
             message2 = sp.ReadLine();
             
         string message = sp.ReadLine(); //get the message...
         if(message == "") return; //if its empty stop right here
 
         // parse the input to a float and normalize it (range 0..1) (we could do this already in the Arduino)
         float input =  1 -  float.Parse (message) / 100f;
         // set the slider to the value
         float oldValue = slider.value;
         slider.value = input;
 
         // after the slider is updated, we can check for the other things for example play sounds:
         if (source.isPlaying) return; // if we are playing a sound stop here
 
         // else check if we need to play a sound and do it
         if (slider.value > 0.9f && oldValue <= 0.9f) // ---------this has changed
             source.PlayOneShot (BrightnessAudioClips [Random.Range (0, BrightnessAudioClips.Length)]);
 
         else if (slider.value < 0.15f && oldValue >= 0.15f) //----------this has changed
             source.PlayOneShot (DarknessAudioClips [Random.Range (0, DarknessAudioClips.Length)]);
         
 
     }
         
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

0 Replies

· Add your reply
  • Sort: 

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

56 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 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

Script not working for me 2 Answers

Accessing string from other script 1 Answer

Question about triggering an event (Extremely Novice to Programming) 1 Answer

Tetxure swap using HTC controllers 0 Answers

How can i place subjects in different positions? 0 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