Question by
uzum4ki82 · May 13, 2020 at 01:42 PM ·
programmingdrag and drop
programmer unity
I search a programmer for Unity . I want to finished a game that I created in home by Covid-19. I need that the object when it's drop in the box correct, don't move other time.
This is the code:
public void DragObjeto5()
{
Objeto5.transform.position = Input.mousePosition;
}
//public void OnEndDragObjeto1(PointerEventData eventData)
//{
// Objeto1 = null;
// if (transform.parent == Objeto1 || transform.parent == transform.root)
//
// {
//transform.position = startParent.transform.position;
// transform.SetParent(startParent);
// }
// GetComponent<CanvasGroup>().blocksRaycasts = true;
//}
public void DropObjeto1()
{
float Distance = Vector3.Distance(Objeto1.transform.position, Objeto1_Lugar.transform.position);
if (Distance < 50 && Objeto1Correct == false)
{
Objeto1.transform.localScale = Objeto1_Lugar.transform.localScale;
Objeto1.transform.position = Objeto1_Lugar.transform.position;
Objeto1Correct = true;
Objeto1_Lugar.name = Objeto1.name;
source.clip = buttonDrop;
source.Play();
}
else
{
Objeto1.transform.position = Objeto1Ini;
source.clip = reload;
source.Play();
}
}
Comment
Your answer
Follow this Question
Related Questions
UI Text is Blurry in RenderTexture 1 Answer
Drag object similarly to Monument Valley 0 Answers
Need a 2D Rigid Body Controller Script 1 Answer
2 Issues with my SHUMP game 0 Answers
How to project a semi transparent copy of a gameobject? 0 Answers