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: com.unity.perception/Documentation~/FAQ/FAQ.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ This page covers a variety of topics, including common questions and issues that
8
8
<details>
9
9
<summary><strong>Q: How can I disable or enable labeling on an object at runtime?</strong></summary>
10
10
<br>
11
+
11
12
You can turn labeling on and off on a GameObject by switching the enabled state of its `Labeling` component. For example:
12
13
13
14
```C#
@@ -22,15 +23,15 @@ This page covers a variety of topics, including common questions and issues that
22
23
<details>
23
24
<summary><strong>Q: How can I remove or add new labels to objects at runtime?</strong></summary><br>
24
25
25
-
This can be achieved through modifying the `labels` list of the `Labeling` component. The key is to call `RefreshLabeling` on the component after making any changes to the labels. Example:
26
+
This can be achieved through modifying the `labels` list of the `Labeling` component. The key is to call `RefreshLabeling()` on the component after making any changes to the labels. Example:
26
27
27
28
```C#
28
29
varlabeling=gameObject.GetComponent<Labeling>();
29
30
labeling.labels.Clear();
30
31
labeling.labels.Add("new-label");
31
32
labeling.RefreshLabeling();
32
33
```
33
-
Keep in mind that any new label added with this method should already be present in the `LabelConfig`attached to the `Labeler` that is supposed to label this object.
34
+
Keep in mind that any new label added with this method should already be present in the Label Config attached to the Labeler that is supposed to label this object.
34
35
35
36
---
36
37
</details>
@@ -47,10 +48,10 @@ Keep in mind that any new label added with this method should already be present
47
48
Alternatively, in cases where parts of the surface of the object need to be labeled (e.g. decals on objects), you can add labeled invisible surfaces on top of these sections. These invisible surfaces need to have a fully transparent material. To create an invisible material:
48
49
49
50
* Create a new material (***Assets -> Create -> Material***) and name it `TransparentMaterial`
50
-
* Set the `Surface Type` for the material to `Transparent`, and set the alpha channel of the `Base Map` color to 0.
51
-
* For HDRP: In addition to the above, disable `Preserve specular lighting`
51
+
* Set the **Surface Type** for the material to **Transparent**, and set the alpha channel of the **Base Map** color to 0.
52
+
* For HDRP: In addition to the above, disable **Preserve specular lighting**
52
53
53
-
An example labeled output for an object with separate labels on inner objects is shown below:
54
+
An example labeled output for an object with separate labels on inner objects and decals is shown below:
54
55
55
56
<palign="center">
56
57
<imgsrc="images/inner_labels.gif"width="600"/>
@@ -74,7 +75,7 @@ This is due to a common graphics problem called *z-fighting*. This occurs when t
74
75
<summary><strong>Q: How can I have multiple sets of prefabs in a foreground placement Randomizer, and on every Iteration select one from each set?</strong>
75
76
</summary><br>
76
77
77
-
This question is an example of more complex functionality that can be achieved by applying slight modifications to the provided sample Randomizers, or by creating completely custom ones using the powerful Parameters provided in the package.
78
+
This question is an example of more complex functionality that can be achieved by applying slight modifications to the provided sample Randomizers, or by creating completely custom ones by extending the `Randomizer` class.
78
79
79
80
Here, we have a variety of options toward achieving the described outcome. One simple method could be to add several more `GameObjectParameter` fields inside of the provided sample `ForegroundObjectPlacementRandomizer`. Each of these Parameters could hold one of our object lists. Then, on each iteration, we would fetch one prefab from each of the lists using the `Sample()` function of each Parameter.
80
81
@@ -93,7 +94,7 @@ This is due to a common graphics problem called *z-fighting*. This occurs when t
93
94
}
94
95
```
95
96
96
-
We can now create a cluster asset using the ***Assets -> Create -> Test -> PrefabCluster** menu option and populate its list of prefabs. Each cluster contains one `GameObjectParameter`, which will hold the list of prefabs and provide us with a `Sample()` function.
97
+
We can now create a cluster asset using the ***Assets -> Create -> Test -> PrefabCluster*** menu option and populate its list of prefabs. Each cluster contains one `GameObjectParameter`, which will hold the list of prefabs and provide us with a `Sample()` function.
97
98
98
99
To be able to edit these clusters with the same editor UI available for Randomizers, you will also need to add an empty custom editor for the `PrefabCluster` class that extends our bespoke `ParameterUIElementsEditor` class:
99
100
@@ -105,15 +106,15 @@ This is due to a common graphics problem called *z-fighting*. This occurs when t
Note that any editor scripts must be placed inside a folder named "Editor" within your project. "Editor" is a special folder name in Unity that prevents editor code from compiling into a player during the build process. For example, the file path for the `PrefabClusterEditor` script above could be ".../Assets/Scripts/Editor/PrefabClusterEditor".
109
+
Note that any editor scripts must be placed inside a folder named "Editor" within your project. "Editor" is a special folder name in Unity that prevents editor code from compiling into a player during the build process. For example, the file path for the `PrefabClusterEditor` script above could be `.../Assets/Scripts/Editor/PrefabClusterEditor`.
109
110
110
111
The ***Inspector*** view of a prefab cluster asset looks like below:
111
112
112
113
<palign="center">
113
114
<imgsrc="images/prefab_cluster.png"width="400"/>
114
115
</p>
115
116
116
-
Now all that is left is to use our prefab clusters inside a Randomizer. here is some sample code:
117
+
Now all that is left is to use our prefab clusters inside a Randomizer. Here is some sample code:
117
118
118
119
```C#
119
120
usingSystem;
@@ -582,4 +583,4 @@ The physics engine needs to catch up with the position and rotation of your obje
582
583
One useful resource for humanoid characters and animations is [Mixamo](https://www.mixamo.com/#/?page=1&type=Motion%2CMotionPack).
0 commit comments