The manual used to include the unity .js syntax. It had stuff like the update function and OnTriggerEnter and OnMouseDown.
not really... the syntax for what? unityscript? c#? shaders? what functionality are you trying to get at? etc.
Hey big 12345, JS References: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference http://www.w3schools.com/js/js_syntax.asp Unity Script Reference: (Make sure the JS button is selected) http://docs.unity3d.com/ScriptReference/ I agree with SubZeroGaming's comment. -Drew
The "Manual" section only shows C#, however the Scripting API section allows you to use either or. Look it the upper right hand corner where you can select C# or JS. For example: http://docs.unity3d.com/ScriptReference/Animation.html
Can I ask like a random question? for something like transform.Translate(1, 1, 1)... which is forward, which is right, and which is up
I also can't find operators like say I want to use an if statement with ands and ors and equals or does not equal
Neither. it's transform.Translate(x, y, z); If you want to get the .forward it's a normalized direction that jus tells which direction your model is 'facing', so 0, 1, 0 would mean that you're facing straight up. It's the same as C# in that regard: And - && OR - || Equals - == NotEquals - !=
Q: Where can I find the official UnityScript/JavaScript language reference? A: It doesn't exist. Q: How is it possible? A:
Hey Dustin thanks for the link... this is what I'm working on. http://pastebin.com/TGUNmwU3 I would like to try the best I can to make it work using your link... meaning like the official syntax. I have it all as one script but I know it has to be in multiple scripts using different libraries.
Here's a quick conversion of that file: Code (CSharp): using UnityEngine; public class SomeScript : MonoBehaviour { public GameObject prefab; private float Health; private bool IsDead; private bool HasCorrectItem; private Texture Attack1; private Texture Attack2; private Transform Projectile1; private Transform Projectile2; private Transform DeadBody; private float Probability; private Transform transform; private void Awake() { transform = GetComponent<Transform>(); } private void Update() { // for movement if (Input.GetKeyDown("w")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("s")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("a")) transform.Rotate(0, 0, 0); if (Input.GetKeyDown("d")) transform.Rotate(0, 0, 0); if (Input.GetKeyDown("q")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("e")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("space")) transform.Translate(0, 0, 0); // for animation if (Input.GetKeyDown("w")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("s")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("a")) transform.Rotate(0, 0, 0); if (Input.GetKeyDown("d")) transform.Rotate(0, 0, 0); if (Input.GetKeyDown("q")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("e")) transform.Translate(0, 0, 0); if (Input.GetKeyDown("space")) transform.Translate(0, 0, 0); // for health and respawn if (Health < 0) { IsDead = true; } if (IsDead) { // transform.location(1, 1, 1) // No idea what this is IsDead = false; } // for spawning a dead body if (IsDead) { Instantiate(DeadBody, Instantiate(prefab, new Vector3(i*2.0F, 0, 0), Quaternion.identity); } // for making the dead body have a lootable item based off of probability } private void OnGUI() { // for the projectiles if (GUI.Button(new Rect(10, 70, 50, 30), Attack1)) Instantiate(Projectile1, Instantiate(prefab, new Vector3(i*2.0F, 0, 0), Quaternion.identity); if (GUI.Button(new Rect(10, 70, 50, 30), Attack2) && HasCorrectItem) Instantiate(Projectile2, Instantiate(prefab, new Vector3(i*2.0F, 0, 0), Quaternion.identity); // for an inventory // for looting the item off the dead body } // for clicking the dead body to change a variable // for subtracting health private void OnTriggerEnter(Collider other) { if (gameObject.tag == Projectile1.ToString()) { Health -= 1; } if (gameObject.tag == Projectile2.ToString()) { Health -= 2; } } } Two problems though: 1) where's the 'i' that's used in the methods coming from? 2) What are you trying to accomplish with the line "transform.location(1, 1, 1)"?
I messed up with where I have transforms for the part where it says // for animation... I also added something for checking for the correct item which I haven't figured out yet either and is just "// for checking to see if it has the correct item" http://pastebin.com/qrzx8x82 I have lots of parts where I just have "// and then an explanation" of what I want... but that I haven't figured out how to implement it yet.
Documentation for UnityScript doesn't exist. Unity has no plans to create the documentation. Most of the community have switched over to C#. There are some diehard UnityScript users, but their numbers are shrinking.
Thanks again Dustin How can I use OnMouseDown so that when I click a specific game object it spawns a variable?
Step 1: Click the button Step 2: Please go through the tutorials and Learn section as this will be a painful and slow process asking one basic question at a time.
Whatever I give up then... I need step by step instructions you can't just expect me to be able to dig through literally everything in the universe and find exactly what I'm supposed to do... it doesn't make sense... my questions are so basic too
Farewell. Hope you find a hobby more to your liking. For reference it wasn't everything in the universe. Just everything in the learn section.
more than half the time spent coding (any form of coding, not just unity stuff) is learning how new stuff works and working out why the stuff you have isn't working. You will need to get used to the feeling of "digging through literally everything" if you want to write code. The learn section has short, to the point, example driven, step by step tutorial vids with sample code. Broken down into individual aspects of unity and also entire game projects. If you are saying going through those are "too much" I really think you're looking at the wrong hobby. Alternatively you could try to hire someone to teach you; this is the wrong forum section for that though.
http://pastebin.com/BU23r7u4 Check it out again... its all finished... its very basic... I want to figure out how to make it multiplayer
congrats ok, a few suggested "look up this"... Input.GetAxis() and the input manager, so you don't have to hard code to specific keys and repeat so much in the input section http://docs.unity3d.com/ScriptReference/Input.GetAxis.html http://docs.unity3d.com/Manual/class-InputManager.html basically everything in the animation learn section, you are using the legacy animation system (it works, for now...) https://unity3d.com/learn/tutorials/modules/beginner/animation and again, everything in the new UI system learn section, OnGUI is the legacy old system which is more painful to work with once you start wanting to do anything "fancy" https://unity3d.com/learn/tutorials/modules/beginner/ui might want to think about breaking up the functionality into discrete components, health management, shooting, movement etc. Helps keep things tidy (good to learn when the scripts are still small) and means you can reuse code later without having to rewrite it.
http://pastebin.com/WzdCUMvJ I revised it a little bit. I would really like to see if there is a way I can make it multiplayer. The way I think it would work is that this script would be attached to a prefab of a 3d object with animation clips for strafeing and running etc. And then the clients would be given these prefabs almost like a character I would want to make lots of different characters which drop different items. As you can see in the script if you click on "DeadBody2" it makes a texture called "Loot2" while this script spawns DeadBody1.