• 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 /
This question was closed Jul 17, 2020 at 10:53 AM by xxmariofer for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by sandeeplingubuktha000 · Jul 09, 2020 at 09:00 AM · scripting beginner

i can not see speed under player script script.,speed is not shown under player script

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class player : MonoBehaviour
 {
     
     public float speed;
     private Rigidbody2D rigidbody;
     
     void Start()
     {
         rigidbody =GetComponent<Rigidbody2D>();
     }
 
    
     void Update()
     {
         rigidbody.velocity = new Vector2(speed, rigidbody.velocity.y);
     }
 }

i used this as shown in tutorial in you tube . the tutor got the speed option to change speed .help please

Comment
Add comment · Show 5
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 xxmariofer · Jul 09, 2020 at 10:04 AM 1
Share

the script is fine the error must be something else, are you the script you are looking is the player script?

avatar image sandeeplingubuktha000 · Jul 11, 2020 at 09:26 AM 0
Share

@xxmariofer I'm looking at the player script. I got fed up and uninstalled.

avatar image kot2202 sandeeplingubuktha000 · Jul 11, 2020 at 09:34 AM 0
Share

The speed will be visible only on the gameobject with this script attached. script file won't display values in inspector on their own

Show more comments

2 Replies

  • Sort: 
avatar image
1

Answer by Tripleganger · Jul 09, 2020 at 10:05 AM

Now that you have declared a public member (public float speed), click on the object in your Scene and look at the Inspector tab. There you will find your script (remember to add your script to the gameObject if you haven't done so) and you will also find your variable "speed". If you press play and change the speed in the Inspector, it will change your character's speed too. Remember that you also need to add a Rigidbody2D component to your gameObject!

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 sandeeplingubuktha000 · Jul 10, 2020 at 01:03 PM 0
Share

I have done it already but I couldn't see it .Hoping for your reply. Thank you anyways.

avatar image Tripleganger · Jul 13, 2020 at 12:39 PM 0
Share

Sorry, I somehow missed the email to your reply. Just to make sure, the way you add a script to an object is either by dragging and dropping the script to the object in your Hierarchy, or by clicking the object, scrolling down in your Inspector until you find "Add Component", and then selecting the script you just made. If you've done this correctly, could you please:

  • Attach a screenshot of your Inspector when you click on the object, showing the script.

  • Attach a screenshot of your Inspector, showing what happens when you search for your script via Add Component.

avatar image sandeeplingubuktha000 Tripleganger · Jul 17, 2020 at 10:16 AM 0
Share

Sorry I didn't see your reply I have uninstalled and installed the editor again but still the problem is not resolved. But sorry my pc didn't support screen shot . After adding script is showing that script is added but the speed variable is not shown. Please help I started with great enthusiasm but I am stopping even before starting

avatar image
0

Answer by sandeeplingubuktha000 · Jul 17, 2020 at 10:44 AM

@everyone who replyed thank you I don't know what happened but now I can see the speed variable

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 siddharthabarua13 · Nov 12, 2021 at 04:51 PM 0
Share

can you help me with the same issue?

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Is it better to split a script into different scripts? 1 Answer

Make an object appear during play 2 Answers

Freezing Prefab or deactivating its script in another? 0 Answers

Flipping Switches 1 Answer

When you click the same image twice it see it says a match. Any thoughts on how to fix that? 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