validate_path {unifir}R Documentation

Validate a file path exists

Description

validate_path creates a generic C# method which takes a single argument and checks to make sure it exists. Your C# code calling the method must provide the path to validate. validate_single_path hard-codes the path to check in the C# code. This allows you to specify the path to check from R.

Usage

validate_path(script, method_name = NULL, exec = FALSE)

validate_single_path(script, path, method_name = NULL, exec = TRUE)

Arguments

script

A unifir_script object, created by make_script or returned by an ⁠add_prop_*⁠ function.

method_name

The internal name to use for the C# method created. Will be randomly generated if not set.

exec

Logical: Should the C# method be included in the set executed by MainFunc?

path

The file path to validate

See Also

Other props: add_default_player(), add_light(), add_prop(), add_texture(), create_terrain(), import_asset(), instantiate_prefab(), load_png(), load_scene(), new_scene(), read_raw(), save_scene(), set_active_scene()

Other utilities: add_default_player(), add_prop(), create_unity_project(), find_unity(), get_asset(), load_png(), load_scene(), new_scene(), read_raw(), save_scene(), set_active_scene(), waiver()

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 <- validate_path(script) # Don't specify the path in R
script <- validate_single_path( # Specify the path in R
  script,
  "file_that_exists.txt"
)

[Package unifir version 0.2.4 Index]