Skip to content

Instantly share code, notes, and snippets.

@komagata
Last active December 20, 2017 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save komagata/7658fc820f6e2f68775ee71dec7f0170 to your computer and use it in GitHub Desktop.
Save komagata/7658fc820f6e2f68775ee71dec7f0170 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Mole : MonoBehaviour {
public GameObject prefab;
GameObject instance;
void Start () {
this.instance = Instantiate (prefab) as GameObject;
}
void Update () {
this.instance.transform.Translate (0, 0.08f, 0);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoleGenerator : MonoBehaviour {
Mole mole1;
Mole mole2;
Mole mole3;
void Start () {
this.mole1 = GetComponent<Mole>() as Mole;
mole1.transform.position = new Vector3 (-6.02f, -3.51f, 0);
this.mole2 = GetComponent<Mole>() as Mole;
mole2.transform.position = new Vector3 (0.2f, -4.31f, 0);
this.mole3 = GetComponent<Mole>() as Mole;
mole3.transform.position = new Vector3 (6.13f, -2.16f, 0);
}
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment