How do I add a controller vibration to this method? private void HandleGunFire() { //GUN…
- User
How do I add a controller vibration to this method? private void HandleGunFire() { //GUN FIRE if (InputSource.IsJustPressed("Fire") || Input.GetAxis("Fire") > 0.5f) { if (isAiming && Time.time >= nextTimetoFire && !isReloading && ShotgunPickup.weaponPicked == true && !isSettingTrap) { if (currentAmmo >= 1) { nextTimetoFire = Time.time + 1f / fireRate; //StartCoroutine(Fire()); StartCoroutine(Shoot()); } else { nextTimetoFire = Time.time + 1f / fireRate; MsgUI = FindObjectOfType(typeof(NotificationUI)) as NotificationUI; MsgUI.SendMsg("No Ammo! Press R to reload."); AudioClip clip = GunEmpty; weaponAudioSource.PlayOneShot(clip); } } } }
- Assistant
- User
I dont know what package to download in the package manager for it ?
- Assistant
- User
I am making a lovecraftian horror game, inspired from resident evil, siren, silent hill. In my game, there are TV's showing a weird and creepy video, but I'd like to expand on the TV feature in my game, what do you suggest?
- Assistant
- User
I could create a VHS tape item that the player need to insert into the VHS to play what's on the tape.. but for what purpose?
- Assistant
- User
give me more purpose for the VHS feature
- Assistant
- User
What is the game is not lovecraftian at all, but still horror in genre, what do you suggest then?
- Assistant
- User
Tutorial Tapes and Easter eggs or references to other horror games, films, or cultural phenomena are the two suggestions I prefered
- Assistant
- User
for tutorial tapes, how do I keep the player entertained while they learn the game's mechanics?
- Assistant
- User
What if by playing a Tutorial VHS, the player is transported into the tutorial himself, having to play through it and learn from it. He would then play the actor in the tape and follow the tutorial. When the tutorial is over, the player is transported back to its original character in front of the TV. Does it make sense? What would I need to do in order to create such a thing?
- Assistant
- User
To Craft tutorials that stand alone as mini-games or self-contained experiences that teach the player the required mechanics, should I create separated scenes for each tutorials? Or should I use the same scene? How does it works?
- Assistant
- User
If using the same scene, and differentiate the tutorial character from the player’s main character, I would then need to expand the map terrain and create tutorial small maps around it? Can I create separated terrain on the same scene?
- Assistant
- User
In my lovecraftian horror game, there's a trader. The story is that the townpeople have made a ritual collective suicide in attempt to summon cosmic entities (the shadow people), and now possessed by these entities they now roam the town like zombies, I need to give significance to the presence of such a trader into town.
- Assistant
- User
The trader himself could potentially be a good entity disuise as human trying to help the survivor
- Assistant
- User
In case I decide to not use a trader, what would be a trade system then? I mean, how would I translate from trader character to another feature that still manage the trade system?
- Assistant
- User
Can I use the VHS tape to integrate the trading system? how would it goes?
- Assistant
- User
How to add controller joystick button 5 and 4 respectively to this line of codes? //SWITCH SIGHT if (_SightMode) { if (Input.GetMouseButton(1) && Time.time >= spamLock) { currentCam++; toggleCam(); spamLock = Time.time + 2f; } if (Input.GetMouseButton(0) && Time.time >= spamLock) { currentCam--; toggleCam(); spamLock = Time.time + 2f; } }
- Assistant
- User
I have a map button to "NextCamera" and "PreviousCamera"
- Assistant
If you've already mapped controller joystick button 5 to "NextCamera" and joystick button 4 to "PreviousCamera" through Unity's Input Manager, you can directly use the
Input.GetButtonfunction to check if those buttons are being pressed. Here's how you integrate it with your code:// SWITCH SIGHT if (_SightMode) { // Change to next camera with "NextCamera" input action if (Input.GetButton("NextCamera") && Time.time >= spamLock) { currentCam++; toggleCam(); spamLock = Time.time + 2f; // Prevent immediate repeat } // Change to previous camera with "PreviousCamera" input action if (Input.GetButton("PreviousCamera") && Time.time >= spamLock) { currentCam--; toggleCam(); spamLock = Time.time + 2f; // Prevent immediate repeat } }In this code snippet, checks whether the input mapped to the "NextCamera" action is being held down. Similarly, checks for the "PreviousCamera" action. These actions should correspond to your joystick's buttons, as configured in the Input Manager.
- User
- Assistant
- User
ArgumentException: Input Key named: Alpha1 is unknown UnityEngine.Input.GetKeyUp (System.String name) (at :0) EldritchSight.Update () (at Assets/EldritchSight.cs:268)
- Assistant
The error message you're receiving indicates that Unity doesn't recognize "Alpha1" as a valid input key. In Unity's input system, the correct name for the keys representing the top row number keys 1–4 on the keyboard is
"1", "2", "3", "4"without the prefix "Alpha". This is similar to how you wouldn't use "JoystickButton" for the controller inputs if you've mapped them in the Input Manager with a different name.To resolve the error, you need to change the strings
Alpha1,Alpha2,Alpha3,Alpha4to just"1","2","3","4"like so:string[] keys = new string[] { "1", "2", "3", "4" }; // Correct keys on the keyboard - User
I'd like to have 4 UI elements that changes colors wether if the slot is loaded or just saved, or blank. I call the UI element saveButtonsUI1, saveButtonsUI2, saveButtonsUI3 and saveButtonsUI4.
public Image saveButtonsUI1; public Image saveButtonsUI2; public Image saveButtonsUI3; public Image saveButtonsUI4;
Then in the following method, how do I get the color of the image to change based on the condition I mentionned ? Also, i miss the blank color condition.
for (int i = 0; i < 4; i++) { if (Input.GetKeyUp(keys[i]) || Input.GetButtonUp(buttons[i])) { // Check if it’s a double tap - within the threshold time if (Time.time - lastTapTime[i] < doubleTapThreshold) { // Double-tap detected, save current camera index savedCamIndexes[i] = currentCam; // …Add visual or audio feedback for saving… saveButtonsUI1.color = new Color32(222, 70, 70, 100); //Exemple with saveButtonsUI1 if 1 has been double tapped
- Assistant
- User
In my start method I'm doing this : for (int i = 0; i < 4; i++) { lastTapTime[i] = -1f; // Initializing to a negative value savedCamIndexes[i] = -1; // No camera saved initially }
- Assistant
- User
When I load a camera, the image turns green which is good, but I also want the other image to turn red (if they have a save slot) or stay blank (if they are blank). Right now, when loading to another cam, the other images stay green (on loaded state per say).
- Assistant
- User
I'd like to quickly highlight in white the current loaded image before turning it to green
- Assistant
- User
How would I add another lines that says "Double tap to save vision" and "Single tap to load vision" void OnGUI() { if (_SightMode) { var style = GUI.skin.GetStyle("label"); style.fontSize = 20; // whatever you set GUILayout.Label("Press 'Z' or 'Up Arrow' to switch back.", style); } }
- Assistant
To add additional instructions to your
OnGUI()method for saving and loading camera visions, you simply need to include moreGUILayout.Label()calls for each message you want to display. Adjust the message content and positioning as needed to inform the player about the double-tap and single-tap actions.Here's an example of how to modify your
OnGUI()method: - User
I want the rect transform to be anchored to top left of the screen
- Assistant
If you are set on using
OnGUI()and want to anchor the messages to the top-left of the screen, you only need to adjust the parameter in the method to specify a position at the top left with a certain width and height that will contain your GUI elements. - User
Within a cooldown of about one minute starting at 0, when an enemy having the eldritch camera is seeing the character, I want the corresponding camera to briefly activate and turn the screen red (assuming i have a UI image in red that cover the screen with an alpha to it), and then the camera returns back to the character.
- Assistant
- User
Will this work if in my enemy script I use this : private EldritchSight eldritchSight; public float enemySightCooldown = 60f; // 60 seconds cooldown private float enemySightTimer = 0f; private bool inEnemySightCooldown = false;
void Start() { eldritchSight = FindAnyObjectByType(typeof(EldritchSight)) as EldritchSight; } void Update() { if (ai.visionState == Ai.VISION_STATE.CanSeePlayer && !inEnemySightCooldown) { StartCoroutine(ActivateRedScreen()); }
}private IEnumerator ActivateRedScreen() { inEnemySightCooldown = true; // Start cooldown enemySightTimer = enemySightCooldown; // Reset the timer Camera enemyCamera = GetComponentInChildren(); StartCoroutine(eldritchSight.RedScreenEffect(enemyCamera));
while (enemySightTimer > 0) { enemySightTimer -= Time.deltaTime; yield return null; } inEnemySightCooldown = false; }And then in the eldritchsight script, the coroutine goes like this : public IEnumerator RedScreenEffect(Camera enemyCamera) { // Activate the red screen overlay redScreenOverlay.enabled = true;
- Assistant
- User
Once the redscreen appears, I also want the green cross to appears (refer in the update method), and when the red screen disappear, i want the green cross to disappear and the red cross to appear (refer in the update method) and then disappear after the same time as in the update method.
- Assistant
- User
Here's how set the green and red cross in the update method : //RED CROSS if (_ExitingEldritchSight) { for (int i = 0; i < camEldritch.Count; i++) { foreach (GameObject j in camEldritch) { positionToScreen = mainCamera.WorldToScreenPoint(camEldritch[i].transform.position); cameraDistance = Vector3.Distance(transform.position, camEldritch[i].transform.position);
foreach (GameObject cross in redCross) { if (positionToScreen.z > 0) { if (redCross[i] != null) { redCross[i].transform.localPosition = new Vector3(positionToScreen.x + tooltipPosition.x - Screen.width / 2f, positionToScreen.y - Screen.height / 2f + tooltipPosition.y / (cameraDistance / 10), positionToScreen.z); } } } } } } //GREEN CROSS if (_SightMode) { foreach (GameObject j in camEldritch) { if (j.GetComponent<Camera>().enabled == true) { positionToScreen = j.GetComponent<Camera>().WorldToScreenPoint(transform.position); cameraDistance = Vector3.Distance(j.GetComponent<Camera>().transform.position, player.transform.position); playerCross.SetActive(false); if (positionToScreen.z > 0) { playerCross.transform.localPosition = new Vector3(positionToScreen.x + tooltipPosition.x - Screen.width / 2f, positionToScreen.y - Screen.height / 2f + tooltipPosition.y / (cameraDistance / 10), positionToScreen.z); playerCross.SetActive(true); } } } } else { playerCross.SetActive(false); } - Assistant