- Home /
This question was
closed Mar 02, 2014 at 09:51 PM by
Fattie for the following reason:
Duplicate Question
Question by
ZoomStar · Mar 02, 2014 at 09:23 PM ·
javascriptcharactercontrollervariable
JavaScript controll var in C#
Hi, now i have a big problem with my code :( so...
i have two scripts, in Java script and C#
but what i want to do here is that ...
JavaScript
function Update () {
scoreText.text = "" + score;
// Level 1
if(score > 20) {
Xscore = 3;
cadere.speed = 11;
}
CSharp Code:
using UnityEngine;
using System.Collections;
public class spawn : MonoBehaviour
{
public GameObject[] hazards;
public Vector3 spawnValues;
public int hazardCount;
public float spawnWait;
public float startWait;
public float waveWait;
void Start ()
{
StartCoroutine (SpawnWaves ());
}
IEnumerator SpawnWaves ()
{
yield return new WaitForSeconds (startWait);
while (true)
{
for (int i = 0; i < hazardCount; i++)
{
GameObject hazard = hazards [Random.Range (0, hazards.Length)];
Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
Quaternion spawnRotation = Quaternion.identity;
Instantiate (hazard, spawnPosition, spawnRotation);
yield return new WaitForSeconds (spawnWait);
}
yield return new WaitForSeconds (waveWait);
}
}
}
ok now, in JS script i have an "if" witch increase the speed of the game but...i want to change in same time with this "if" in CSharp var named "spawnWait"
Sorry for my bad en..
Comment
search on 100s of questions "call javascript from c#" cheers
Follow this Question
Related Questions
Need to use 2 different language scripts. 1 Answer
Static Variable Problem 1 Answer
Access a JavaScript variable from a C# script? 2 Answers
Change GUI Value with Variable 1 Answer
Problem with jumping, total noob. 0 Answers