Hello Com,
i have a small question: What is the most efficient way to get a reference to a game object?
I am asking, because in many posts i read that GameObject.Find(“GameObjectName”) is slow.
My code:
[SerializeField] private GameObject obj;
// Use this for initialization
void Start () {
obj = GameObject.Find("box1");
}
// Update is called once per frame
void Update () {
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
{
// Get movement of the finger since last frame
Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
print(touchDeltaPosition);
//move a object across XY plane
}
rgds,
GreenTee