[Unity] OnBecameVisible no effect no reaction

Disclaimer: This blog seriousness nonsense, the article content can not reference. This article is a blogger original article, shall not be reproduced without the bloggers allowed. Pictures are resources for learning to share use for reference purposes only, not for commercial behavior of the blog used. Communicators conceited. If this blog article written infringe your rights, please reach out to leave a message, we will promptly remove content. https://blog.csdn.net/BuladeMian/article/details/90413016

 

 

No effect reasons:

Any one of the camera view or 1.Scene Game view scope mount entities Test_OnBecameVisible the target entity.

2. The target entity must have the Renderer component can not be empty objects. It means that the model must have rendered.

 

 

using UnityEngine;

public class Test_OnBecameVisible : MonoBehaviour {
    
    private void OnBecameVisible()
    {
        print("摄像机视野...内" + this.transform);
    }
    private void OnBecameInvisible()
    {
        print("在摄像机视野---外" + this.transform);
    }
}

 

 

References:

1. Unity OnBecameVisible usage and OnBecameInvisible

2. Unity3d performance optimization of OnBecameVisible / OnBecameInvisible

3.

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/BuladeMian/article/details/90413016