This function creates light objects within a Unity scene. This function can only add one light at a time – call the function multiple times to add more than one light.
Usage
add_light(
  script,
  light_type = c("Directional", "Point", "Spot", "Area"),
  method_name = NULL,
  light_name = "Light",
  x_position = 0,
  y_position = 0,
  z_position = 0,
  x_scale = 1,
  y_scale = 1,
  z_scale = 1,
  x_rotation = 50,
  y_rotation = -30,
  z_rotation = 0,
  exec = TRUE
)Arguments
- script
 A
unifir_scriptobject, created by make_script or returned by anadd_prop_*function.- light_type
 One of "Directional", "Point", "Spot", or "Area". See https://docs.unity3d.com/Manual/Lighting.html for more information.
- method_name
 The internal name to use for the C# method created. Will be randomly generated if not set.
- light_name
 The name to assign the Light object.
- x_position, y_position, z_position
 The position of the GameObject in world space.
- x_scale, y_scale, z_scale
 The scale of the GameObject (relative to its parent object).
- x_rotation, y_rotation, z_rotation
 The rotation of the GameObject to create, as Euler angles.
- exec
 Logical: Should the C# method be included in the set executed by MainFunc?
See also
Other props:
add_default_player(),
add_prop(),
add_texture(),
create_terrain(),
import_asset(),
instantiate_prefab(),
load_png(),
load_scene(),
new_scene(),
read_raw(),
save_scene(),
set_active_scene(),
validate_path()
Examples
# First, create a script object.
# CRAN doesn't have Unity installed, so pass
# a waiver object to skip the Unity-lookup stage:
script <- make_script("example_script", unity = waiver())
# Now add props:
script <- add_light(script)
# Lastly, execute the script via the `action` function
