Why won't pressing a button on my controller trigger the function?
I've started making a new game recently and I've been trying to add controller support as I implement more things. I've created a function that is supposed to show and hide the inventory by pressing either E on a keyboard or the "North Button" on a controller (Triangle on playstation, X on switch and Y on xbox). Pressing E works fine, but pressing Triangle on my PS5 controller does nothing. Unity isn't telling me there's an error, it still detects when I press the button elsewhere in Unity, and moving with the Left Stick still works perfectly fine.
Can anyone figure out what I'm doing wrong?
https://preview.redd.it/sicm2qudibzd1.png?width=1097&format=png&auto=webp&s=4bee7e4c7efe02d66bfc791c6ad62053b9c30d6e
https://preview.redd.it/s4an6rudibzd1.png?width=1105&format=png&auto=webp&s=6396253e45a4e8bd671764feae498e7c812be08b
openInventory.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class openInventory : MonoBehaviour
{
@PlayerGmaepadControler controls;
void Awake()
{
controls = new @PlayerGmaepadControler();
controls.Gameplay.ToggleInventory.performed += ctx => ToggleInventory();
}
[SerializeField] GameObject _object;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
ToggleInventory();
}
}
void ToggleInventory()
{
bool currentState = _object.activeSelf;
_object.SetActive(!currentState);
}
}
https://redd.it/1gl47cv
@r_Unity3D
I've started making a new game recently and I've been trying to add controller support as I implement more things. I've created a function that is supposed to show and hide the inventory by pressing either E on a keyboard or the "North Button" on a controller (Triangle on playstation, X on switch and Y on xbox). Pressing E works fine, but pressing Triangle on my PS5 controller does nothing. Unity isn't telling me there's an error, it still detects when I press the button elsewhere in Unity, and moving with the Left Stick still works perfectly fine.
Can anyone figure out what I'm doing wrong?
https://preview.redd.it/sicm2qudibzd1.png?width=1097&format=png&auto=webp&s=4bee7e4c7efe02d66bfc791c6ad62053b9c30d6e
https://preview.redd.it/s4an6rudibzd1.png?width=1105&format=png&auto=webp&s=6396253e45a4e8bd671764feae498e7c812be08b
openInventory.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class openInventory : MonoBehaviour
{
@PlayerGmaepadControler controls;
void Awake()
{
controls = new @PlayerGmaepadControler();
controls.Gameplay.ToggleInventory.performed += ctx => ToggleInventory();
}
[SerializeField] GameObject _object;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
ToggleInventory();
}
}
void ToggleInventory()
{
bool currentState = _object.activeSelf;
_object.SetActive(!currentState);
}
}
https://redd.it/1gl47cv
@r_Unity3D
How to use hold Touch as Input to execute action in Update function? For mobile.
Hey guys, I was inspired by Dani Dev to start gamedev and I've spent quite a few months just creating my first game for mobile similar to his farty Rocket that he created in 1 hour lol. the problem is I can't find any way to move my player when the user taps and holds the screen. I've done everything else perfectly fine but I just don't understand any tutorial on this type of mobile input for this silly little 2d game. this is my code:
void Update()
{
if (gameManager.IsState(GameState.Playing))
{
//Need to put Mobile inputs here but whichever one i try it with it doesn't accomplish anything.***
if (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.UpArrow))
rb2d.AddForce(Vector2.up * flyForce * Time.deltaTime * 1000f);
// Rotates ship
float angle = Mathf.Atan(rb2d.velocity.y / rotation) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));
}
} this is the video that can explain what kind of input I am talking about.. at 4:41 https://youtu.be/LrFm8hq3gsA?si=BWcEf8hJJkPkdjQh
https://redd.it/1gl8us3
@r_Unity3D
Hey guys, I was inspired by Dani Dev to start gamedev and I've spent quite a few months just creating my first game for mobile similar to his farty Rocket that he created in 1 hour lol. the problem is I can't find any way to move my player when the user taps and holds the screen. I've done everything else perfectly fine but I just don't understand any tutorial on this type of mobile input for this silly little 2d game. this is my code:
void Update()
{
if (gameManager.IsState(GameState.Playing))
{
//Need to put Mobile inputs here but whichever one i try it with it doesn't accomplish anything.***
if (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.UpArrow))
rb2d.AddForce(Vector2.up * flyForce * Time.deltaTime * 1000f);
// Rotates ship
float angle = Mathf.Atan(rb2d.velocity.y / rotation) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));
}
} this is the video that can explain what kind of input I am talking about.. at 4:41 https://youtu.be/LrFm8hq3gsA?si=BWcEf8hJJkPkdjQh
https://redd.it/1gl8us3
@r_Unity3D
YouTube
How I Made a Mobile Game in ONE Day!
Install Raid for Free ✅ IOS: http://bit.ly/36rx5LR ✅ ANDROID: http://bit.ly/2PhsM05 Start with💰50K silver and get a Free Epic Champion 💥 on day 7 of the “New Player Rewards” program
Today we're making a mobile game in 1 day bois!
DOWNLOAD ANDROID VERSION…
Today we're making a mobile game in 1 day bois!
DOWNLOAD ANDROID VERSION…
Media is too big
VIEW IN TELEGRAM
We just launched our first game Tiny House Simulator where you build tiny homes for clients and explore the open world
https://redd.it/1gl7en0
@r_Unity3D
https://redd.it/1gl7en0
@r_Unity3D
I think videogames can be really useful for keeping culture alive, so I made one about the tradition of my local ancestors for Android and iOS.
https://www.youtube.com/watch?v=QdNndgpSX98
https://redd.it/1glbjdm
@r_Unity3D
https://www.youtube.com/watch?v=QdNndgpSX98
https://redd.it/1glbjdm
@r_Unity3D
YouTube
Risko - Sheperd's Leap | iOS + Tablets Update Trailer
Risko - El Salto del Pastor
Videojuego Android + iOS + Tablets
Desarrollado por Daydream Software, 2024
"On the summits of the Canary Islands, the ancient shepherds dedicated their lives to their land with such intensity that their knowledge, experiences…
Videojuego Android + iOS + Tablets
Desarrollado por Daydream Software, 2024
"On the summits of the Canary Islands, the ancient shepherds dedicated their lives to their land with such intensity that their knowledge, experiences…
Thrive: Heavy Lies The Crown | Early Access Out Now | Medieval City Builder
https://www.youtube.com/watch?v=scEHpsaF1_w
https://redd.it/1glc1dz
@r_Unity3D
https://www.youtube.com/watch?v=scEHpsaF1_w
https://redd.it/1glc1dz
@r_Unity3D
YouTube
Thrive: Heavy Lies The Crown | Early Access Out Now | Medieval City Builder
Thrive: Heavy Lies The Crown is Out Now in Early Access! Buy Now on Steam: https://thrivehltc.go.link/2JjKQ
Thrive: Heavy Lies The Crown is a medieval fantasy city-builder with multiplayer combat and impactful decision-making. As a new ruler, you and the…
Thrive: Heavy Lies The Crown is a medieval fantasy city-builder with multiplayer combat and impactful decision-making. As a new ruler, you and the…
I have a hexagon tile map grid. I want to implement a feature where honey combs can be dragged and placed at predetermined positions. Is that possible with the tile map or do I have to make my own grid system?
https://redd.it/1gliqb7
@r_Unity3D
https://redd.it/1gliqb7
@r_Unity3D
My first Steam game has received quite a few visits over the past two days, but it’s only sold a few copies. Is there anything I can improve, or is this normal?
https://redd.it/1glkfil
@r_Unity3D
https://redd.it/1glkfil
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
It's been a crazy week for the world. Maybe lighting one up with your cat by the window is what you need to recover.
https://redd.it/1glkz2x
@r_Unity3D
https://redd.it/1glkz2x
@r_Unity3D
This media is not supported in your browser
VIEW IN TELEGRAM
I made my own 3D ECS sandbox game with ~1 million voxels (250 fps).
https://redd.it/1glksgf
@r_Unity3D
https://redd.it/1glksgf
@r_Unity3D
JumpKin on Steam
My multiplayer indie game that I have been developing for a few months is coming to Steam soon. I would be happy if you add it to your wishlist.
https://store.steampowered.com/app/3276440/JumpKin/
https://redd.it/1gllti2
@r_Unity3D
My multiplayer indie game that I have been developing for a few months is coming to Steam soon. I would be happy if you add it to your wishlist.
https://store.steampowered.com/app/3276440/JumpKin/
https://redd.it/1gllti2
@r_Unity3D
Steampowered
Save 40% on JumpKin on Steam
Think you're the best pumpkin? Being a pumpkin isn't for everyone. So join the competition with your friends in this addictive 2D platformer. It's time to immerse yourself in the JumpKin challenge!
Upload to Playstore fails due to API 28, game created in Editor 2019.3.0f5, needs min 34
Hi,
I have a game I developed in 2019-2020 and I was just learning Unity. I forgot all about it and now I want to release it. Game works, I build apk and it works on my phone and others, but when I try to release it on Google Play store I get error Your app targets API level 28 and needs at least 34.
This is how I started: installed Unity hub, installed Editor 2019.3.0f5 in which game was build (is this wrong?).
After I do that in folder D:\\Editor\\2019.3.0f5\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\build-tools I have only folder 28.0.3
I tried installing Android studio, downloading 35 and pasting it in this folder. Should I delete 28 before running Unity again?
Is it proper way to get higher SDK/API to just get it from Android Studio and copy paste the entire unzipped folder to this Unity folder?
Sorry if this is low hanging fruit kind of question but just want to solve it so I can progress with my other projects.
Any help is appreciated.
https://redd.it/1gloglx
@r_Unity3D
Hi,
I have a game I developed in 2019-2020 and I was just learning Unity. I forgot all about it and now I want to release it. Game works, I build apk and it works on my phone and others, but when I try to release it on Google Play store I get error Your app targets API level 28 and needs at least 34.
This is how I started: installed Unity hub, installed Editor 2019.3.0f5 in which game was build (is this wrong?).
After I do that in folder D:\\Editor\\2019.3.0f5\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\build-tools I have only folder 28.0.3
I tried installing Android studio, downloading 35 and pasting it in this folder. Should I delete 28 before running Unity again?
Is it proper way to get higher SDK/API to just get it from Android Studio and copy paste the entire unzipped folder to this Unity folder?
Sorry if this is low hanging fruit kind of question but just want to solve it so I can progress with my other projects.
Any help is appreciated.
https://redd.it/1gloglx
@r_Unity3D
Reddit
From the Unity2D community on Reddit
Explore this post and more from the Unity2D community
[Asset Store] Sprite Sheet Changer - Copying a Pivot and slice from one Sprite Sheet to another
https://assetstore.unity.com/packages/tools/sprite-management/sprite-sheet-changer-tool-275260
https://redd.it/1glp41z
@r_Unity3D
https://assetstore.unity.com/packages/tools/sprite-management/sprite-sheet-changer-tool-275260
https://redd.it/1glp41z
@r_Unity3D
Unity Asset Store
Sprite Sheet Changer | Tool | Sprite Management | Unity Asset Store
Get the Sprite Sheet Changer | Tool package from TkKoi and speed up your game development process. Find this & other Sprite Management options on the Unity Asset Store.
In our action roguelite game, Anomaly President, you fight crime at night and try to win the presidential election in the mornings, and it’s featured in the Lands of the Crescent event! If the game’s theme caught your interest, we’d be thrilled if you could add it to your wishlist :)))
https://redd.it/1glq769
@r_Unity3D
https://redd.it/1glq769
@r_Unity3D
My Tycoon/Strategy game, Firearms Factory, where your candy factory is turned into an arms workshop by government force, is part of the Lands of the Crescent event. While the game’s demo is not available yet, I’d be happy if you could add it to your wishlist if the theme interests you.
https://redd.it/1glquew
@r_Unity3D
https://redd.it/1glquew
@r_Unity3D
I made an asset/tool that helps you making your netcode for gameobjects game, it focuses on providing an alternative to rpcs. While not trying to replace them completly. Would anyone want to leave feedback in the comments?
https://redd.it/1glt4q2
@r_Unity3D
https://redd.it/1glt4q2
@r_Unity3D
Reddit
From the Unity2D community on Reddit: I made an asset/tool that helps you making your netcode for gameobjects game, it focuses…
Explore this post and more from the Unity2D community