[Unity-6] Sometimes GameObject cannot be rendered, unity-6gameobject
Problem description:A monster encountered such a problem during the game. It would be okay if he was shown in the center of the screen, but let him appear at the edge of the screen to find that he did not appear.
Cause:After checking, I found that I added an Animator control to this GameObject, and set the Animation Mode to Based on renderers. changing it to Always Animate can solve the above problem.
PS:It is difficult to find this error because of lack of a comprehensive understanding of Unity. Therefore, you should first repeat the basics.
How does Unity3d adjust the visibility of GameObject? Is there any function?
Remove the small check mark of the name in the Inspector panel to make the object invisible.
For code, you can use the GameObject. active attribute to set false to invisible.
For component objects, you can use. enable = false to make the component unavailable.
Unity C # How does one public gameobject reference this gameobject in another script in the same scenario to obtain attributes?
A direct GameObject. Find (name) is not recommended.
2. Add tags to the gameobject to be obtained. In the script, GameObject. FindGameObjectWithTag (TAG) or GameObject. FindWithTag (TAG). If there are too many objects in the game scene, do not use them.
The three scripts define a public GameObject variable. The gameobject is dragged to the variable in the view panel.
After obtaining the gameobject, the specific operation will not be mentioned.