Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

how to fix error CS1525: Unexpected symbol `public' and 'private'

$
0
0
Here are the scripts: PlayerMotor: public class PlayerMotor : MonoBehaviour { private CharacterController controller; private Vector3 moveVector; private float speed = 10.0f; private float verticalVelocity = 0.0f; private float gravity = 5.0f; private float animationDuration = 2.0f; // Use this for initialization void Start () { controller = GetComponent (); } // Update is called once per frame void Update () { if (Time.time < animationDuration) { controller.Move (Vector3.forward * speed * Time.deltaTime); return; } moveVector = Vector3.zero; if (controller.isGrounded) { verticalVelocity = -0.5f; } else { verticalVelocity -= gravity * Time.deltaTime; } // X - Left and Right moveVector.x = Input.GetAxisRaw("Horizontal") * speed; // Y - Up and Down moveVector.y = verticalVelocity; // Z - Forward and Backward moveVector.z = speed; controller.Move (moveVector * Time.deltaTime); **error -->** public void SetSpeed(int modifier) { speed = 5.0f + modifier; } } Score: using UnityEngine; using System.Collections; public class Score : MonoBehaviour { private float score = 0.0f; private int difficultyLevel = 1 **ERROR --> **private int maxDifficultyLevel = 10; private int scoreToNextLevel = 10; public Text scoreText; // Update is called once per frame void Update () { if (score >= scoreToNextLevel) LevelUp (); score += Time.deltaTime * difficultyLevel; scoreText.text = ((int)score).ToString (); } void LevelUp() { if (difficulityLevel == maxDifficultyLevel) return; scoreToNextLevel *= 2; difficultyLevel++; GetComponent ().SetSpeed (difficultyLevel); } }

Viewing all articles
Browse latest Browse all 7934


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>