- Home /
Roll-A-Ball Tutorial public float speed
I am following the Roll-A-Ball tutorial, but the tutorials are outdated, being made for Unity 4.
After a massive amount of stress surrounding the rigidbody addforce, unity fixed the problem for me.
Now the tutorial is telling me add a speed factor (public float speed), but after returning to editor, there is no place to enter a speed value.
All Help appreciated.
Thanks
Setho246
Update
Here is my code:
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);
GetComponent<Rigidbody>().AddForce(movement * speed * Time.deltaTime);
}
}
I also get the error in line 8 of:
PlayerController.cs(12,12): Error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration (CS1519) (Assembly-CSharp)
Update 2
Thanks to LeftRight92 who pointed out the missing semicolon after public float speed.
New problem:
still don't have any driving force behind my ball, even after entering a value in the script 'speed' box
After entering any value, press play, but get no response.
As before, any help is great
Thanks Setho246
Answer by LeftRight92 · Mar 15, 2015 at 11:29 PM
You missed your semicolon at the end of public float speed
Thanks LeftRight92, this solved one problem, but I still have no driving force behind my object.
After entering any value, press play, but get no response.
As before any help is great
Thanks Setho246
Your answer
Follow this Question
Related Questions
my ball wont collect(rollaball) 2 Answers
Roll a Ball Tutorial does not work. Help? 3 Answers
New Script Assemblies not generating 0 Answers
How to create AI using RAIN indie 1 Answer
rollaball ball wont move 2 Answers