Are there any problems with my script? The console is telling error, but I can't find any.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour
{
public float speed;
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.velocity = movement * speed;
}
}
ERROR GUI WINDOW TRIES RENDERING WHILE O$$anonymous$$ETHING ELSE HAS NOT FINISHED RENDERING ! EITHER YOY HAV A RECURSIVE ONGOING RENDERING OR PREVIOUS ONGUI DIDNOT CLEAN UP PROPERLY
despite showing the error (not related to your code), do you have a concrete problem?
Answer by I_WANT_2_B_A_GAMEMAKER · Aug 30, 2015 at 07:38 AM
This code is for moving my player. but he is not moving. @hexagonius
your rigidbody might be kinematic, in which case it won't move. or speed is 0. debug each change to movement to see where that's zero in the latter case
Your answer
Follow this Question
Related Questions
Player floating away upon start 0 Answers
How to write a script for an existing button 1 Answer
Controller / movement script rotate while moving HELP 0 Answers
Combining Track and Zoom scripts for Mobile 0 Answers
Finding the max Y position value in a list of game objects and assigning it to a variable? 0 Answers