unity5

Pass parameters to WebClient.DownloadFileCompleted event

梦想的初衷 提交于 2019-12-10 18:56:48
问题 I am using the WebClient.DownloadFileAsync() method, and wanted to know how can i pass a parameter to the WebClient.DownloadFileCompleted event (or any other event for that matter), and use it in the invoked method. My code: public class MyClass { string downloadPath = "some_path"; void DownloadFile() { int fileNameID = 10; WebClient webClient = new WebClient(); webClient.DownloadFileCompleted += DoSomethingOnFinish; Uri uri = new Uri(downloadPath + "\" + fileNameID ); webClient

Unity: Do I have to learn one, or both (C#, UnityScript)

懵懂的女人 提交于 2019-12-10 18:22:43
问题 I originally thought that one had to know both C# as well as UnityScript to develop using Unity. But it now seems that I only need to know one. So, Do both the languages do similar things and hence I should code in one, or should I learn them both as I'm supposed to use both? Does Unity only use C# and/or UnityScript cuz I always thought games had to use at least 2, even in Wikipedia, it's written as if it's a definition or something. (I know some games can be made solely using pygame and

Editing a Cubemap Skybox from remote image

陌路散爱 提交于 2019-12-10 16:55:49
问题 I need to download an image from a server, then transform it in a Cubemap and finally put this CubeMap in my Skybox. I work with C#. I came up with this code : public string url = "image/url.jpg"; void Update() { // When trigger, we start the process if (Input.GetKeyDown("f")) { // start Coroutine to handle the WWW asynchronous process StartCoroutine("setImage"); } } IEnumerator setImage () { Texture2D tex; tex = new Texture2D(2048, 2048, TextureFormat.RGBA32, false); WWW www = new WWW(url);

Monodevelop iOS Unity Cannot Connect to Debugger

大兔子大兔子 提交于 2019-12-10 16:16:47
问题 I'm struggling to get my iOS app debugging with monodevelop. The mac is connected to the same network as the iPad running the app and it shows up in the attach to process window so it is discoverable. The firewall is also turned off and the iPad does not have cellular network capability. When I try to connect I get a "could not connect to debugger" message. Does anyone have any ideas? I've been doing lots of googling but can't find any answers. 来源: https://stackoverflow.com/questions/37611558

How To Capture the color from screen in mouse position using Unity and C#?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 12:24:37
问题 I did not find a direct function in Color section or since there is no direct C# Unity function for picking the color from post render. How is the best approach for picking the color in the mouse position? I have done research and looks like there is posible to make a screenshot and then look into the texture calculating the mouse position. Input.GetMouseButtonDown(0) Application.CaptureScreenshot("Screenshot.png"); // get the color pixel in the same coordinates of the mouse position Vector3

How do the Unity private awake update and start methods work?

雨燕双飞 提交于 2019-12-10 10:46:37
问题 How does Unity call the Awake, Update, and Start methods behind the scene? That they have no access modifier to me indicates they are private methods, and they don't use anything like new or override, so how does the Unity framework find the methods to call them? On a related question, is there any particular reason virtual methods were not used? Edit: For those unfamiliar with Unity scripts, this is how they generally appear: public class MyClass : MonoBehaviour{ void Start(){ } void Awake()

UNET Multi-Player game, having both players interact with gameObject, changes synchronized on host and client

梦想的初衷 提交于 2019-12-09 23:16:22
问题 I want to create a simple demo. I want there to be a cube, in the middle of a plane, that changes colors when you click it. (This was easy to implement) I want there to be two players, who take turns clicking the cube. The cube will only change colors if it is your turn. If the cube changes colors, the change will reflect on both the players' screens. I've been looking at the examples for UNET, http://forum.unity3d.com/threads/unet-sample-projects.331978/, and most of them have a networked

Xbox one dev mode and Unity free version

痞子三分冷 提交于 2019-12-09 13:15:24
问题 I have a retail Xbox one console with Dev Mode activated Unity (latest free version) and a MSDN individual developer account. I am able to deploy test apps from Visual studio on the Xbox however i want to know how do i build and run apps on Xbox from Unity? I contacted unity and they said i need approval from my account manager however I'm an individual developer. What I want to do is deploy from Unity to Xbox one I'm running parallel from a Mac (Windows 10 version) but Unity is installed on

Properly attach to a GameObject after collision?

ε祈祈猫儿з 提交于 2019-12-08 19:18:58
问题 How can I properly make a GameObject attach (or "stick") to another GameObject after collision? The problem: I want the GameObject to attach after collision even if it is changing scale. "Attach on collision" code: protected Transform stuckTo = null; protected Vector3 offset = Vector3.zero; public void LateUpdate() { if (stuckTo != null) transform.position = stuckTo.position - offset; } void OnCollisionEnter(Collision col) { rb = GetComponent<Rigidbody>(); rb.isKinematic = true; if(stuckTo ==

Mouse up vs. touch up in Unity

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 11:56:33
问题 I have a bit of an issue. I can't seem to find a good way to distinguish whether Unity is firing a mouse up vs. a touch up event. By touch up I mean when the user releases their finger from the screen after touching something on a touch display. The problem is this: I have an issue with game logic where the user both lets go of something they've selected with their mouse and SIMULTANEOUSLY touches / releases their touch to click a UI button (in other words, I'm trying to detect a mouse