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 AmbitiousSerif · Jun 18, 2013 at 04:46 AM · c#error message

what does it mean when something does not exist in the current context mean

I am getting the error message of adjustcurrenthealth does not exist in this instance here is the code if needed

             using System.Collections;
 
          
         public class health : MonoBehaviour {
                public GUIStyle PlayercurhealthplaceH;
             public GUIStyle Playercurhealthtext;
                public int MaxHealth = 320;
             public int CurHealth = 320;
             public float HealthBarLength;
          
      
            void start(){
      
         HealthBarLength = 200; 
      
         }
      
         void OnGUI(){
     
      
         
                 GUI.Box(new Rect((Screen.width /2) -339,(Screen.height /2) +300,200,20),"", PlayercurhealthplaceH);  
         
            GUI.Box(new Rect((Screen.width /2) -339,(Screen.height /2) +300,200/(MaxHealth/CurHealth),20), CurHealth + "/" + MaxHealth, Playercurhealthtext);
      
         }
      
            public void AdjustCurrentHealth(int Adj){
      
            CurHealth += Adj;
      
                if (CurHealth <0)
                  CurHealth = 0;
            if(CurHealth > MaxHealth)
              CurHealth = MaxHealth;
            if(MaxHealth < 1)
              MaxHealth = 1;
      
            HealthBarLength = (200) * (CurHealth/(float)MaxHealth);
      
      
      
      
         }
      
      
         public void update() {
         adjustcurrenthealth(0);
     }
 }
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

Answer by robertbu · Jun 18, 2013 at 04:47 AM

C# (and Javascript) is case sensitive. So your call on line 48 to 'adjustcurrenthealth()', is not the same as the function 'AdjustCurrentHealth()' on line 28.

Comment
Add comment · Show 3 · 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 Bunny83 · Jun 18, 2013 at 05:30 AM 0
Share

In addition update in not the same as Update

avatar image robertbu · Jun 18, 2013 at 06:09 AM 0
Share

And it should be 'Start()' not 'start()'.

avatar image Bunny83 · Jun 18, 2013 at 06:21 AM 0
Share

x) missed that one since it's indented in a strange way. In short the OP should work on his program$$anonymous$$g style / discipline.

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

15 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to handle inactive object updates 0 Answers

Error opening project.,Error opening project 0 Answers

i have some code for Faux Gravity that doesn't work as intended. 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