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 Ahmed the gamer · Feb 08, 2016 at 09:18 PM · movementanimation script

How do I get rid of these scripting Errors?

the error says: Assets/NewBehaviourScript.cs(26,22): warning CS0219: The variable v' is assigned but its value is never used Assets/NewBehaviourScript.cs(26,22): warning CS0219: The variable h' is assigned but its value is never used

 using UnityEngine;
 using System.Collections;
 
 public class NewBehaviourScript : MonoBehaviour {
     public float backspeed = 3f;
     public float movespeed = 10f;
     public float turnspeed = 100f;
     public float fallspeed = 100f;
 
     void Update () {
         if (Input.GetKey (KeyCode.UpArrow))
             transform.Translate (Vector3.forward * Time.deltaTime * movespeed);
         if (Input.GetKey (KeyCode.DownArrow))
             transform.Translate (-Vector3.forward * Time.deltaTime * movespeed);
         if (Input.GetKey (KeyCode.RightArrow))
             transform.Rotate (Vector3.up * Time.deltaTime * turnspeed);
         if (Input.GetKey (KeyCode.LeftArrow))
             transform.Rotate (Vector3.up * Time.deltaTime * -turnspeed);
         if (Input.GetKeyDown (KeyCode.Space))
             transform.Translate (Vector3.up * Time.deltaTime * fallspeed);
     }
     void start(){
         bool h=Input.GetKey (KeyCode.UpArrow);
         bool v=Input.GetKey (KeyCode.DownArrow);
     }
     void Animating (bool h,bool v)
         {
             // Create a boolean that is true if either of the input axes is non-zero.
         bool walking = h = false;  
         v = false;
 
             // Tell the animator whether or not the player is walking.
         GetComponent<Animator>().SetBool ("IsWalking", walking);
         }
     }
 
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 allenallenallen · Feb 08, 2016 at 09:24 PM

Those are warnings, not errors. Errors will stop the game from running correctly. Warnings are usually harmless. These two warnings are simply saying that you declared the booleans h and v but you never really used them anywhere.

That said, there are many other actual errors in your code that you didn't provide in your list of errors/warnings. One is an actual error and the others are more like the theories and logic behind the codes.

Line 29 is an error. You should only assign one variable at a time.

What you typed inside Start() are meaningless if you set the booleans to the Up or Down arrow keys ONLY in that specific instant when Start() runs.

Comment
Add comment · 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
0

Answer by Jessespike · Feb 08, 2016 at 09:26 PM

That's not an error, it's a warning.

It's just saying you created a variable and it's not being used anywhere. Look at the start() function, it's not actually doing anything.

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

how to randomly move each generated clone? 0 Answers

Spawned enemy walk from right to left destroying turrets. 0 Answers

FPSController does not work in Universal 10 0 Answers

I am very new to c# and all this. I am an absolute beginner and i am stuck at this very simple code. Please help me on how do i increase the speed of the object and how do i get it to jump on pressing spacebar? 0 Answers

can't rotate character in unity 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