Код: Выделить всё
using UnityEngine;
using System.Collections;
public class MoveObject : MonoBehaviour
{
public GameObject[] objectsToMove;
public Vector3 targetPosition;
public Vector3 targetRotation;
public GameObject RaceScripts;
public GameObject RaceCampaign;
public GameObject Race;
public GameObject RCCCanvas;
public void MoveAndRotate()
{
foreach (GameObject obj in objectsToMove)
{
obj.transform.position = targetPosition;
obj.transform.rotation = Quaternion.Euler(targetRotation);
}
StartCoroutine(ActivateRaceComponentsWithDelay(0.1f));
}
private IEnumerator ActivateRaceComponentsWithDelay(float delay)
{
yield return new WaitForSeconds(delay);
ActivateRaceComponents();
}
private void ActivateRaceComponents()
{
RaceScripts.GetComponent().enabled = true;
RaceCampaign.SetActive(false);
Race.SetActive(true);
RCCCanvas.SetActive(true);
}
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... g-a-script
Мобильная версия