Im coding a Flappy Bird game. Why I got this two message if im doing equal the tutorial? Then when I will choose the Component, doesnt apper to me the component "TapController" Message1 = Assets\scripts\TapController.cs(12,17): warning CS0108: 'TapController.rigidbody' hides inherited member 'Component.rigidbody'. Use the new keyword if hiding was intended. Message2 = Assets\scripts\TapController.cs(24,19): error CS0117: 'Input' does not contain a definition for 'getMouseButtonDown' Code: using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(Rigidbody2D))] public class TapController : MonoBehaviour { public float tapForce = 10; public float tiltSmooth = 5; public Vector3 startPos; Rigidbody2D rigidbody; Quaternion downRotation; Quaternion forwardRotation; void Start() { rigidbody = GetComponent<Rigidbody2D>(); downRotation = Quaternion.Euler(0, 0, -90); forwardRotation = Quaternion.Euler(0, 0, 35); } void Update() { if (Input.getMouseButtonDown(0)) { transform.rotation = forwardRotation; rigidbody.AddForce(Vector2.up * tapForce, ForceMode2D.Force); } transform.rotation = Quaternion.Lerp(transform.rotation, downRotation, tiltSmooth * Time.deltaTime); } void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "ScoreZone") { //register a Score Event //play a sound } if (col.gameObject.tag == "DeadZone") { rigidbody.simulated = false; //register a dead event //play a sound } } }
the first message disappeared when I changed the "rigidBody" to "RigidBody" but the second message still there
Same mistake on second error. Google is your friend, search for "Input.getMouseButtonDown" and I think you'll see it.
Please check my code.. what's wrong with it Code (CSharp): [RequireComponent(typeof(Rigidbody2D))] public class TapController : MonoBehaviour { public float tapForce = 10; public float tiltSmooth = 5; public Vector3 startPos; Rigidbody2D rigidbody; Quaternion downRotation; Quaternion forwardRotation; void Start() { rigidbody = GetComponent<Rigidbody2D>(); downRotation = Quaternion.Euler(0, 0, -90); forwardRotation = Quaternion.Euler(0, 0, 35); //rigidbody.simulated = false; } void Update() { if (Input.GetMouseButtonDown(0)) { transform.rotation = forwardRotation; rigidbody.AddForce(Vector2.up * tapForce, ForceMode2D.Force); } transform.rotation = Quaternion.Lerp(transform.rotation, downRotation, tiltSmooth * Time.deltaTime); } void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "scorezone") { //register a score event //play a sound } if (col.gameObject.tag == "deadzone") { rigidbody.simulated = false; //register a dead event //play a sound } } }