- Home /
No completions found for float.
Good evening, if someone could help me out my C♯ is pretty horrible. I am trying to call two functions MonoBehaviour and float both of which I thought were standard but are coming up No Completions Found. My code is posted below however the following errors are coming up. 1) Unexpected token: MonoBehaviour 2) Unexpected token: { 3) Unexpected token: float 4) expecting EOF, found public.
using UnityEngine
using System.Collections;
public class Grantmove : MonoBehaviour
{
public float speed = 1.0f;
public string axisName = "Horizontal";
void Start ()
{}
void Update ():
{
Transform.position += Transform.right*Input.GetAxis(axisName)speed*Time.deltaTime;
}
}
First thing I notice is that you don't have a semicolon after using UnityEngine.. There should be a semicolon there
Another thing is that you have a colon after void Update (). That colon should go away.
Answer by robertbu · Dec 23, 2013 at 05:26 AM
using UnityEngine; // << You ere missing a ';'
using System.Collections;
public class Grantmove : MonoBehaviour
{
public float speed = 1.0f;
public string axisName = "Horizontal";
void Start ()
{}
void Update () // << Removed the ':' here
{ // Changed 'Transform' to 'transform' and V - added a '*' here
transform.position += transform.right*Input.GetAxis(axisName) * speed * Time.deltaTime;
}
}
Sorry accidentally edited out the semi col when I posted on here, I fixed the transform however the main problem is that it is not recognizing float or $$anonymous$$onobehaviour both of which baffle me.
The above script compiles on my machine. Copy and past it into a C# file on your machine. If it compiles, take a look at the comments. I indicated every change I made to get it to compile.
Thank you for your help! The problem was with Unity not recognizing classes once that was fixed code worked perfectly.