Scripting#
Resources#
Crest does not use the Resources folder. Instead a scriptable object which holders references to all our compute and internal shaders is stored on the Water Renderer. This will tell Unity to include these files in a standalone build.
If instantiating the Water Renderer via scripting in builds, and there is no reference to a Water Renderer in the scene (including via prefab), you must add a reference to the Resources asset in a scene to include our internal runtime and compute shaders in the build. The Resources asset will not include shaders that are exposed in the shader selection for materials.
Scripting API#
Please see the API section in the sidebar.
Assemblies#
When using Assembly Definitions, there are two extra assemblies that need to be referenced: Shared and Scripting. The former is required to compile correctly, while the latter is optional.
The Scripting assembly provides extension methods necessary to adding input components:
// Add the foam input with the texture mode.
var input = gameObject.AddComponent<FoamLodInput>(LodInputMode.Texture);
// Retrieve the texture mode data and assign a texture.
var data = input.GetData<FoamTextureLodInputData>();
data.Texture = texture;