load_png {unifir}R Documentation

Create a Texture2D from a PNG file

Description

This function adds a helper method, LoadPNG, to the C# script. This function is typically used by other C# methods to bring in textures into a Unity scene, for instance by functions like create_terrain. It requires some arguments be provided at the C# level, and so is almost always called with exec = FALSE.

Usage

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

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?

See Also

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

Other utilities: add_default_player(), add_prop(), create_unity_project(), find_unity(), get_asset(), load_scene(), new_scene(), read_raw(), save_scene(), set_active_scene(), validate_path(), 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())

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

# Then call `action` to execute the script!

[Package unifir version 0.2.4 Index]