Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

public update in gestures

Why does the AstronautManager.cs of Holograms 211 (Chapter 5 - Model expansion) use a public void Update() method at the end? Why public?

I am a novice, following MS academy tutorials, and so far I cannot understand why this Update function is declared public here, so I would appreciate someone helping me understand.

Tagged:

Best Answer

  • stepan_stulovstepan_stulov ✭✭✭
    edited July 2017 Accepted Answer

    Hey, @hmiri

    Update() is one of the Unity's so called built-in MonoBehaviour messages, or in other words standard methods that Unity engine will call on your scripts if defined. They can be defined with any level of access (public, private, protected) and also whether or not the methods are virtual. Despite being declared as public you don't have to call this method, it will be called by the engine. In some exceptional case you would call this method, but that'd usually be an ugly hack.

    I personally declare all MonoBehaviour methods as public without any real reason behind it. Some people prefer private to prevent temptation of calling it by someone else.

    I recommend getting familiar with Unity's script life-cycle.

    Building the future of holographic navigation. We're hiring.

Answers

  • stepan_stulovstepan_stulov ✭✭✭
    edited July 2017 Accepted Answer

    Hey, @hmiri

    Update() is one of the Unity's so called built-in MonoBehaviour messages, or in other words standard methods that Unity engine will call on your scripts if defined. They can be defined with any level of access (public, private, protected) and also whether or not the methods are virtual. Despite being declared as public you don't have to call this method, it will be called by the engine. In some exceptional case you would call this method, but that'd usually be an ugly hack.

    I personally declare all MonoBehaviour methods as public without any real reason behind it. Some people prefer private to prevent temptation of calling it by someone else.

    I recommend getting familiar with Unity's script life-cycle.

    Building the future of holographic navigation. We're hiring.

Sign In or Register to comment.