Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'c#'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 90 results

  1. Hi guys, here is a simple script for car control which contains Gears (5) No REAR Yet Stop Lights Start / Stop Engine Fuel System [Fuel consumption in relation with RPM] RPM Editable controls Simple attach the script into your can then attach the camera the sounds and the lights.. //Script By DarkStudio [NightBird] //Version 1.0.0.0 BETA using UnityEngine; using System.Collections; public class Player : MonoBehaviour { //Variables public Light LeftStop; // Left Stop Point Light public Light RightStop; // Reght Stop Point Light public Transform Car; // Your Car Model public Transform MyCamera; // Your Camera float movespeed = 0.0F; public float fuel = 1000.0F; int gas_pedal = 0; public int health = 100; // Not Used YET int rpm = 0; int gear = 1; bool isengine = false; public KeyCode addgas = KeyCode.W; public KeyCode removegas = KeyCode.S; public KeyCode clutchkey = KeyCode.Space; public KeyCode gearup = KeyCode.UpArrow; public KeyCode geardown = KeyCode.DownArrow; public KeyCode nogear = KeyCode.Alpha0; public KeyCode firstgear = KeyCode.Alpha1; public KeyCode seccondgear = KeyCode.Alpha2; public KeyCode thirdgear = KeyCode.Alpha3; public KeyCode fourthgear = KeyCode.Alpha4; public KeyCode fifthgear = KeyCode.Alpha5; public KeyCode reargear = KeyCode.Alpha9; public KeyCode startengine = KeyCode.E; public KeyCode ChangeCameraView = KeyCode.C; public KeyCode SteerLeft = KeyCode.A; public KeyCode SteerRight = KeyCode.D; public AudioClip EngineStart; public AudioClip EngineStop; public AudioClip IdleSound; public AudioClip GasPressed; public AudioClip BreakSound; void OnGUI() { GUI.Label(new Rect(5, 20, 100, 20), "RMP : " + rpm); GUI.Label(new Rect(5, 35, 100, 20), "Fuel : " + fuel); GUI.Label(new Rect(5, 50, 100, 20), "Gear : " + gear); GUI.Label(new Rect(5, 65, 100, 20), "Engine : " + isengine); } void Update() { if (fuel <= 0) { isengine = false; rpm = 0; } if (Input.GetKeyDown(startengine)) { if (isengine == false) { if (fuel >= 1.50F) { isengine = true; fuel -= 1.5F; rpm = 1000; AudioSource.PlayClipAtPoint(EngineStart, Car.position); Debug.Log("Engine ON"); } else { Debug.Log("Not Enough Fuel!"); } } else { isengine = false; rpm = 0; Debug.Log("Engine OFF"); AudioSource.PlayClipAtPoint(EngineStart, Car.position); } } if (isengine == true) { //Fuel System if (rpm <= 1000) { fuel -= 0.025F; } else if (rpm > 1000 && rpm <= 2500) { fuel -= 0.5F; } else if (rpm > 2500 && rpm <= 4000) { fuel -= 0.8F; } else if (rpm > 4000 && rpm <= 5000) { fuel -= 1.0F; } else if (rpm > 5000) { fuel -= 1.9F; } //End Fuel //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Steer Syste if (Input.GetKey(SteerLeft)) { if (movespeed <= 0) { } else { if (movespeed > 0F && movespeed <= 50F) { Car.transform.Rotate(Vector3.down, 2F); } else if (movespeed > 50F && movespeed < 90F) { Car.transform.Rotate(Vector3.down, 1.3F); } else if (movespeed > 90F) { Car.transform.Rotate(Vector3.down, 0.9F); } } } if (Input.GetKey(SteerRight)) { if (movespeed <= 0) { } else { if (movespeed > 0F && movespeed <= 50F) { Car.transform.Rotate(Vector3.up, 2F); } else if (movespeed > 50F && movespeed < 90F) { Car.transform.Rotate(Vector3.up, 1.3F); } else if (movespeed > 90F) { Car.transform.Rotate(Vector3.up, 0.9F); } } } //End Steer //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Gas System if (Input.GetKey(addgas)) { if (gas_pedal <= 100) { if (movespeed <= 0) { if (gear == 1) { Car.transform.Translate(Vector3.forward * Time.deltaTime * movespeed); gas_pedal += 1; Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + fuel); Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + gear + " " + rpm + " " + fuel); AudioSource.PlayClipAtPoint(GasPressed, Car.position); } else { isengine = false; AudioSource.PlayClipAtPoint(EngineStop, Car.position); } } else { Car.transform.Translate(Vector3.forward * Time.deltaTime * movespeed); gas_pedal += 1; Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + fuel); Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + gear + " " + rpm + " " + fuel); AudioSource.PlayClipAtPoint(GasPressed, Car.position); } } else { Car.transform.Translate(Vector3.forward * Time.deltaTime * movespeed); Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + gear + " " + rpm + " " + fuel); AudioSource.PlayClipAtPoint(GasPressed, Car.position); } } else { if (gas_pedal > 0) { Car.transform.Translate(Vector3.forward * Time.deltaTime * movespeed); gas_pedal -= 1; Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + gear + " " + rpm + " " + fuel); } } if (Input.GetKeyDown(firstgear)) { gear = 1; } else if (Input.GetKeyDown(seccondgear)) { gear = 2; } else if (Input.GetKeyDown(thirdgear)) { gear = 3; } else if (Input.GetKeyDown(fourthgear)) { gear = 4; } else if (Input.GetKeyDown(fifthgear)) { gear = 5; } else if (Input.GetKeyDown(nogear)) { gear = 0; } if (Input.GetKey(removegas)) { LeftStop.enabled = true; RightStop.enabled = true; if (gas_pedal > 0.0F) { gas_pedal -= 1; AudioSource.PlayClipAtPoint(BreakSound, Car.position); } } else { LeftStop.enabled = false; RightStop.enabled = false; } //End Gas //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //RMP System if (gas_pedal >= 10 && gas_pedal <= 20) { switch (gear) { case 0: rpm = 3000; movespeed = 0.0F; break; case 1: rpm = 1800; movespeed = 8.0F; break; case 2: rpm = 1500; movespeed = 12.0F; break; case 3: rpm = 1200; movespeed = 5.0F; break; case 4: rpm = 1100; movespeed = 3.0F; break; case 5: rpm = 800; movespeed = 0.3F; break; case 9: rpm = 1700; movespeed = -9.0F; break; } } else if (gas_pedal < 10) { switch (gear) { case 0: rpm = 2000; movespeed = 0.0F; break; case 1: rpm = 1200; movespeed = 8.0F; break; case 2: rpm = 1000; movespeed = 12.0F; break; case 3: rpm = 800; movespeed = 5.0F; break; case 4: rpm = 400; movespeed = 3.0F; break; case 5: rpm = 200; movespeed = 0.3F; break; case 9: rpm = 1200; movespeed = -9.0F; break; } } else if (gas_pedal > 20 && gas_pedal <= 40) { switch (gear) { case 0: rpm = 5000; movespeed = 0.0F; break; case 1: rpm = 2800; movespeed = 14.0F; break; case 2: rpm = 2300; movespeed = 17.0F; break; case 3: rpm = 1800; movespeed = 24.0F; break; case 4: rpm = 1600; movespeed = 20.0F; break; case 5: rpm = 1200; movespeed = 15.0F; break; case 9: rpm = 2200; movespeed = -15.0F; break; } } else if (gas_pedal > 40 && gas_pedal <= 60) { switch (gear) { case 0: rpm = 7000; movespeed = 0.0F; break; case 1: rpm = 4500; movespeed = 18.0F; break; case 2: rpm = 2900; movespeed = 25.0F; break; case 3: rpm = 2400; movespeed = 35.0F; break; case 4: rpm = 2000; movespeed = 46.0F; break; case 5: rpm = 1700; movespeed = 56.0F; break; case 9: rpm = 4500; movespeed = -30.0F; break; } } else if (gas_pedal > 60 && gas_pedal <= 80) { switch (gear) { case 0: rpm = 9000; movespeed = 0.0F; break; case 1: rpm = 6500; movespeed = 24.0F; break; case 2: rpm = 4500; movespeed = 38.0F; break; case 3: rpm = 4000; movespeed = 75.0F; break; case 4: rpm = 3600; movespeed = 95.0F; break; case 5: rpm = 3000; movespeed = 120.0F; break; case 9: rpm = 4800; movespeed = -35.0F; break; } } else if (gas_pedal > 80 && gas_pedal <= 90) { switch (gear) { case 0: rpm = 14000; movespeed = 0.0F; break; case 1: rpm = 8700; movespeed = 32.0F; break; case 2: rpm = 7800; movespeed = 50.0F; break; case 3: rpm = 6700; movespeed = 106.0F; break; case 4: rpm = 4200; movespeed = 120.0F; break; case 5: rpm = 3800; movespeed = 140.0F; break; case 9: rpm = 5200; movespeed = -48.0F; break; } } else if (gas_pedal > 90 && gas_pedal <= 100) { switch (gear) { case 0: rpm = 17000; movespeed = 0.0F; break; case 1: rpm = 12700; movespeed = 42.0F; break; case 2: rpm = 8500; movespeed = 60.0F; break; case 3: rpm = 7400; movespeed = 126.0F; break; case 4: rpm = 5700; movespeed = 140.0F; break; case 5: rpm = 5200; movespeed = 180.0F; break; case 9: rpm = 8400; movespeed = -68.0F; break; } } //End RMP //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // AudioSource.PlayClipAtPoint(IdleSound, Car.position); } else { if (Input.GetKey(SteerLeft)) { if (movespeed <= 0) { } else { Car.transform.Rotate(Vector3.down, 0.4F); } } if (Input.GetKey(SteerRight)) { if (movespeed <= 0) { } else { Car.transform.Rotate(Vector3.up, 0.4F); } } LeftStop.enabled = false; RightStop.enabled = false; if (movespeed > 0) { if (!isengine) { Car.transform.Translate(Vector3.forward * Time.deltaTime * movespeed); movespeed -= 1.0F; Debug.Log("GAS PRESSED " + movespeed + " " + gas_pedal + " " + gear + " " + rpm + " " + fuel); } } } } }
  2. I need a survival game template multiplayer if someone have one plz contact me, thx
  3. Hi guys here is my inventory system written in C# and it comes with a simple GUI Skin with extra button skins Inventory script Pick up script Video : Functions Download the GUI.rar for the skin hope you like it GUI.rar
  4. Hi there! I am making a little fun game and i made a simple shoot and reload script for the game, so i wanted to share the script INSTRUCTIONS: 1). Create a C# script and call it PlayerShoot. 2). Remove everything in the script, and copy one of the scripts below(There's a Rigidbody and Raycast version) and paste it in the C# script you made. 3). Attach the script to the player. Rigidbody Version: Raycast Version: I have tested it, and it works fine You can attach the PlayerShoot script to the player. Remember the projectile has to have a rigidbody component or else it will throw a error(This is only if you use the Rigidbody version). If you have questions then ask EDIT1: I made some improvements. Added support for shoot and reload animation. Added a GUI label to show the ammo on the top left corner. Now you can't shoot while reloading. I think there's more but i can't remember. And you don't have to use animations, it's okay if you just leave it empty, btw the GameObject variable named "weapon" is only for the animations. So if you want to use animations you have to attach the GameObject that has the shoot and reload animation to the weapon variable ^^ Hope you enjoy, and you can always come with suggestions, like on what i could add more. EDIT2: Added a raycast version now Rigidbody Version Damage: 1). Make a seperate script and attach it to the projectile. 2). Open the script and do a OnCollisionEnter and check if the collision is the enemy or something and if it is then substract they health or anything else. Raycast Version Damage: 1). Find the DoDamage method(function) in script. 2). Replace what's in the DoDamage to what you like.
  5. SATORI

    Weapon Sway

    Hey guys. So it's been a while since I last released a script, so here's a very simplistic and compact, yet effective weapon sway script I wrote up in C#. It's by far the shortest weapon sway script I've seen on the internet (and written for that matter). It's quite different from other sway scripts in terms of the effect. It has my own little taste added to it. Just drag the script on to your weapon and you're all set. If the weapon flips, reset your axes. Enjoy!
  6. This is a Breakable Glass, i founded the scripts on the Unity Forum, edited some parts, converted to C# ( i use only C# ): (I Exported the Package from the FPSKit, should be usable on FPSKit by default. [Testing On FPSKit] Original Glass: thanks to drJones. II'll still remove some bugs... [Download Here] If you are missing something, you have any idea, or find a bug, reply this post.
  7. So, here is simple script for rotating objects with mouse. It may help someone new to Unity. Just attach this script to object that you want to rotate. using UnityEngine; using System.Collections; public class RotateObjectWithMouse : MonoBehaviour { public float sensitivity = 15F; float rotationX = 0F; void Update() { if (Input.GetMouseButton(1)) { rotationX += Input.GetAxis("Mouse X") * sensitivity; rotationX = Mathf.Clamp(rotationX, -360, 360); this.transform.Rotate(Vector3.up, rotationX); rotationX = 0; } } }
  8. Hey guys, here is a project i'm working for a while. It is an Ultimate Inventory System written in C#. Here are all the already implemented features : Inventory supports unlimited number of pick-able items. Inventory supports unlimited number of slots. There are two inventory mods available, the Slot mod and the Weight mod. Using the slot mod you can set up be default or even change at run-time the number of available slots. Using the weight mod you can set the maximum weight (even at run-time) that you can carry, then on each item there is a variable which will set the weight of each item. Supports different sounds for picking up / dropping / using an item or when you are full and you try to pick up items. Customizable key for toggling on/off the inventory. Auto toggle off after an amount of seconds. (You set the amount) You can use preview icon for items or just display the item's name. You can set an icon for empty slots or leave it displaying the text 'Empty'. You can drop items using double left click. You can use items by left clicking on them. You can edit the script 'UI_CustomActivation.cs' on the first void (Follow the comments) and apply your own activation code, to enable it check the 'Custom Activate'. Fully detailed custom inspector with comments to modify your inventory on your needs. Hotkeys "shortcuts" menu which can activate items by clicking them or using the shortcut keys which you can set from the inspector. You can hide empty slots on the hotbar. You can assign all the items for your inventory by dragging and dropping. You can see all the equipped items, and you can set starting items. You can select where the inventory GUI can be by choosing : Top Left , Top Right , Bottom Left , Bottom Right , Center Screen You can select where the hotbars GUI can be by choosing : Top Left , Bottom Left , Top Center, Bottom Center. All GUI positions are supporting different resolutions and aspect ratios. Scrollable gui for unlimited slots. A short video demonstrating some of the above features. Ultimate Inventory System Will Be Available On The Asset Store. Please let me know what you think. Please Check It Here : http://forum.unity3d.com/threads/ultimate-inventory-system-c.255768/
  9. Hey all, My first Udemy tutorial is online! This walks you through step-by-step on how to make a Tetris-like puzzle game. Gameplay scripting in Unity 3D is done in C#. There is a 50% discount available for anybody who enrolls this month: https://www.udemy.com/make-a-tetris-style-puzzler-in-unity/?couponCode=INDIEGAMEDEV This class is directed at independent game developers using the Unity 3D game engine. Feel free to pass the coupon out and post on social media. Thanks for everybody’s support!
  10. Can someone tell me how do i repeat something like a function each X second? Till now i ve been using something like this but it is not very "professional" private float totalTime = 3; private float countdown = 3; //I used this to repeat something each 3 sec void Update() { countDown -= Time.Deltatime; if(countDown <= totalTime) { countDown = totalTime; Debug.Log("Hello World"); } } Help please, im just a begginer
  11. Here are two scripts that i recently made, they are really basic so the gun can´t reload and it does have not a mag, but anyway, i wanted to share them to the forum Shooting.cs using UnityEngine; using System.Collections; public class Shooting : MonoBehaviour { private RaycastHit hit; AudioSource audiosource; public AudioClip shoot; void Awake () { audiosource = GetComponent<AudioSource>(); } void Update () { if (Input.GetMouseButtonDown (0)) { bang(); audiosource.PlayOneShot(shoot, 0.7f); } } void bang() { Vector3 myTransform = transform.transform.forward; Physics.Raycast (transform.position, myTransform, out hit, 50); if ((Physics.Raycast (transform.position, myTransform, out hit, 50)) && (hit.collider.gameObject.tag == ("enemy"))) { hit.collider.SendMessageUpwards("DoDamage"); print ("hit"); } } } EnemyHealth.cs using UnityEngine; using System.Collections; public class EnemyHealth : MonoBehaviour { public float EnemyHealthVar = 100; void Update () { if (EnemyHealthVar <= 0) { Debug.Log("ded"); Destroy(gameObject); } } public void DoDamage() { EnemyHealthVar -= 50; } } As im a begginer, please tell me if there is any error or anything that can be improved
  12. Hello I'm trying to take some components inside a prefav who is a Canvas, the prefav inside have two panels and, on each one of them, inside them, have 4 buttons, i want to access this buttons to try -somehow- to add the script to the OnClick() area and then, select a function, and add a variable if the function requiere it, so the questions are simple. How exactly i can access the panels and the buttons from C#? And then, how can i access the OnClick() selected script area of the buttons through C#? How can i from then get the function of that script through C#? And how i can, after that, bring a variable valu if the functin ask for it through C#? And also: What are exaclty at component level the panels?, i know they (i guess/heard) can't be selected like "Panels", so the question stands, whats exactly the type of component that a panel is?, it doesn't seem in the GameObject list than there is actualy a Panel type at all. This is what i have so far: . . . Canvas canvasPrefab = LoadSprite (); canvasPrefab.name = "canvasPrefab"; Instantiate(canvasPrefab, Camera.main.transform.position, Camera.main.transform.rotation); canvasPrefab.GetComponent (Canvas); //Not sure if this is right . . . Any comment, question or request for clarification will also be much apreciated. Thanks in advance
  13. Hey everyone, iv'e been looking for this type of answer for a long time, but i never got it, i don't know if i'm going to get it here either but i'll try Okey, so my question is, can anyone however make a long series on youtube on Multiplayer Tutorials for Unity3D? in C# please I have some things i wan't to cover up Guns: -A list of guns with it's own fire rate, sight position, and so on -Somewhere where you can customize your weapon -Then save the gun with the attachments -Different categories with guns and melees Others -Sniper rifle sight like in Call Of Duty -Host server (choose map, max players, gamemode, server password, server name) -Different gamemodes like Team Deathmatch, Free For All, Demolition, Domination and so on -Game money, get 100 points for each kill. -Save game money, buy guns with game money -In-game store, where you can buy money -Run server untill host puts it down, not if he turns of he's computer, but when he clicks on Pause Server or Stop Server -Custom server plugins. -Chat -Leaderboards -Killfeed -Login/Register with a Mysql database -save all player prefs to players account, then to the dataabse -save player cash to database, and altså receive cash from the database -Grenades, flashbangs and bomb planting -claymore -bazooka auto lock -sell items/weapons and receive game cash -level up , save level to database, and receive level from the database -When you come into e certain level, then a weapon will get unlocked, then you can BUY the weapon, not get it for free. -Firend list, Join Friends game, delete friend, give friends cash, search for players and add. -kill streaks. -create a squad/team/crew -Invite, accept and kick players out from your team if your the leader. Yeah, there are some more things, but i think this is it for now ?
  14. zombieqtr

    Project Ideas

    Hello there, i am trying to utilize my skills with unity3D and c# and improve them by creating projects, but surprisingly its almost impossible for me to think of a project idea that motivates me to work on it properly till the very end. It would be much appreciated if you could post some motivating ideas that i can work on and hopefully finish and showcase it in the forums. Thanks in advance!.
  15. Hi guys, fisrt of all, i have to say that i am learning C# so please dont be mean D: I was searching for a C# script to show an image while you are on a trigger. I have searched, but i only find JS tutorials. Please help
  16. http://www.m2h.nl/files/js_to_c.php Hi, Since this is one of my first EVER contributions to ANY forum whatsoever I am offering you something I found that can prove useful to some of you! =) That's the link above..
  17. Hello everyone!, here is a link to a video of a weapon system i am working on that is still a work in progress, i am looking for feedback mainly for the recoil and kick, i need your feedback to adjust it for maximum realism. Thanks in advance!, Kind Regards: Hamad Almannai Link to video: https://www.youtube.com/watch?v=CmmhNRT67Js&feature=youtu.be
  18. Hello! I made this script because i wanted splash screens, and the ability to skip them. And then i wanted to share it This script is based on the new GUI System, so i use Raw Image. I will try to add support for videos too EDIT: I read that it is possible to drag movie textures on to a raw image. I will test it sometime when i have a short vid on my pc ============================================= Features: ============================================= 1). Able to skip, 2). Multiple Splashes | Fades to the next one, if there's more than one ============================================= Instructions: ============================================= 1). Make a new scene. 2). Attach the script to a gameobject, doesn't matter which. 3). Add a Raw Image to the scene. 4). Drag the Raw Image into the Splash Screen slot. 5). Then add some Splash Screens. 6). Type the name of the level that is going to be loaded. ============================================= What does the variables mean?: ============================================= Splash Screen = The Raw Image that's used Load Level = Name of the level to load when finished Fade Time = How long time it takes to fade in/out Splash Screens = All the splash screens that is shown Splash Screens->Splash = The splash texture Splash Screens->Wait Time = Time before it fades out ============================================= Hope you like it SplashManager.cs:
  19. Hi There Hi guys. ( I don't know what I should write xD) My name is weard.. Zdzislaw ( corectly is Zdzisław) and I'am 16 years old. I'm interested in programing and making games, reading and so on But i need to say it :/... I'am weak programer ( very weak ) You will ask why? Becuse the onlies thing ( is that corect?) what I can write without thinking that it won't work is a script for loading level when sth is clicket by mouse button xD. And here I need to ask you guys to help explain me some things in C# programing like: what the hall is "string" and "args"? o.o xD I prefer to contact by skype 'Couse my computer is very weak and when i'm using 2 applications is getting laggy :/ That would be enought for now xD But please don't thing on me that i am next noob becouse I really want to be a good programer and for that I'am lerning something from making my first own game with some tutorial fro YT and unity site xD . But I feel bad with this I'am using a tutorial and I don't know why xD So guys would you help me with explaing this 'easy' language witch is C#. And don't be angry on me becouse of my bad english ( yes i know that xD). P.S in topic should be a 'greetings' not a ' greeting'
  20. Hello, my friends I bring to you a great script console for your game. Hope you like it.
  21. Hi there! I'm new to Unity and having trouble figuring out this issue, there is clearly a huge gap in my understanding. What I'm trying to do is to create "distance floats" by calculating the distance between the 6 game objects and my player object. I then want my PdDataHandler Script to print these to the console (and maybe send these values as OSC messages). If this seems silly or counter-intuitive to anyone, please push me in the right direction!! My googling revealed that the problem is related to attempting to call on things that are a part of a class instead of an object but I still don't really understand. Any help would be greatly appreciated. edit: I should also mention that the Player and WhitePetalFlower exist on their own object scripts (WhitePetalFlower's script only defines it as a class, nothing more) using UnityEngine; using System.Collections; public class PdDataHandler : MonoBehaviour { public float WhitePetalFlowerDist; public float BluePetalFlowerDist; public float RedPetalFlowerDist; public float WhiteRoundFlowerDist; public float YellowRoundFlowerDist; public float PinkRoundFlowerDist; void Start () { } void Update () { WhitePetalFlowerDist = Vector3.Distance (Player.transform.position, WhitePetalFlower.transform.position); print("Distance to WhitePetalFlower: " + WhitePetalFlowerDist); BluePetalFlowerDist = Vector3.Distance (Player.transform.position, BluePetalFlower.transform.position); print("Distance to BluePetalFlower: " + BluePetalFlowerDist); RedPetalFlowerDist = Vector3.Distance (Player.transform.position, RedPetalFlower.transform.position); print("Distance to RedPetalFlower: " + RedPetalFlowerDist); WhiteRoundFlowerDist = Vector3.Distance (Player.transform.position, WhiteRoundFlower.transform.position); print("Distance to WhiteRoundFlower: " + WhiteRoundFlowerDist); YellowRoundFlowerDist = Vector3.Distance (Player.transform.position, YellowRoundFlower.transform.position); print("Distance to YellowRoundFlower: " + YellowRoundFlowerDist); PinkRoundFlowerDist = Vector3.Distance (Player.transform.position, PinkRoundFlower.transform.position); print("Distance to PinkRoundFlower: " + PinkRoundFlowerDist); } }
  22. hey i'm a noob but know the basics of C# and i only got Unity free. i'm working on a school project and we got no idea what we are doing mostly, anyway i'm trying to make a security camera in the game that shows another location in the level on a monitor, kind of like this the sits at the desk and has 5 monitors below him that show other areas of the level. now i can get the textures to render on a plane but i cant assign the texture to a specific camera so it only shows the player cam. me and my friends are willing to learn because we need this script because its a major part, any suggestions are welcome even if it requires a different script. this is where i found the script but i have no idea what it does really. http://pastebin.com/Qvw01kcM
  23. Hi Armedunity ! , recently i was getting bored from js ( unityscript ) and i wanted to learn some C# basics ... i watched all the unity3d website's tutorials but it doesn't help so please anyone got some nice tutorials about c# ( with unity syntax ) , i wont some basics programming tutorial of just understanding the basics , i want some c# tutorials connected with how to apply the codes to use for game developpement , and sorry for my bad english ^^ hope that someone can help and understand me :c
  24. It is pretty easy to make one. but I wanted to share this for the beginners out there (like me) I made this to learn and I hope others can learn from this code Make a new c# script called HideCursor then open it and paste this code add it to any object in your scene and your good to go using UnityEngine; using System.Collections; public class HideCursor : MonoBehaviour { // Use this for initialization void Start () { Screen.showCursor = false; Screen.lockCursor = true; } // Update is called once per frame void Update () { if (Input.GetKeyDown (KeyCode.Escape)) Screen.showCursor = true; if (Input.GetKeyDown (KeyCode.Escape)) Screen.lockCursor = false; if (Input.GetMouseButtonDown (0)) Screen.lockCursor = true; if (Input.GetMouseButtonDown (0)) Screen.showCursor = false; } }
  25. Hey guys, you can subscribe for free using only your email address at : http://greekstudios.url.ph/wp/greekstudios-xmas-gifts/ and claim a free copy of Ultimate Inventory & Crafting. The winner will be randomly chosen at 01/01/2015
×
×
  • Create New...