Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

353
Vistas
Cursor not appearing in Unity with Screen.lockCursor = false;

Unity version: 2017.2.0b11

In my game when the Inventory Panel is visible on the screen, the cursor should appear so that i can click and interact. I always have to press esc key to make the cursor visible and even from that the cursor disappears after clicking.

Below is my javascript script

var OurInventory : GameObject;
var InvStatus : int;

function Update(){
    if (Input.GetButtonDown("Inventory")){
        if (InvStatus == 0){
            Screen.lockCursor = false;
            InvStatus = 1;
            OurInventory.SetActive(true);
        }
        else {
            Screen.lockCursor = true;
            OurInventory.SetActive(false);
            InvStatus = 0;
        }
    }
}

Below is my C# script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Shop01Access : MonoBehaviour {

    public GameObject ShopInventory;
    public GameObject Item01Text;
    public GameObject Item02Text;
    public GameObject Item03Text;
    public GameObject Item04Text;
    public GameObject ItemCompletion;
    public GameObject CompleteText;
    
    void OnTriggerEnter(){
        ShopInventory.SetActive(true);
        Screen.lockCursor = false;
        GlobalShop.ShopNumber = 1;
        Item01Text.GetComponent<Text>().text = "" + GlobalShop.Item01;
        Item02Text.GetComponent<Text>().text = "" + GlobalShop.Item02;
        Item03Text.GetComponent<Text>().text = "" + GlobalShop.Item03;
        Item04Text.GetComponent<Text>().text = "" + GlobalShop.Item04;
    }
    
    public void Item01() {
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy " + GlobalShop.Item01 + "?";
    }
    
    public void Item02() {
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy " + GlobalShop.Item02 + "?";
    }
    
    public void Item03() {
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy " + GlobalShop.Item03 + "?";
    }
    
    public void Item04() {
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy " + GlobalShop.Item04 + "?";
    }
    
    public void CancelTransaction(){
        ItemCompletion.SetActive(false);
    }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda