You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-13Lines changed: 21 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,17 @@
16
16
17
17
Constrained Rect is a small helper that aims to make it easier to create Rect's based on existing ones.
18
18
19
+
## Installation
20
+
1. The package is available on the [openupm registry](https://openupm.com). You can install it via [openupm-cli](https://github.com/openupm/openupm-cli).
21
+
```
22
+
openupm add net.tnrd.constrainedrect
23
+
```
24
+
2. You can also install via git url by adding these entries in your **manifest.json**
Using constrained rects is easy. You simply call `Constrain.To(...)` and pass it either a `Rect` or an `EditorWindow`.
21
32
@@ -59,20 +70,17 @@ private void Foo()
59
70
}
60
71
```
61
72
62
-
##Contributing
63
-
Pull requests are welcomed. Please feel free to fix any issues you find, or add new features.
73
+
### Important
74
+
Due to the nature of Unity's editor architecture it is common to use Constrained Rects in high volume. In an attempt to prevent creating and collecting too much garbage as a result of using Constrained Rects they are now being pooled.
64
75
65
-
## Installing
66
-
Installing Constrained Rect into your Unity3D project is done through the [Package Manager](https://docs.unity3d.com/Manual/Packages.html).
76
+
After you've finalized your Constrained Rect by calling `.ToRect()` the Constrained Rect will be returned to the pool and free to use for other instances.
67
77
68
-
You can either add the package manually to the [manifest.json](https://docs.unity3d.com/Manual/upm-dependencies.html) file:
While all of this happens under the hood it is important to understand that from the moment that you call `.ToRect()` the Constrained Rect will throw an exception if it is not being used. This also means that if it is being used then the properties and variables might be different from what you might expect.
76
79
77
-
Or add it through the UI by selecting the **+ button** in the top left of the Package Manager, selecting _Add package from git URL..._, and pasting https://github.com/Thundernerd/Unity3D-ConstrainedRect.git in the input field.
80
+
## Support
81
+
**Constrained Rect** is a small and open-source utility that I hope helps other people. It is by no means necessary but if you feel generous you can support me by donating.
0 commit comments