I am using a rig which is holding eye objects. My model is moving a lot later on, and for example the head will meet the ground, eyes down there as well.
Now there is a slight problem.
My object's origin is up in the rest pose head position. If I let the entity move its head down and then zoom in on the eye until I am so close that the origin slips out of my view - the eye is gone, off on vacation. Only when I rotate my view to meet the origin, it reappears. This makes editing and observing difficult. Mind you, it's in Scene view and Game view where I observed this situation.
So I thought okay, I can check to update the object when offscreen. But that sounds highly unperformant on hindsight if I do that with each object. Now, there is an object, its main body, which is likely to stay in view more likely, origin wise.
I wonder.
Can I pick that other object's origin and determine the update cull with that? There is only a checkbox in my Unity version (2021.3.5f1), not a field to change that, and I am not really experienced in adding fields. So I googled a bit, but I couldn't find a solution, so I thought I ask here.
Edit: I tried this script, added it to the body and dropped in the eye renderer, which is sadly not working as much as I thought. Even though the main body is visible, the eye disappears in both views.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UpdateRendererOverrideManager : MonoBehaviour
{
public SkinnedMeshRenderer eye;
private void OnBecomeVisible()
{
eye.updateWhenOffscreen = true;
}
private void OnBecomeInvisible()
{
eye.updateWhenOffscreen = false;
}
}