I need an LOD in a prefab to look at a specific game object (the Camera). Currently I have it set up to where it looks at a public variable. However, this variable has to be set for every prefab even if I set it for one prefab and attempt to override the change. I don’t want to go through the hundreds of prefabs in my scene a manually assign the target for each prefab. So, how would I script it to make all of the prefabs look at a specific gameObject rather than making them look at a public target?
Try to add this in the scripts of the prefabs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Naovai : MonoBehaviour
{
private GameObject Camera;
void Start()
{
Camera = GameObject.Find("MainCamera");
}
void Update()
{
transform.LookAt(Camera);
}
}
Remember to ADD, do not change the script.
Thanks for the response. I’ve actually already tried that as well, but I get the error " cannot convert from ‘UnityEngine.GameObject’ to ‘UnityEngine.Transform’ "