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.
Options

ui to load other pre-loaded objects

wanted to have buttons that allow users to load more objects from a library within an app. it will be something similar to holostudio where there will be a bunch of pre-loaded items that can be placed into the scene. any recommended tutorials or references that I can refer to?

Best Answer

Answers

  • Options
    felsiskafelsiska
    edited October 2016

    @HoloSheep
    thx for the advice.
    I'm currently using LoadSceneMode.Additive to add objects into current scene after clicking on an UI. this means that UI needs to be added on every object that I want to place into the current scene?

  • Options

    @felsiska I haven't used LoadSceneMode.Additive in a HoloLens app as of yet, but I believe it adds a whole scene into the current scene as opposed to just an object.

    My guess would be that instantiating new prefab objects at runtime would be (or could be if used strategically) more efficient and clean than adding scenes within scenes.

    As for "adding UI to every object" that sounds like the reverse of what I thought you were looking to do. I pictured some form of menu (of buttons) and when you clicked one of those buttons on the menu it would execute a couple of lines of code (as suggested in the link referenced above) that would instantiate a new object from the appropriate prefab into the current scene. If you clicked the same button again, it would then add another instance of the same object to the scene. However, if you clicked a different object on the menu, you would then get an appropriately different object added to the scene. I didn't envision adding UI on top of new objects that would then provide a way to add further objects... but if that is what you want you could probably bake that UI into the prefab.

    But maybe I am misunderstanding what you are trying to do, and if so, my apologies for the distraction.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options
    felsiskafelsiska
    edited October 2016

    @HoloSheep
    thx for the prompt reply.

    I am trying to place pre-loaded objects into the current scene just like Holostudio, where there will be a button indicating load object, then user is to select on the object from the list. which I believe is the same thing as what you mentioned above. but in order to execute the instantiating of object when the picture or logo of object is clicked on, there must be a button. so each object will have their own button? correct me if i'm wrong.

    I am now currently trying on using GameObject MyNewHologram = (GameObject)Instantiate(Resources.Load("MyHologramPrefab")); to load a cube and sphere. so when I click on cube-button, cube will appear. click on sphere-button, sphere will appear. how can I edit the script so that I do not have to recreate different script for each object?

    thx lots

  • Options

    @felsiska the string "MyHologramPrefab" is the thing that would be a variable if you are trying to generalize that code snippet to load different prefab resources into a new gameobject.

    You could do a variety of things to pass in the appropriate resource name string including naming the button with names that relate to the prefab resource name and passing in the string value of the button name, perhaps with a prefix or suffix appended to it to match the naming convention that you use for you prefab resources for good measure.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options
    felsiskafelsiska
    edited October 2016

    @HoloSheep
    so buttons will still need to be attached to diagram of each object that I would want to "load" into the project?

  • Options

    @felsiska not sure what your UI looks like, you could use buttons or if your "diagram" is a visual layout of 3D objects you could wire the load logic into the air tap handler for that object.

    In the Holograms 101 tutorial for example if you look at the OnSelect function in the SphereCommands.cs file it is handling the Select (aka Air Tap) for the origami sphere objects. The code in that function triggers the physics so that the sphere falls and rolls away when selected, but in your case you could trigger logic to load a new instance of the object selected. Explore the project code for Holograms 101 and see how the select interaction is wired up and how it works as a basic starting point.

    Creating something as polished as HoloStudio takes a lot of time and planning and will involve a fair amount of logic to handle things like which tool mode the user is in when they select an object as well as perhaps logic to deal with which step of interaction the user is in for the particular tool. However if you start by getting the hang of a simple interaction (like creating a new object of the same type when the user selects it) it should get you started in the right direction and asking the right questions.

    HTH.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options

    @HoloSheep
    thx for the advice. will analyze the code further.

    thx for your help!!

  • Options

    @HoloSheep
    HI i want Load fbx from one drive same as like 3d viewer beta app.? How can i achieve ? please help

    Thanks.

Sign In or Register to comment.