- Home /
how to apply translate to gameobject?
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); }
}
Please learn how to format script code on this site.
Your answer
Follow this Question
Related Questions
Making an object move smoothly without using Update 2 Answers
Rotate Method via Update ? 2 Answers
Vector3 Returning Infinity Error 2 Answers
Quick question on transform.Translate(); C# 1 Answer
Elevator Script ? 2 Answers