unityscript

Unity built-in Packages Compiler Errors

半腔热情 提交于 2019-12-11 03:38:19
问题 I just started learning how to use Unity to make a simple 3D game. It's working fine when it comes to creating the environment, but once I imported the built-in Character package it gave me a compiler error and wouldn't run (All compiler errors have to be fixed before you can enter playmode!). Removing the imported package removes the error and it can run, I tried using other built-in packages like 2D or Cameras but same problem occurred. After adding 2D package, here's the console (error

Open Facebook App via Unity Script on Android?

不想你离开。 提交于 2019-12-11 00:59:16
问题 I want to ask if there is a way to open the Facebook App instead of opening the Site on Browser. Im using Unity with C#. I tried the following Code but it won´t work for me: IEnumerator OpenFacebookPage() { Application.OpenURL("fb://hatchthepokeggofficial/"); yield return new WaitForSeconds(1); if (leftApp) { leftApp = false; } else { Application.OpenURL("https://www.facebook.com/hatchthepokeggofficial"); } } It opens the App but I don´t land on the Site. 回答1: Yes You need to use your Page ID

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

How to record the screen in Unity and make output as a file [closed]

不打扰是莪最后的温柔 提交于 2019-12-10 14:35:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 months ago . Is there any method, such as coding or using a free asset to make screen recording function in my game. I'm working on Unity and my project needs to provide a replay when I am playing my game and make the output of that replay as a file. Thanks in advance. 回答1: You can check out our open-source project: https:/

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

colon in variable declaration

瘦欲@ 提交于 2019-12-10 10:43:08
问题 I'm going through some Unity tutorials and came across this line of code in one of the sample scripts. I'm familiar with javascript but I have never seen the colon used when declaring a variable except for object literals. var controller : CharacterController = GetComponent(CharacterController); What is the colon doing in this line. at the end of the script there is this other line of code that might be relevant @script RequireComponent(CharacterController) Here is the full sample code from

Raycasting to find mouseclick on Object in unity 2d games

此生再无相见时 提交于 2019-12-09 04:22:20
问题 I am trying to delete the object on which the mouse is clicked. I am making a 2D game using the new Unity3D 4.3. Here is the code I'm using void Update () { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray,out hit)) { isHit = false; Destroy(GameObject.Find(hit.collider.gameObject.name)); } } } The control is not entering the inner if loop. ( isHit is not being set as false). 回答1: You cannot use 3D physics

How to do “highlighting” on gameObject

会有一股神秘感。 提交于 2019-12-08 12:46:25
问题 I'm making an block-like game and now I want to implement highlighting block (gameobject) while there is mouseOver that specific block. I tried something like this (I'm not sure that this is best way to do this, but it's only one I got idea for): #pragma strict public class BlockSelecting extends MonoBehaviour { public var hovering : boolean = false; public var xpos : float; public var ypos : float; function Start () { } function Update () { } function OnMouseExit () { hovering = false; }

How to get/change Image Source name with code in Unity?

你说的曾经没有我的故事 提交于 2019-12-08 03:45:18
问题 we made a script and need to get the image name, we implement this task with a clumsy way below, but we still want to know whether there is a way to get the image name directly? public class CubeManager { static public Dictionary<CubeType, string> cubeTypeDict = new Dictionary<CubeType, string>(); static private Dictionary<string, GameObject> cubeDict = new Dictionary<string, GameObject>(); static CubeManager() { cubeTypeDict.Add(CubeType.Wall01, "Wall01"); cubeTypeDict.Add(CubeType.Wall02,

Writing RTL in input field

。_饼干妹妹 提交于 2019-12-08 03:04:23
问题 I'm trying to write Persian in unity input fields. Persian is right to left language and it's alphabet is similar to Arabic. I've found a library that converts and corrects the text. It's works just fine. When I'm showing the converted text into Debug.Log() everything is perfect but the problem is when I'm going to put corrected text into input field it would be reversed! I've tried to reversed the input field text but nothing happened! Here's my code public InputField empName; PersianMaker