0

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;
    }

}

script component

Game view: eye not rendered

  • Somebody told me that there is something called ``OnBecomeVisible`` and ``OnBecomeInvisible``. I suppose this is a way to go? Not sure how to find the references but that's probably quite easy. ``` body.OnBecomeVisible(){ eye.m_UpdateWhenOffscreen = true; } body.OnBecomeInvisible(){ eye.m_UpdateWhenOffscreen = false; }``` – xDonnervogelx Feb 09 '23 at 00:18
  • `I can't confirm nor negate it happens in Game view.` why not? Just move your camera accordingly.. – derHugo Feb 09 '23 at 13:38
  • I edited my question, apparently it is really a global problem with not being rendered. – xDonnervogelx Feb 12 '23 at 10:04

0 Answers0