This function is exported so that developers can add their own props in new packages, without needing to re-implement the prop and script classes themselves. It is not expected that end users will need this function.
Arguments
- script
A script object (from make_script) to append the prop to.
- prop
A
unifir_propobject (from unifir_prop) to add to the script.- exec
Logical: Should the method created by the prop be called in the MainFunc method?
See also
Other props:
add_default_player(),
add_light(),
add_texture(),
create_terrain(),
import_asset(),
instantiate_prefab(),
load_png(),
load_scene(),
new_scene(),
read_raw(),
save_scene(),
set_active_scene(),
validate_path()
Other utilities:
add_default_player(),
create_unity_project(),
find_unity(),
get_asset(),
load_png(),
load_scene(),
new_scene(),
read_raw(),
save_scene(),
set_active_scene(),
validate_path(),
waiver()
Examples
script <- make_script("example_script", unity = waiver())
prop <- unifir_prop(
prop_file = waiver(), # Must be a file that exists or waiver()
method_name = NULL, # Auto-generated if NULL or NA
method_type = "ExampleProp", # Length-1 character vector
parameters = list(), # Not validated, usually a list
build = function(script, prop, debug) {},
using = character(0)
)
script <- add_prop(script, prop)
