using UnityEngine; public class Example :MonoBehaviour{Rigidbodym_Rigidbody; public float m_Thrust = 20f; void Start() { //Fetch theRigidbodyfrom theGameObjectwith this script attached m_Rigidbody = GetComponent<Rigidbody>(); } voidFixedUpdate() { if (Input.GetButton("Jump")) { //Apply ...
using UnityEngine; using System.Collections; public class Example :MonoBehaviour{ publicTexture2Dtex; privateRigidbody2Drb2D; privateSpritemySprite; privateSpriteRenderersr; private float thrust = 1f; void Awake() { sr = gameObject.AddComponent<SpriteRenderer>(); rb2D = gameObject.AddComponent<Rigid...