- Home /
UI RectTransform not reseting
Hey guys, SO i am making an inventory system. Currently making the drag n drop. I made it so when the player drags it it snaps out of the parent slot so it won't show under the other slots and when the drag n drop ends it snaps back to the original parent. All of this works, however the RectTransform gets really high values when changing the parent. I tried using offsetMin and offsetMax and setting them to 0 but that did not work.
#region IEndDragHandler implementation
public void OnEndDrag(PointerEventData eventData){
this.transform.SetParent (startParent);
this.transform.position = startParent.position;
this.transform.localPosition = new Vector3(0,0,0);
this.transform.GetComponent<RectTransform> ().offsetMin = new Vector2 (0f, 0f);
this.transform.GetComponent<RectTransform> ().offsetMax = new Vector2 (0f, 0f);
}
#endregion
EDIT: this is the values i get
This is not enough information for an answer. Really, this is not even a question. This is a statement of a problem and probably belongs on the forums, where it's easy to have a linear discussion that builds upon itself. At a $$anonymous$$imum, add a single question that you want answered at the end of your post. Better yet, take this exact post and repost it on the forums, then close or withdraw this question.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How do I get gameobjects to fire a method based on an interface? 1 Answer
Annoying MissingReferenceException with Interfaces and Monobehavior 1 Answer
Find all scripts attached to an object that implement a certain interface 1 Answer