Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

This is great. 

Is there a way to contact you to share some additional helper functionality I added which I think would be useful going forward. 

I could post code here if that is okay. 

(1 edit)

sure..if it helps improve the system..thanks..btw, im in isolation due to covid, might take a while to update it.

Hope you are well.  Will post here in a bit. Great addin.  

This was useful to me, since I have a multi-scene game and the player is persistent across scenes, so can't directly link to vehicle. 


// add this to every car. 

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class CarControllerConfigurer : MonoBehaviour

{

    private V_CarControl myCar;

    private GameObject myPlayer;

    // Start is called before the first frame update

    void Awake()

    {

        RegisterPlayerToCar();

    }

    public void RegisterPlayerToCar()

{

        // public method so you can call from onTriggerEnter when close to car, in case onAwake has not been called (e.g. player respawn)

        myCar = this.gameObject.GetComponent<V_CarControl>();

        myPlayer = FindObjectOfType<PlayerReferenceManager>().gameObject;

        myCar.Player = myPlayer;

    }

}


// add this to the player,  it's just an empty class to make it discoverable across multiple different kinds of players.

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PlayerReferenceManager : MonoBehaviour

{}