SetCameras

Description

Update active cameras that are used to remove vehicles when are not in view. This is used in multiplayer/split-screen setups.

Declaration

public static void SetCameras(Transform[] activeCameras)

Parameters

NameDescription

activeCameras

All cameras that follow the players or the players themself. 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 cameras
    public Transform[] someCameras;

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

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

Last updated