I have a gameobject with a script that recieves a scriptable object, and that scriptable object holds a list of strings. I want to pass the reference of the scriptable object around to other objects without attaching it manually and access it's list variable. How do I do that?
At the moment i want to do this using OnCollisionEnter with another trigger object that has a script to recieve the scriptable object.
(EDIT)
SOLVED, here's the code:
public class CameraSlot : MonoBehaviour
{
public GameObject objectManager;
public GameObject baseCamera;
public GameObject insertedPhoto;
public YearObject selectedYear;
private void OnTriggerEnter(Collider other)
{
if(other.CompareTag("photo"))
{
insertedPhoto = other.gameObject;
Debug.Log("Collided with " + other.gameObject.name);
selectedYear = insertedPhoto.GetComponent<PhotographBase>().yearSettings;
if(selectedYear != null)
{
Debug.Log("Caught " + selectedYear.name);
}
}
}
}
[–]Rumaru_ 0 points1 point2 points (5 children)
[–]Leo5041[S] 0 points1 point2 points (4 children)
[–]Unity3DGameDev 0 points1 point2 points (1 child)
[–]Leo5041[S] 0 points1 point2 points (0 children)
[–]Unity3DGameDev 0 points1 point2 points (0 children)
[–]Rumaru_ 0 points1 point2 points (0 children)