Search Unity

Please help urgent. This script not working.

Discussion in 'Scripting' started by Gameatro, Sep 15, 2017.

  1. Gameatro

    Gameatro

    Joined:
    Sep 15, 2017
    Posts:
    9
    I just started using unity and am doing the space shooter tutorial. that one is for older and i use 7.1. so for moving object, i created scripts with new method. but its not working. pls tell whats wrong?

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class PlayerController : MonoBehaviour{
    public float speed;
    private Rigidbody rb;
    void start()
    {
    rb = GetComponent<Rigidbody> ();
    }
    void FixedUpdate()
    {
    float moveHorizontal = Input.GetAxis ("Horizontal");
    float moveVertical = Input.GetAxis ("Vertical");
    Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
    rb.velocity = movement*speed;

    }
    }
     
  2. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    So a couple things:
    - Use code tags to format code
    - "not working" is not a sufficient explanation of the issue
    - putting "urgent" in your title won't make people respond faster


    To your issue - you have start() and it should be Start()
     
    Ryiah, JoeStrout and RoMax92 like this.