Skip to content

Instantly share code, notes, and snippets.

@davepape
Created September 20, 2018 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davepape/74f8e9a528306ade494c3e9d6d033681 to your computer and use it in GitHub Desktop.
Save davepape/74f8e9a528306ade494c3e9d6d033681 to your computer and use it in GitHub Desktop.
// Unity3d example of using Find() and GetComponent() to control one script from another script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class mcp : MonoBehaviour {
void Start () {
}
void Update () {
GameObject thecube = GameObject.Find("Cube");
circle1 circlescript = thecube.GetComponent<circle1>();
circlescript.speed -= Time.deltaTime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment