Skip to contents

Build and execute a unifir_script

Usage

action(script, write = TRUE, exec = TRUE, quit = TRUE)

Arguments

script

The unifir_script object (as generated by make_script) to build and execute.

write

Boolean: Write the generated script to a file?

exec

Boolean: Execute the script inside of the Unity project? Note that if write = FALSE, exec cannot be TRUE.

quit

Boolean: Quit Unity after execution?

Value

If exec = FALSE, the original unifir_script object passed to script. If exec = TRUE, the same unifir_script object with its props replaced by the C# they generate.

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()
)

# Then add any number of props to it:
script <- add_light(script)

# Then call `action` to execute the script!
# \donttest{
if (interactive()) {
  action(script)
}
# }