Quantcast
Channel: Questions in topic: "class instance"
Viewing all articles
Browse latest Browse all 131

In the second script "InputManger" should be glowing but it is not. Why is this?,Why cant it find my class from another script

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; public class InputManager : MonoBehaviour { // Start is called before the first frame update public float throttle; public float steer; // Update is called once per frame void Update() { throttle = Input.GetAxis("Vertical"); steer = Input.GetAxis("Horizontal"); } } using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(InputManager))] public class CarController : MonoBehaviour { public InputManager im; public List throttlewheels; public List steeringwheels; public float force = 20000f; void Start() { im = GetComponent(); } void FixedUpdate() { foreach (WheelCollider wheel in throttlewheels) ; { wheel.motorTorque = force * Time.deltaTime * im.throttle; } foreach (WheelCollider Wheel in steeringwheels) ; wheel.steerAngle = maxTurn * im.steer; } } ,

Viewing all articles
Browse latest Browse all 131

Trending Articles



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