Scripting
v1.0
The demo scene has a demo game controller, which calls many of these methods, if you'd like to see them in action.
Setting Values
Set the UI Color
The UI Color is set on the Portrait UI component for all portraits. Each of these will call the similar method on the portraitUI
class.
→ There is an optional bool
instant
argument, default false
. When true
, the color will be set instantly, otherwise it will be transitioned to, based on the transition values in the Portrait UI.
→ There is also an optional bool onlySetFirstItem
argument, also default false
. When this is true
, only the first Image
in the list of border UI elements will be set.
→ You can also pass in a specific index to set the value for only one in game portrait.
If Portraits Realtime Color is enabled, that may be controlling the border color, in which case any values you Set
here will be ignored.
Set Background Color (3D Avatars)
The Background Color is set on the Avatar Camera for 3D avatars. Each of these will ultimately call the similar method on the avatarCamera
component attached to the Portrait3D
class on your in game portrait.
→ There is an optional bool
instant
argument, default false
. When true
, the color will be set instantly, otherwise it will be transitioned to, based on the transition values in the Avatar Camera.
→ You can also pass in a specific index to set the value for only one in game portrait.
Set Light Color (3D Avatars)
The Light color is set on the Portrait 3D for 3D avatars. Each of these will ultimately call the similar method on the portrait3D
component.
→ There is an optional bool
instant
argument, default false
. When true
, the color will be set instantly, otherwise it will be transitioned to, based on the transition values in the portrait3D
.
→ There is also an optional bool onlySetFirstItem
argument, also default false
. When this is true
, only the first Light
in the list of lights will be set.
→ You can also pass in a specific index to set the value for only one in game portrait.
Set Light Intensity (3D Avatars)
The Light intensity is set on the Portrait 3D for 3D avatars. Each of these will ultimately call the similar method on the portrait3D
component.
→ There is an optional bool
instant
argument, default false
. When true
, the color will be set instantly, otherwise it will be transitioned to, based on the transition values in the portrait3D
.
→ There is also an optional bool onlySetFirstItem
argument, also default false
. When this is true
, only the first Light
in the list of lights will be set.
→ You can also pass in a specific index to set the value for only one in game portrait.
Caching Values
When a new portrait is created, it will use the cached color values when the "cache" toggles are true
in the Inspector. These methods are called whenever you Set
a value, but you can also call them directly outside of the Set
methods.
Last updated