This is my project : http://unity.azmangames.com/hataBuild.html
Problem is when I instantiate an object from the raycast, clone object is very dark in color. Maybe this is a very basic thing but I couldn’t figure out why. I checked materials, I checked shaders, I even put lights on new object but nothing helped. Here is my instantiate code :
Many thanks in advance.
(in FixedUpdate)
Ray ray2 = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit2;
if (Input.GetMouseButtonDown(0))
{
if (Physics.Raycast(ray2, out hit2))
{
if (hit2.transform.tag == "resim")
{
klonRes = new GameObject();
klonRes.name = "klonRes";
klonResim = Instantiate(hit2.transform.gameObject, hit2.transform.position, new Quaternion(0, -180, 0, 0)) as GameObject;
klonResim.transform.localScale = new Vector3(klonResim.transform.localScale.x + 10, klonResim.transform.localScale.y + 10);
klonResim.transform.parent = klonRes.transform;
resimTakipEdiyor = true;
}
}
}
if (resimTakipEdiyor) //resim ekleme
{
Vector3 point = ray2.origin + (ray2.direction * 85);
klonResim.transform.position = point;
}
if (secilenTakipEdiyor) //resim taşıma
{
Vector3 point = ray2.origin;
secilenResim.transform.parent.position = point;
}
if (Input.GetMouseButtonUp(0))
{
resimTakipEdiyor = false;
secilenTakipEdiyor = false;
}