Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector2 size = new Vector2(detection.brx - detection.tlx, detection.bry - detection.tly);
- Vector2 pivot = new Vector2(detection.tlx, imageTexture.height - detection.bry);
- // Create a new frame GameObject
- GameObject frame = new GameObject("Frame_" + detection.id);
- frame.transform.SetParent(transform);
- // Add an Image component to the frame GameObject
- Image frameImage = frame.AddComponent<Image>();
- frameImage.color = frameColor;
- frameImage.rectTransform.sizeDelta = size;
- frameImage.rectTransform.pivot = Vector2.zero;
- // Position the frame correctly
- frame.transform.position = pivot;
- // Get the rotation for the frame
- Quaternion frameRotation = Quaternion.Euler(detection.rotation);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement