История изменений
Исправление abs, (текущая версия) :
Вот щас пришел к такому решению, но это мягко говоря костыль
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Factory : MonoBehaviour {
GameObject lastFoundResource;
void Start () {
InvokeRepeating("Dig", 0f, 1f);
}
void Dig() {
if (lastFoundResource) {
lastFoundResource.transform.position = transform.Find("outputPlace").position;
}
}
private void OnTriggerStay2D(Collider2D other)
{
lastFoundResource = other.gameObject;
}
}
Исходная версия abs, :
Вот щас пришел к такому решению, но это мягко говоря костыль
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Factory : MonoBehaviour {
GameObject lastFoundResource;
// Use this for initialization
void Start () {
Debug.Log("ss");
InvokeRepeating("Dig", 0f, 1f);
}
// Update is called once per frame
void Update () {
}
void Dig() {
if (lastFoundResource) {
lastFoundResource.transform.position = transform.Find("outputPlace").position;
}
}
private void OnTriggerStay2D(Collider2D other)
{
lastFoundResource = other.gameObject;
Debug.Log(other.gameObject.name);
}
}