SetCamera

Description

Update the active camera that is used to remove vehicles when are not in view.

Declaration

public static void SetCamera(Transform activeCamera)

Parameters

NameDescription

activeCamera

Camera that follows the player or the player itself. Used to determine the line of sight for vehicle instantiations.

Example

using Gley.TrafficSystem;
using UnityEngine;

public class Test : MonoBehaviour
{
    //a reference to vehicle pool and player assigned in inspector
    public VehiclePool vehiclePool;
    public Transform player;

    //a reference to some camera
    public Transform someCamera;

    void Start()
    {
        API.Initialize(player, 20, vehiclePool);
    }

    //called at the right time
    public void UpdateCamera()
    {
        API.SetCamera(someCamera);
    }
}

Last updated