Hello!
( Sorry for the bad english in this entire text )
I have a plane ( water ) that raises by time.
This is the script for the raising water:
using UnityEngine;
using System.Collections;
public class WaterRise : MonoBehaviour {
public Vector3 raisespeed = new Vector3(0,5.0f,0);
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
// WaitForSeconds(5);
transform.Translate(raisespeed * Time.deltaTime);
}
}
This is the WaterRise script. And it works. Now i have an other script, the MainMenu script. These are all written in c#. So, i have a toggleabble ‘‘radio button’’ in the MainMenu script. I want to increase the value of ‘‘raisespeed’’ ( so the plane moves faster ). How can i do this? I can’t figure out how to change the values of a script with other script. I want to change the Vector3(0,5.0f,0)
This is the script for the MainMenu ( i know its not actually a main menu ):
using UnityEngine;
using System.Collections;
public class MainMenu : MonoBehaviour {
private bool fastmode = false;
void OnGUI () {
fastmode = GUI.Toggle (new Rect (25, 25, 100, 30), fastmode, "Fast mode");
}
void Update () {
if (fastmode == true) {
WaterRise = GetComponent("WaterRise") as WaterRise;
WaterRise.do public Vector3 speed = new Vector3(0,5.0f,0);
}
}
}
This code is a totally fail now.
Thanks for helping!