I HAVA A PROBLEM WITH MY SCRIPT!help me fast please.

the script gave me error cs1526
this is my script:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

public float moveSpeed;
public float jumpHeight;

public Transform groundCkeck;
public float groundCheckRadius;
public LayerMask whatIsGround;
private bool grounded;

private bool doubleJump;

private Animator anim;


void Start () 
{

	anim = GetComponent<Animator> ();

}


void FixedUpdate()
{

	grounded = Physics2D.OverlapCircle (groundCkeck.position, groundCheckRadius, whatIsGround);

}

void Update () 
{

	if (grounded)
		doubleJump = false;

	anim.SetBool ("Grounded", grounded);

	if (Input.GetKeyDown (KeyCode.Space) && grounded) 
	{
		GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
	}

	if (Input.GetKeyDown (KeyCode.Space) && !doubleJump && !grounded) 
	{
		GetComponent<Rigidbody2D>().velocity = new Vector2 (GetComponent<Rigidbody2D>().velocity.x, jumpHeight);
		doubleJump = true;
	}

	if (Input.GetKey (KeyCode.D)) 
	{
		GetComponent<Rigidbody2D>().velocity = new Vector2 (moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
	}

	if (Input.GetKey (KeyCode.A)) 
	{
		GetComponent<Rigidbody2D>().velocity = new Vector2 (-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
	}

	anim.SetFloat("Speed", Mathf.Abs(GetComponent<Rigidbody2D>().velocity.x));
	
	if (GetComponent<Rigidbody2D> ().velocity.x > 0)
		transform.localScale = new Vector3(if, if, if);
		else if(GetComponent<Rigidbody2D>().velocity.x < 0)
		transform.localScale = new Vector3(-if, if, if);

}

}

1 Answer

1

i solved the problem
it was 1f not if at the end sorry guys ;(

Yes, DateTime. The first line of the description on that page states: "The Now property returns a DateTime value". And the first line of the example code shows a DateTime variable used to store that value: DateTime localDate = DateTime.Now;