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 /
This question was closed Dec 08, 2019 at 12:09 AM by pro-costa for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by pro-costa · Nov 01, 2017 at 10:53 PM · movementuser interfacetranform.position

object won't move with script or when I change the values in the inspector during play mode

Script was working for a while but I did things and then it stopped working. The object is not static. It doesn't show the values changing in the inspector Also it doesn't move when I change the values. Help Also I have tried other movement scripts, still won't move the player.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine.Networking;
 using UnityEngine;
 
 public class Move : NetworkBehaviour {
     public float speed = 1;
     // Use this for initialization
     void Start () {
         
     }
     
     // Update is called once per frame
     void Update () {
          if(!isLocalPlayer){
             return;
         }
         //Move Up
         if(Input.GetKey(KeyCode.W)){
             Debug.Log("moving");
             transform.Translate(0,speed*Time.deltaTime,0);
         }
         //Move Down
         if(Input.GetKey(KeyCode.S)){
             Debug.Log("moving");
             transform.Translate(0,-speed*Time.deltaTime,0);
         }
         //Move Left
         if(Input.GetKey(KeyCode.A)){
             Debug.Log("moving");
             transform.Translate(-speed*Time.deltaTime,0,0);
         }
         //Move Right
         if(Input.GetKey(KeyCode.D)){
             Debug.Log("moving");
             transform.Translate(speed*Time.deltaTime,0,0);
         }
 
     }
 }
 

Thank you!

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

  • Sort: 
avatar image
0

Answer by FallingRocketGames · Nov 01, 2017 at 11:01 PM

I believe you need to change the if to else if in the next statements, second I don't know much of the code you're trying to make but seems to be for an online player for which I don't see any instruction.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/if-else there's a guide to the if statement in c#

             if(!isLocalPlayer){
                 return;
              } else {//INSTRUCTIONS FOR LOCAL PLAYER}

Also check if the script is attached to any of your game objects

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 pro-costa · Nov 01, 2017 at 11:13 PM 0
Share

I'm pretty(not 100%) sure that it shouldn't matter if i said else or if because if its not the local player it would get out of update and return. Also changing it to else didn't help:(

avatar image
0

Answer by pro-costa · Nov 01, 2017 at 11:22 PM

I figured it out I had a network identity on a child object, and i'm pretty sure deleting it solved it. IDK why but its fixed so I can sleep now

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

Follow this Question

Answers Answers and Comments

105 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

Related Questions

How to zero out horizontal value instantly? 2 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Mobile Application Controls 0 Answers

Making a bubble level (not a game but work tool) 1 Answer

Can't change direction mid-jump 1 Answer


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