i am using below script in which i want to apply transform.translate to the gameobject “temp” located in faller() finction everytime the temp is assigned. but how?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class Poolingscript3 : MonoBehaviour {
public Texture txtr;
public List list1;
public float dragg;
public int speed;
void Start ()
{
InvokeRepeating (“faller”,1.0f,1.0f);
}
GameObject temp;
void faller()
{
int RandomNo = Random.Range(0,2);
temp = list1.FirstOrDefault<GameObject>();
temp.renderer.material.mainTexture = txtr[RandomNo];
temp.transform.position = transform.position;
list1.Remove(temp);
temp.SetActive(true);
}
void Update()
{
}
public void addtolist(GameObject g)
{
g.SetActive (false);
list1.Add (g.gameObject);
}
}