How can i save and load Anchorpoints using Unity - unity3d

Every time I make the Select gesture, a new instance of the Cube prefab is created and placed in the Room. I would like to save the position of all the instances for example every 10 seconds. Furthermore I would like to load the saved instances when the app restarts.
I created a C# skript attached to the MainCamera with the following Content that i found on the Unity manual site https://docs.unity3d.com/Manual/windowsholographic-persistence.html. I do not know if that is more or less the right way or if its completly the wrong idea. the content of the LoadSave skript
I am completly new to unity and mixedreality and would be very thankfull if someone could help me.

Related

Implementing a point system on 3d GameObjects in Unity

So I want to create a script where you click on a GameObject and collect a point/+1 score, while the GameObject gets deleted. Sounds simple but I just don't know where to start as I am fairly new to coding, I have created the Destroy(gameobject) function but can not seem to implement a point system like how I had in mind as every tutorial on the internet does it with a ui button. Haven't coded anything on this topic yet but I'm hoping to get some explanations on this topic, Thank you for taking your time to read this and have a good day:),
Update: I found that making a PointManager script and AddPointOnClick script, and using it on the GameObject works!
Watch this for more detail: https://youtu.be/YUcvy9PHeXs

Floppy Disk icon Middle of my screen when game is running

I'm a beginner in unity and programming, I was following a video for making a Flappy Bird game. Everything works perfectly but when I run the game, I get a floppy disk icon middle of the screen and somehing called DontDestroyOnLoad starts working out of nowhere. I couldn't find or understand anything on google when I search for it. I'm posting the screenshots in case anybody wanna see it.
This icon and dontdestroyonload thing only appears when game is being run:
There's a little button in the type right of your scene and game view called "Gizmos", un-toggle that button, should fix your issue.
Also don't worry, Gizmos can only be seen in the Unity Editor for level editing and debugging purposes --> if you were to build the game, for instance on IOS, they would disappear.
(if this doesn't fix your issue, then I would just create a new scene and copy your gameobjects over one-by-one)
I see someone responded about the main part of a problem, but I'll clarify about dontdestroyonload
Don't destroy on load is collection of objects that won't be destroyed when new scene will be loaded, usually objects there come from running them through DontDestroyOnLoad method somewhere in a script, however I noticed that some time ago Unity creators started to put there some stuff related to built-in tools (like debug)

Are scriptable object causing Unity Editor to lag?

So to make it simple, I am working with ScriptableObject in my project, all of a sudden i tried to add one more and the editor became so laggy that I can't keep working on the project it's way too annoying to handle...
I have creating a lot of ScriptableObject in my Unity project by hand. My program is quite simple, I just load my ScriptableObject from my Assets folder then do things with them.
I have mainly 3 types of ScriptableObject :
Extract (contains string, texture & audio)
Theme (contains a enum value & a list of Extract)
Oeuvre (contains a string & a list of Theme)
The data linked on the ScriptableObject are in another folder in Assets.
I tried to upgrade from Unity 2019.4.14f1 to 2020.3.4f1 and... nothing changed, too much lag to do anything correctly, it's like several seconds each time I click on a folder BUT the editor started to display a message while freezing (instead of not showing anything at all and just not responding) its says ProjectBrowser.OnGUI.repaint with a progress bar.
At this point I started to observe that the lags occured only while I was browsing some ScriptableObject in my project, when I want to edit some c# script or gameObject within the Scene the message never show up and the editor is smooth like before.
At this point I have around 200 ScriptableObject right now when the editor started to lag.
Maybe I am doing something wrong ? Is the problem coming from the ScriptableObject to reference each other ? Would be great if anyone could give me an hint :)
I am working with a project2D, if it can help...
Thanks in advance.
You can use Profiler to detect what causing problems and which object consumes how much time to render or calculate. You can find if ScriptableObject causing problems or not. You can look:
https://docs.unity3d.com/Manual/Profiler.html

Script is suddenly unable to find a GameObject in the scene

Last night I was working on my game, and everything seemed to be working perfectly. I added a sprite to my Assets/Sprites folder, then my laptop died. When I plugged it in and turned it back on, the GameObject.Find("Weapon Wheel") line in my PlayerControls script was no longer able to find the weapon wheel object. To my knowledge, no changes to the scene or any scripts were made.
Even stranger, my CommandPattern script also has GameObject.Find("Weapon Wheel"), and is able to find it perfectly fine.
Has anyone experienced the Find function suddenly not working, and if so, found a solution for it?
EDIT: Deleting the player prefab then replacing it with a new one fixed the issue, but I still have no idea why this happened in the first place.
I dunno how ur game is architectured and a direct solution but you can try to create a Gameobject variable in the Playercontrol class and then drag the weapon wheel in the field in the unity overlay

Text Mesh Pro UGUI Objects disappearing in Play Mode, Unity Version 2019.3.5fl Personal

So I have been stuck in this issue for awhile now: I get the error message: "Reference Exception: Object reference not set to an instance of an object" but that's because some of my text mesh pro objects gets deleted by itself!!! Apparently every single time I hit play some of the text mesh pro objects disappear from where it was assigned in the first place..
Code Implementation in the script class:
Example: This is how it look before play mode:
Now this is how thei nspector section looks like while on play mode:
Now once I hit play a few text mesh pro objects just got deleted by itself..
Any idea or feedback please?
Thank you in advance!
Amaury
Alright I see what is Wrong.
In the inspector, you set every Text Mesh Pro Object you need.
But in your script, you are using the function GetComponent on every of the object, which is useless and even buggy since you already declarate them in the inspector.
Remove these lines and it should work :)
EDIT: Also, for your interest, the function GetComponent will only return the first component found ATTACHED to the gameObject. But you don't have TMPText attached to your gameObject and more than that, you don't have MULTIPLE TMPText attached.