I have the flowing behavior scrip that i made, but am unable to add it to my sprite. can someone please tell me why? using UnityEngine; using System.Collections; public class newBehaviourScript1 : MonoBehaviour { public float movemnetSpeed1 = 5.0f; private int jumpHeight1 = 500; void start(){ } void update (){ if (Input.GetKey ("left") || Input.GetKey ("a")) { transform.position -= Vector3.right * movemnetSpeed1 * Time.deltaTime; transform.eulerAngles = new Vector2(0, 180); } if (Input.GetKey ("right") || Input.GetKey ("d")) { transform.position += Vector3.right * movemnetSpeed1 * Time.deltaTime; transform.eulerAngles = new Vector2(0, 0); } if (Input.GetButtonDown ("jump") || Input.GetKey ("w")) { jump(); } } void jump(){ rigidbody2D.AddForce(new Vector3.up(0, jumpHeight1), ForceMode2D.Force); } } the sprite has a rigidbody 2d enabled,and it is not kinematic. As well as a 2D box collider By the way, I am very new to unity, and c# in general so if you could make your answer as simple as possible I would appreciate it greatly
When you say you can't add it to the sprite, what exactly do you mean? What error are you getting? Add the script to the sprite by selecting the sprite, clicking "Add Component", and navigating to your script. Once you choose the script, it should be attached to your sprite.
Also, please refer to this link for information on using code tags: http://forum.unity3d.com/threads/using-code-tags-properly.143875/ Thanks!