unity5

Best way to save data in Unity game [closed]

浪子不回头ぞ 提交于 2019-11-28 17:40:48
I was wondering... What's the best way to save data in Unity games. JSONs? If so, how? Thanks Short answer to your long question! Here are some of the different Ways and Methods to Save data for Unity Projects: Platform-Independent: One way of saving data in Unity3D in a Platform-independent way is to use the PlayerPrefs class. (Learn More 1 , 2 ). PERSISTENCE - SAVING AND LOADING DATA using DontDestroyOnLoad , PlayerPrefs , and data serialization Video Tutorial by unity . Server Side: You can also use a Server for saving data (like combination of PHP and MySQL Database). You can use it to

When I run the game scene on unity my panels dissappears

人走茶凉 提交于 2019-11-28 11:48:05
问题 Here is the error video youtu.be/r6m_RVFw7tA There is no code only panels and buttons. If you need anything else then please comment.. Unity file : https://www.dropbox.com/s/fvxxjod1bs52u92/first.unity?dl=0 回答1: The far clipping plane of the camera is not far enough to cover the UI position. Set it to 3000 . If that doesn't work, bump it up more. far clipping plane of, 3000 seems to work fine in your case. For perfect alignment of your camera, you need to reset its y-axis rotation to 0 then

Reloading XML asset in Unity

我与影子孤独终老i 提交于 2019-11-28 10:36:23
问题 I am storing the progress of the game in XML file. Since the player can choose the round they want to play, but not repeat a round once completed. The files are being editted and updated correctly, however, the changes are not reflecting inside the game until i restart the game. I had been using AssetDatabase.ImportAsset() until now, but i need an alternative for android export. 回答1: The good news: in Unity it's extremely easy to save/read text files. The key point... You must use Application

How do I sync non-player GameObject properties in UNet/Unity5?

百般思念 提交于 2019-11-28 09:26:25
I'm working on and learning some basics of Unity 5, UNET, and networking. I made a simple 3D game where you go around and change the colors of objects. But I want to make it multiplayer now, and I am having lots of trouble figuring out how to send the changes over the network so all players can see a single player's color change. Part of the issue is that it has been difficult to find the answer using the newer UNET networking engine. And sometimes I come across answers that are for the older way. So the main question is, how do I network non-player GameObject property changes? Color, shape,

Use .NET's own httpClient class on Unity

烈酒焚心 提交于 2019-11-28 08:36:39
问题 I'm trying to do a HTTP Delete request from Unity and bump into the idea of use the HttpRequest class included in the System.Web namespace of .Net How can I achieve this, I supose that some sort of import of that namespace must be done, but how? Hope some one can give me some orientation 回答1: HttpClient is only available in 4.5 NET and above and Unity does not use that version. Unity uses about 3.5 .NET version. If you are using Unity 5.3, UnityWebRequest.Delete can be used to make a Delete

Unity: How to dynamically attach an unknown script to a GameObject (custom editor)

前提是你 提交于 2019-11-28 05:43:39
问题 I'm currently making a system for the Unity Editor (custom inspector and custom windows) that will automate and make things easier for the artists working on the game we're making, but I've hit a brick wall. I'm trying to find a way to dynamically add, through an editor Textfield input and a GUI button, an unknown script to a gameobject in the scene. The artist/programmer will type the name of the script in the textfield and it will search and add to a gameobject, but I don't know how to

Get current frame Texture from VideoPlayer

房东的猫 提交于 2019-11-28 05:34:43
问题 It is stated in this post Using new Unity VideoPlayer and VideoClip API to play video that one can "retrieve texture for each frame if needed" What's the proper way to get the current frame as a Texture2D, please? EDIT: After the answer I did this but it's not working: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Video; public class AverageColorFromTexture : MonoBehaviour { public VideoClip videoToPlay; public Light lSource; private Color

DropDown GUI (resolution) issue Unity 3D

偶尔善良 提交于 2019-11-28 02:21:15
http://imgur.com/UNR6nNS Check the link for details. When I'm running my app (that contains the DropDown feature) on my Android Phone, the dropdowns that apears from DropDown menu is really small, even tiny. I tried to set resizeTextForBestFit and resizeTextMinSize/maxSize + change Rect.height of ViewPort (where the dropdowns placed) but it doesn't work. The Scroll Rect on Dropdown List controlling the size. So how can I fix this issue? Always choose "Screen Space - Overlay" and "Scale with screen size" It's just one of those weird things about Unity ... 99.9% of the time you use that setting.

How to call method and return its value with UnityPlayer.UnitySendMessage

倖福魔咒の 提交于 2019-11-28 00:44:02
问题 How can I call this C# method from Java then return the string value? public string getTest () { return "test"; } This is what I've tried: String str = UnityPlayer.UnitySendMessage("ProfileSave", "getTest",""); I am getting the below error String str=UnityPlayer.UnitySendMessage("ProfileSave", "getTest",""); ^ required: String found: void 回答1: UnityPlayer.UnitySendMessage is a void function and does not return a value. Take a look at the UnitySendMessageExtension function implementation below

In Unity, how to tell if it's the first time a game is being opened?

佐手、 提交于 2019-11-27 14:52:20
I want a script to run, whenever my game in Unity is opened for the first time. Use PlayerPrefs . Check if key exist. If the key does not exist, return default value 1 and that is first time opening. Also, If this is first time opening set that key to 0 so that if will never return 1 again. So any value that is not 1 means that it is not the first time opening. In this example we can call the key FIRSTTIMEOPENING . if (PlayerPrefs.GetInt("FIRSTTIMEOPENING", 1) == 1) { Debug.Log("First Time Opening"); //Set first time opening to false PlayerPrefs.SetInt("FIRSTTIMEOPENING", 0); //Do your stuff