Skip to content
TREN
Atlıhan Harita

LCC for Unity User Manual · Feature Development Guide

Loading Effect Development Guide

Chapter 15.7 / 17Manual version v2.3.0English

The LCC Unity SDK supports loading effects. A loading effect spreads outward 720 degrees from a specified point, simulating a process of appearing from nothing. The following describes the complete steps for implementing the loading effect.

Step 1: Create the scene and GameObjects

Create a brand-new scene in Unity. Unity creates Main Camera and Directional Light by default.

Set up Main Camera

Select Main Camera in the Hierarchy window, and set its properties in the Inspector window as shown below.

Set the Main Camera properties

Set the Main Camera properties

Create LCCManager

Right-click an empty area in the Hierarchy window, select Create Empty from the pop-up menu to create an empty GameObject, name it LCCManager, normalize its Transform, and add the LCCManager script to it via Add Component.

Create the LCCManager GameObject and add the LCCManager script

Create the LCCManager GameObject and add the LCCManager script

Create LCCRenderer

Right-click an empty area in the Hierarchy window, select Create Empty to create an empty GameObject, name it LCCRenderer, and set its Transform to Rotation.x = -90 and Scale.x = -1.

Create LCCRenderer and set its Transform

Create LCCRenderer and set its Transform (Rotation.x = -90, Scale.x = -1)

Note:

The Transform settings of the LCCRenderer GameObject (Rotation.x = -90, Scale.x = -1) align it with the LCC data coordinate system. For details on coordinate system alignment, see "LCC Data Coordinate System" in Unity SDK Introduction.

Step 2: Write a script to trigger the effect

Create a new C# script named VFX.cs with the following code:

using LCCCore;
using UnityEngine;

public class VFX : MonoBehaviour
{
    public LCCManager m_manager;
    public string m_FilePath;
    private LCCCore.Renderer m_renderer;

    void Start()
    {
        m_manager.SetPlatformType(PlatformType.PC);
        m_manager.SwitchRenderPass(ActiveRenderMode.SingleRender);

        Debug.Log("Started, loading data...");
        m_renderer = m_manager.GetRender(this.transform);
        m_renderer.Load(m_FilePath, onProgress, onComplete);
    }

    private void onProgress(float _progress)
    {
        Debug.Log($"Load progress: {_progress:P1}");
    }

    private void onComplete()
    {
        Debug.Log("Load complete, enabling VFX ...");
        Vector3 pos = Camera.main.transform.position + Camera.main.transform.forward * 2.0f;
        m_manager.TriggerVFX(pos);
    }
}

Note:

The effect must be triggered after the LCC scene finishes loading, so TriggerVFX() is called in the onComplete callback. In this example, after data finishes loading, the effect is triggered 2 meters in front of the rendering camera.

Step 3: Attach the script and set the data path

  1. Attach the VFX.cs script to the LCCManager GameObject in the Hierarchy window.
  2. In the Inspector window, drag the LCCManager GameObject onto the script's Manager property.
  3. Fill in the LCC file path in the script's File Path property.
Attach the VFX script and set the Manager and File Path

Attach the VFX script and set the Manager and File Path properties

Step 4: Run

Click the Play button in the Game window to see the real-time loading effect in the scene. The effect spreads outward 720 degrees from the trigger point.

The real-time loading effect in the scene after running

The real-time loading effect in the scene after running

Key Steps

The key steps for loading an effect in a 3DGS scene:

  1. Make sure the LCCManager and LCCRenderer GameObjects have been created in the scene with the correct Transform.
  2. Make sure the effect is triggered in code after the LCC scene finishes loading (that is, in the onComplete callback).
  3. The world coordinate passed into TriggerVFX() determines the origin of the effect's spread.

The LCC Unity SDK provides the effect-triggering API through LCCManager. It must be called after the LCC scene finishes loading (that is, in the onComplete callback).

TriggerVFX

// Return value: void
public void TriggerVFX(Vector3 vfxOriginW, int vfxid = 0)

Triggers the effect at the specified world coordinate, and the effect spreads outward 720 degrees from that coordinate point.

ParameterTypeDescription
vfxOriginWVector3World coordinate origin of the effect
vfxidintEffect ID, optional, default is 0

Usage example:

Vector3 pos = Camera.main.transform.position + Camera.main.transform.forward * 2.0f;
m_manager.TriggerVFX(pos);

Notes:

  • Must be called after the LCC scene finishes loading.
  • vfxOriginW is the world coordinate of the effect's starting point.
  • After calling, the shader keyword is switched to _VFXMIX.

This chapter is from the official XGRIDS user manual. Official source (opens in a new tab) · Updated:

XGRIDS Türkiye

We're With You During Setup and in the Field

Atlıhan Harita provides training and technical support for device setup, firmware updates, software use, and field applications. Send us your question and our specialist will get back to you.

+90 216 546 0804