unity3d

How Best to Use UWP FullTrustProcessLauncher to Launch Seperate Unity Game

偶尔善良 提交于 2021-01-29 06:40:51
问题 I am working for a client who wants a UWP Portal App and a Pac-Man clone game that can be launched from inside the Portal App. I set up the FullTrustProcessLauncher capability in the UWP App to handle launch the exe for the game. I also had to add a post-build item to copy the exe and accompanying data folder to the AppX folder of the build. The FullTrustProcessLauncher fires the exe fine, but I keep getting the "Data folder not found error". So my questions are this: 1. Why does it keep

Changing color of of gameObject in Unity

烈酒焚心 提交于 2021-01-29 06:40:23
问题 Okay so I have this code. void Start () { gameObject.GetComponent<Renderer> ().material.color = Color.green; } I expected my gameObject to change its color to green. I imported it as black and in the inspector it has turned to green however in the actual application it does not appear as green. I cant use gameObject.renderer.material.color = Color.green since unity tell me its basically outdated and that I have to use the new version. This is going to be really simple but what am I missing?

C#/Unity Camera Follow Jitter due to Time.deltaTime

纵饮孤独 提交于 2021-01-29 06:32:09
问题 Game: In a simple 2D Portrait Game made in Unity, I have a GameObject (Player) that has a fixed location and which is moving upwards. The Camera follows the Player and animated Obstacles are spawning from time to time moving left to right. The attached Screenshot shows the Scene. The Problem: The Movement is not smooth, as it seems like the Player is jittering. I think I already identified one of the causes: Big variation of Time.deltaTime. Average value is 0.0167, but I had variations.

HTTP Method Not Allowed in REST API Post

℡╲_俬逩灬. 提交于 2021-01-29 05:00:36
问题 I am using UnityWebRequest to POST a string on the JSON that is accessible online. Unfortunately I am getting HTTP/1.1 405 Method Not Allowed error in Unity. It is definitely not the API key error otherwise I would get unauthorized message. I have seen some examples where PUT was used instead of POST, so I am not sure if what I am doing for POST here is right or not. Kindly help me out. IEnumerator POSTURL() { WWWForm form = new WWWForm(); form.AddField("ID", "Lemon"); using (UnityWebRequest

Line renderer is not working for android build game

陌路散爱 提交于 2021-01-29 04:50:37
问题 In my game when i run the game in unity editor in unity remote the linerneder shows like below But when I build it and run it in android device the linerender disappers like below code for line renderer is below: var targetObject : GameObject; private var lineRenderer : LineRenderer; function Start() { lineRenderer = GetComponent(LineRenderer); } function Update () { lineRenderer.SetPosition(0,this.transform.localPosition); lineRenderer.SetPosition(1,targetObject.transform.localPosition); } I

FindGameObjectsWithTag not returning objects

霸气de小男生 提交于 2021-01-29 03:24:06
问题 PREAMBLE /* I have recently started messing about with unity: made a beginner's pong game as most do and I've been trying to work with 3d objects now. My idea was to make a tower defense game, so I have a tower and a temporary target dummy. The tower has a script which should allow it to find the nearest object with the enemy tag and draw a line to it, but here is the issue:*/ My GameObject.FindGameObjectsWithTag("Enemy") function is returning an empty array, although there is a tagged,

Unity 5.2.1 Build crash on Application.Quit(); with Windows Touch

旧城冷巷雨未停 提交于 2021-01-28 22:19:49
问题 I am upgrading my Unity 4 project to Unity 5.2.1. I have used Application.Quit(); to close the app on a button click. This worked fine earlier(Unity 4) with Mouse and Touch both and now (Unity 5.2) also works fine with mouse click. But if I click the button using Touch (on Windows 8 or Windows 7 Touch screens) the app crashes. Then I tested by creating a new Unity project and added the cs file with the below code to the main camera. When I click this button with Touch it crashes. But doesn't

Continuously run code while UI button pressed

大憨熊 提交于 2021-01-28 21:22:27
问题 I am making a platform game in Unity, where the ball is moved with three buttons : move right move left jump I already have all the functions that work now, but to move the character i need to keep spamming a button, instead of holding it as i would want to . I have tried a few ways I found on tutorials but, as i am still a very beginner, i did not manage to make them work. This is the code of my Move2D script attatched to the character: using System.Collections; using System.Collections

C# Unity Raycast through an object without having to ignore it and still hit it

心不动则不痛 提交于 2021-01-28 18:21:15
问题 Esstinaly what I am trying to do is have a Raycast pass though an object and hit another object inside without ignoring the first object, so if the player has there mouse over the first object but not the second it will only hit the first object but if the mouse is over both it will hit only the second object, I can provide visual reference if possible it is only to display some text about said second object. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if

Can somebody please explain WaitForSeconds()?

折月煮酒 提交于 2021-01-28 15:26:44
问题 I am trying to make my code wait x seconds before doing something. I looked up how to do this, and found out about the WaitForSeconds() function. Unfortunately, whenever I try to use it I get red underlines in my code. I am trying to make it so when you die it waits a few seconds before you respawn: void Respawn() { yield return new WaitForSeconds(5); gameObject.transform.position = spawnPoint; } I also understand I need to put something like StartCoroutine(Example()); somewhere but I also