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.
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
Instantiate prefab script works locally but not in world
I have prefabs loading into the scene in random ranges. When I hit Play I see them in the player window. When I launch to the hololens world I don't see the prefabs loading.
What could be going wrong?
`using UnityEngine;
using System.Collections;
public class InstantiateSnowFlake : MonoBehaviour {
public GameObject mySnowFlakePreFab; GameObject myCoolSnowFlake; Vector3 mytransform; private float InstatiationTimer = 1.0f; // Use this for initialization void Start () { // myCoolSnowFlake = Instantiate(mySnowFlakePreFab,transform.position,Quaternion.identity )as GameObject; } // Update is called once per frame void Update () { CreatePrefab(); } void CreatePrefab() { CreateRandomTransForm(); InstatiationTimer -= Time.deltaTime; if (InstatiationTimer <= 0) { Instantiate(mySnowFlakePreFab, mytransform, Quaternion.identity); InstatiationTimer = 1.0f; } } void CreateRandomTransForm() { mytransform = new Vector3(Random.Range(-2.0f, 2.0f), 0.7f, Random.Range(-2.0f, 2.0f)); }
}
`
0
Best Answer
-
OptionsHoloSheep mod
Have you tried the Resources.load approach?
If you create a folder called Resources under the project's main Asset folder and save the prefab there, then a line like:
Instantiate(Resources.Load("mySnowFlakePreFab", mytransform, Quaternion.identity));
might do the trick.
HTH.
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings5
Answers
I get these warnings
Unable to find plugins folder WSAPlayer. Native VR plugins will not be loaded.
UnityEngine.Debug:LogWarning(Object)
UnityEditorInternal.VR.VRPostProcess:RegisterVRPlugins(BuildTarget) (at C:/buildslave/unity/build/Editor/Src/VR/Mono/PostProcessVR.cs:123)
UnityEditor.c__Iterator0:MoveNext()
PostProcessWinRT:CopyPlugins() (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:401)
PostProcessWinRT:Process() (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:118)
UnityEditor.HostView:OnGUI()
@JD_Holo_Dev
Have you tried the Resources.load approach?
If you create a folder called Resources under the project's main Asset folder and save the prefab there, then a line like:
might do the trick.
HTH.
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings
HoloSheep thanks for that hint.
Problem Solved:
My problem seemed to be a corrupt project. I was missing the WSAPlayer from my project. I had to create a new project and transfer my assets folder from my corrupt project to my new project so save my work from being lost. My Code above worked fine in the Hololens world once my project was fixed.