here is my code
using UnityEngine;
using System.Collections;
public class _destroyBust : MonoBehaviour {
private GameObject temp;
private string name;
public GameObject bustPrefab;
void OnTriggerEnter(Collider other) {
name=other.gameObject.tag;
Debug.Log(name);
temp= GameObject.FindGameObjectWithTag(name);
//Destroy(temp,3);
Instantiate(bustPrefab,new Vector3(temp.transform.position.x,temp.transform.position.y,temp.transform.position.z),temp.transform.rotation) ;
Destroy(temp);
}
}
using UnityEngine;
using System.Collections;
public class _optionMovement : MonoBehaviour {
public GameObject _bubbleThree;
public static float speedY;
public static float speedX;
void Start () {
speedY=100f;
speedX=150f;
_bubbleOne.rigidbody.velocity = new Vector3(0,2.5f, 0);
_bubbleThree.rigidbody.velocity = new Vector3(0,2.5f, 0);
}
void update()
{
int[] dir=new int[]{-2,2,-2,2};
int ran=Random.Range(0,dir.Length);
_bubbleThree.rigidbody.AddForce(speedX*Time.deltaTime*dir[ran],-(speedY+50f)*Time.deltaTime*dir[ran], 0);}
}
}
I just want to change the value of speedY and speedX of _optionMovement.cs script from _destroyBust.cs script when trigger happened but I don’t know how to do it.please help me out