unityscript

How can I address a script I don't know the type of?

血红的双手。 提交于 2019-12-20 05:15:16
问题 My game uses a variety of different game modes, and I'd like to spawn a different GameController script at the beginning of the scene depending on the game mode selected. Then other items (e.g., Enemies), would reference the main GameController, whether that be GameController_Mode1, GameController_Mode2, etc. But how can I have other objects referencing this if I don't know the type? Unity iOS requires strict unityscript typing, so I can't use duck typing to get around this. 回答1: You can do

Unity. Function call after a certain period of time

耗尽温柔 提交于 2019-12-19 19:41:09
问题 How can I make an object invisible (or just delete) after a certain period of time? Use NGUI. My example (for changes): public class scriptFlashingPressStart : MonoBehaviour { public GameObject off_Logo; public float dead_logo = 1.5f; void OffLogo() { off_Logo.SetActive(false); } //function onclick button //remove item after a certain time after pressing ??? void press_start() { InvokeRepeating("OffLogo", dead_logo , ...); } } 回答1: Use Invoke rather than InvokeRepeating. check Invoke function

Unity. Function call after a certain period of time

谁说我不能喝 提交于 2019-12-19 19:37:43
问题 How can I make an object invisible (or just delete) after a certain period of time? Use NGUI. My example (for changes): public class scriptFlashingPressStart : MonoBehaviour { public GameObject off_Logo; public float dead_logo = 1.5f; void OffLogo() { off_Logo.SetActive(false); } //function onclick button //remove item after a certain time after pressing ??? void press_start() { InvokeRepeating("OffLogo", dead_logo , ...); } } 回答1: Use Invoke rather than InvokeRepeating. check Invoke function

Can I use Java script language in Unity3d 2017.2?

泄露秘密 提交于 2019-12-19 18:23:51
问题 I notice that in MonoDevelop editor the auto correction for javascript it doesn't work . Does this mean that Unity is willing to abandon JS ? Can I use Java script language in Unity 2017.2 ? 回答1: Yes , you can still use it in Unity 2017.2. The menu to create a Javascript script is gone . You have to create a Javascript file with an external file Editor like Notepad then drag it into your Unity project and it should just work. It should have .js extension. Note that Unity is in the process of

Unity - How to respawn a Gameobject after destroy

大憨熊 提交于 2019-12-19 10:18:38
问题 I'm Using unity for developing my game. I've created a simple game just like football after scoring a goal the ball should be destroyed and then reappear at its original place. I've attached this script to my goal object. public GameObject ball; Vector3 ballPosition = new Vector3 (4.51f,0.10f,-3.78f); void OnTriggerEnter(Collider other) { StartCoroutine ("RespwanBall"); } IEnumerator RespwanBall() { GameObject clone = (GameObject)Instantiate (ball, ballPosition, Quaternion.identity) as

Flip Normals in Unity 3D/spheres

若如初见. 提交于 2019-12-18 18:13:13
问题 I've written this code for my game and what I want is to flip the normals on a texture in unity. I have a model and a texture and wish for the texture to be inside the sphere model and not on the outside. I want to create a 360 panoramic effect by moving the camera around the images inside the sphere on top of the flipped texture. Now, when I first hit the play button, it works perfectly, but then, when I stop it and want to play again, I don't see the board and neither the surroundings. It

Is Unityscript/Javascript discontinued?

吃可爱长大的小学妹 提交于 2019-12-17 06:57:27
问题 I am using Unity 2017.2.0b5 . I tried to help somebody who asked a question about Unityscript few moments ago but I noticed that: Assets > Create > C# Script is present but Assets > Create > JavaScript is missing. This is also missing from the Project tab and the Create new script menu which is on the Add Component menu. I read the release note but couldn't find anything about Unityscript/Javascript. Has Unity just killed Unityscript/JavaScript support like Boo? 回答1: According to some

Drawing 3D polygon on unity 3d

丶灬走出姿态 提交于 2019-12-14 01:10:41
问题 I am trying out unity for a project that i am on. I am attempting to draw 3D polygon from a set of coordinate that I have. So what i am doing now is to build a row of cube btw the two points. I plan to build these points into either a solid shape or just "walls" to form a room. However, it doesn't seem to work as expected. Please advise. drawCube( Vector3(10,0,14),Vector3(70,0,14)); drawCube( Vector3(90,0,14),Vector3(60,87,45)); function drawCube(v1,v2) { pA = v1; pB = v2; var plane :

Change value of Transform variable in Unity

 ̄綄美尐妖づ 提交于 2019-12-13 21:07:02
问题 I have a camera which follows a car when a player is driving. The issue is the car : transform variable in the UnityScript looks like this var car : Transform; Which means I would have to drag the transform onto the little box in the side panel to assign it. Is it possible to assign this variable within the code like: var car : Transform = Player1; //BTW Player1 is the transform I want The reason why it needs to be changed is in the code I want it to change between Player1 Player2 Player3

Making Cursor Mouse Always Enabled In Unity CardBoard Plugin

时光总嘲笑我的痴心妄想 提交于 2019-12-13 09:36:48
问题 i think the title is clear , i want to make the mouse Cursor which is set in GazeInpuModule to be always enabled and in center of the both Left And Right Cameras , can anyone help me ?! ive tried changing the GazeInputModule code to place the cursor in center , but got nothing ! 回答1: Here's what worked for me: Create a Cursor GameObject in the Head hierarchy Add EventSystem in the project hierarchy In the EventSystem Gaze Input Module component, ensure "Show Cursor" is selected. In