unityscript

Using yield WaitForSeconds

二次信任 提交于 2021-02-16 18:18:32
问题 I might be asking something that's extremely obvious and I have overlooked something, but I'm trying to create a pause before it does something. I have seen this being used in many places online - yield WaitForSeconds(2); However I get a syntax error of, "Error CS1528: Expected ; or = (cannot specify constructor arguments in declaration) (CS1528) (Assembly-CSharp) Which confuses me as im not really sure what yield as a keyword really means or does, and im under the assumption that

Using yield WaitForSeconds

折月煮酒 提交于 2021-02-16 18:18:27
问题 I might be asking something that's extremely obvious and I have overlooked something, but I'm trying to create a pause before it does something. I have seen this being used in many places online - yield WaitForSeconds(2); However I get a syntax error of, "Error CS1528: Expected ; or = (cannot specify constructor arguments in declaration) (CS1528) (Assembly-CSharp) Which confuses me as im not really sure what yield as a keyword really means or does, and im under the assumption that

Shuffle array in Unity

假装没事ソ 提交于 2021-02-05 08:50:08
问题 I want to shuffle the numbers in my array variable once, so I called my Shuffle method from Start() . I then attempt access the shuffled array from update, but I am unable to do so. How can I access it? Is there any other way to shuffle my array once, then use it forever? private System.Random _random = new System.Random(); float sec; float timecount; float starttime; void Start () { starttime = Time.time; int[] array = { 1, 2, 3, 4, 5, 6, 7, 8}; Shuffle(array); foreach (int value in array) {

Iteration with variable name [duplicate]

有些话、适合烂在心里 提交于 2020-06-02 17:06:18
问题 This question already has answers here : Variables in a loop (9 answers) Loop through object variables with different number on the name [duplicate] (5 answers) Closed 29 days ago . Is it possible to make iteration from variables in c#? i have variables public Transform dest1, dest2, dest3, dest4,... and public StudentScript stu1, stu2, stu3, stu4, ...; and what i want is if collide with student1 then agent go to dest1 and callscript from stu1, if student2 then dest2 and stu2... if (Physics

Iteration with variable name [duplicate]

情到浓时终转凉″ 提交于 2020-06-02 17:06:06
问题 This question already has answers here : Variables in a loop (9 answers) Loop through object variables with different number on the name [duplicate] (5 answers) Closed 29 days ago . Is it possible to make iteration from variables in c#? i have variables public Transform dest1, dest2, dest3, dest4,... and public StudentScript stu1, stu2, stu3, stu4, ...; and what i want is if collide with student1 then agent go to dest1 and callscript from stu1, if student2 then dest2 and stu2... if (Physics

Can JavaScript be expressly used to develop Unity games?

北城以北 提交于 2020-02-13 12:58:26
问题 I would like an authoritative answer on a point that has been a question mark for me for a little while. There seems to be a frequent use of the term JavaScript to mean or describe UnityScript. I have been told time and again that you can use actual JavaScript to develop games in Unity, however from what I understand UnityScript could, at best, be described as a superset of JavaScript, but there really are some items that perhaps aren't completely compatible and you can't simply use JS as you

UV unwrap on Runtime optimization

谁说我不能喝 提交于 2020-02-05 03:38:43
问题 I'm trying to create UVs @ runtime, I'm using a BOX type UVs (similar to BOX UVW in 3ds max) and based my calculation on the face orientation. I know it's not a good option to create it a runtime but I have no choice :( it's saved after calculation, so I made it once. BUT I take 40 seconds for a 30000 Vertices... too long Is there any optimization in my code that can be made? . Here is my code feel free to use if you have <5000 vertices Mesh: public static void CreateUV(ref Mesh mesh) { int i

UnityScript vs Javascript [closed]

有些话、适合烂在心里 提交于 2020-01-24 05:20:26
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I know there's a difference between the languages, such as classes etc. What I wonder is this: If UnityScript is different from Javascript, why does the Unity3D documentation give you the options to pick between C# and JS when you look through it? Shouldn't it be a choice

2D basic movement UNITY

…衆ロ難τιáo~ 提交于 2020-01-22 03:41:29
问题 Currently my character works perfectly on the keyboard, but when I convert your movements to touch, through 3 UI Buttons (i tried UI image too, but success) i'm not succeeding It basically goes to the right, left, and jumps. How should do to make it follow these instructions: When the user presses directional, the character does not stop walking until the user user releases the button, and when you press the jump player jump. This is the script I use to move through the keyboard! using

2D basic movement UNITY

眉间皱痕 提交于 2020-01-22 03:40:49
问题 Currently my character works perfectly on the keyboard, but when I convert your movements to touch, through 3 UI Buttons (i tried UI image too, but success) i'm not succeeding It basically goes to the right, left, and jumps. How should do to make it follow these instructions: When the user presses directional, the character does not stop walking until the user user releases the button, and when you press the jump player jump. This is the script I use to move through the keyboard! using