How To Connect 2 Scripts So You Can Communicate The Variables??
That's my code
using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.SceneManagement;
public class MovePlayer : MonoBehaviour { [SerializeField] Text text; [SerializeField] Text WinT; [SerializeField] AudioClip[] soundfx; public float speed = 12f; float CXMin ; float CXMax ; float CYMin ; float CYMax ; public float Health1 = 100; bool IsALive = true; bool EndMatch = false; // Use this for initialization void Start () {
 }
 
 // Update is called once per frame
 void Update () {
     
     text.text = Health1.ToString();
     MoveBoundaries();
     if (EndMatch == false)
     {
         Move();
     }
 }
 private void OnCollisionEnter2D(Collision2D collision)
 {
     Health1--;
 }
 private void MoveBoundaries()
 {
     Camera gamecamera = Camera.main;
         CXMin = gamecamera.ViewportToWorldPoint(new Vector3(0.5f, 0, 0)).x + 1;
     CXMax = gamecamera.ViewportToWorldPoint(new Vector3(1, 0, 0)).x - 1;
     CYMin = gamecamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).y + 1;
     CYMax = gamecamera.ViewportToWorldPoint(new Vector3(0, 1, 0)).y - 1;
 }
 private void Move()
 {
     var deltaXMove = Input.GetAxis("Horizontal") * Time.deltaTime*speed;
     var deltaYMove = Input.GetAxis("Vertical") * Time.deltaTime*speed;
     var XMove = Mathf.Clamp(transform.position.x + deltaXMove , CXMin , CXMax);
     var YMove = Mathf.Clamp(transform.position.y + deltaYMove , CYMin , CYMax);
     transform.position = new Vector2(XMove, YMove);
 }
 private void WinScreen()
 {
     if (Health1 <= 0)
     {
         IsALive = false;
     }
     if (IsALive == false)
     {
         WinT.text = "Left Side Wins";
         EndMatch = true;
         Invoke("Restart", 1f);
     }
 }
 private void Restart()
 {
     SceneManager.LoadScene("Game");
 }
}
That's My Second One
using UnityEngine; using System.Collections;
public class Speedup : MonoBehaviour { // Use this for initialization void Start () {
 }
 
 // Update is called once per frame
 void Update () {
 
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.name == "Butta" || collision.gameObject.name == "Shoota")
     {
                 }
 }
} I want to change The value of the float Speed On Trigger Enter, But I Can't seem To Do It. Anyone Knows About It ??
Your answer
 
 
             Follow this Question
Related Questions
Health pickup script issue -1 Answers
Get value from another script 1 Answer
Script error and no Variables showing 0 Answers
script help 1 Answer
pick up object problem 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                