Survival Template Pro
Roadmap
  • Welcome!
  • Getting Started
    • Installation Guide
      • Demo Maps
    • Scene Setup
    • Frequently Asked
    • Integrations
  • Player
    • Character
    • Modules & Behaviours
      • Inventory
        • Item Container
      • Movement
      • Camera
      • Health
      • Building
      • Object Carry
      • Wieldable
      • Interaction
      • Crafting
      • Sleep
      • Audio
  • User Interface
    • UI Behaviours Manager
    • Behaviours
      • UI_Inventory
      • UI_Damage
      • UI_Vitals
      • UI_Wieldables
      • UI_Interaction
      • UI_Sleep
  • Interaction
    • Interactable
      • Demo Interactables
    • Extension
  • Inventory
    • Create Item
      • Item Info
      • Item Settings
      • Properties & Tags
      • Item Pickup
  • Wieldables
    • Overview
  • Surfaces
    • Create Surface
    • Code Examples
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Surfaces

Code Examples

This function leverages the SurfaceManager to spawn an effect that corresponds to the hit surface type (e.g. grass, dirt etc.)

if (Physics.Raycast(ray, out RaycastHit hitInfo, m_MaxDistance, m_RayMask, QueryTriggerInteraction.Ignore))
{
    // effect type
    SurfaceEffects effectType = SurfaceEffects.BulletHit;

    // audio volume multiplier
    float audioVolume = 1f;

    // useful for parenting decals to moving targets
    bool shouldParentEffect = false;

    SurfaceManager.SpawnEffect(hitInfo, effectType, audioVolume, shouldParentEffect);
}
PreviousCreate Surface

Last updated 3 years ago

Was this helpful?