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 'disable'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
    • 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


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL





YouTube URL

Facebook URL

Twitter URL

IndieGoGo URL

Kickstarter URL


GreenLight URL



Found 3 results

  1. Hey, i'm new to the unity engine and have a sphere to walk on. the gravity is pulling the player onto the ground. You can watch by moving the mouse around. I wanted to make the player being able to jump just 1 time. So i used the if statement to disable jumping again while jumping. But it doesn't work, even with if, i can jump whenever i want to. Can some1 solve this =? Here my code: public float mouseSensitivityX = 250f; public float mouseSensitivityY = 250f; public float walkSpeed = 4f; public float jumpForce = 220; public LayerMask groundedMask; private Transform cameraT; private float verticalLookRotation; private Vector3 moveAmount; private Vector3 smoothMoveVelocity; private bool grounded; private void Start() { cameraT = Camera.main.transform; } private void Update() { transform.Rotate(Vector3.up * Input.GetAxis("Mouse X") * Time.deltaTime * mouseSensitivityX); verticalLookRotation += Input.GetAxis("Mouse Y") * Time.deltaTime * mouseSensitivityY; verticalLookRotation = Mathf.Clamp(verticalLookRotation, -60, 60); cameraT.localEulerAngles = Vector3.left * verticalLookRotation; Vector3 moveDir = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized; Vector3 targetMoveAmount = moveDir * walkSpeed; moveAmount = Vector3.SmoothDamp(moveAmount, targetMoveAmount, ref smoothMoveVelocity, .15f); if (Input.GetButtonDown("Jump")) { if (grounded) { GetComponent<Rigidbody>().AddForce(transform.up * jumpForce); } } grounded = false; Ray ray = new Ray(transform.position, -transform.up); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1 + .1f + groundedMask)) { grounded = true; } } private void FixedUpdate() { GetComponent<Rigidbody>().MovePosition(GetComponent<Rigidbody>().position + transform.TransformDirection(moveAmount) * Time.fixedDeltaTime); }
  2. Hey guys thought I would share a simple script I have for Disabling and enabling MouseLook in C#. You may have found out that when you disable the mouselook in "First Person Controller" that the camera can still move in th "Y" axis, that is because there are 2 mouselook added. This is a simple loop to find all the mouselook components and disable/enable them using a boolean. So for example if you wanted to disable mouselook while you the player is in the inventory you can use it simply like this. public MouseLook[] mLooks; private bool showInventory; //place this in your void Start() showInventory = false; void ToggleInventory() { if(Input.GetButtonUp("Inventory")) showInventory = !showInventory; foreach (MouseLook mLook in mLooks){ // enables MouseLook when showInventory is false mLook.enabled = !showInventory; } } Hope you find it useful. And as usually... Peace. Love. Happiness.
  3. how to enable and disable scripts with another script? (c#) script: using UnityEngine; using System.Collections; public class nitro : MonoBehaviour { public Component N20; public Component Setup; void Start(){ N20 = GetComponent<N20>(); Setup = GetComponent<Setup>(); } void Update(){ if(Input.GetButtonDown("nitro")){ N20.enable = true; Setup.enable = false; } else { if(Input.GetButtonUp("nitro")){ N20.enable = false; Setup.enable = true; } } } } Message error on unity: nitro.cs(16,9): error CS1061: Type `UnityEngine.Component' does not contain a definition for `enable' and no extension method `enable' of type `UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?) help me please!
  • Create New...