unity3d

Firebase keepsynced

ぐ巨炮叔叔 提交于 2021-02-11 16:59:44
问题 Working with Firebase in a Unity project, for a simple highscore, I stumbled on problems when doing a query. In editor, everything works like a charm (Editor does not have persistence) On devices (with persistence enabled) the troubles begin. Query is showing cached Firebase data, so it is only correct on first ever call in the client, and then when Firebase sees it fit to sync (maybe never, since there is no eventhandler) However, looking for a solution, there is no way to force an update of

FMOD keeps playing in Unity after code change during play mode

久未见 提交于 2021-02-11 16:55:44
问题 Here are the different options for how Unity will handle "Script Changes While Playing" and the corresponding effect it has on FMOD: Recompile and Continue Playing - Hard Crash (see core dump below) Stop Playing and Recompile - Hard Crash (see core dump below) Recompile After Finish Playing - FMOD continues playing audio even after playmode exits (But after repeated plays, it does hard crash too) Core Dump (excerpt) Here - FMOD Crashed Thread: Thread 179 Crashed: 0 libsystem_kernel.dylib

How to make a character jumping with just one jump at a time in Unity 3D?

别等时光非礼了梦想. 提交于 2021-02-11 16:48:11
问题 I created a script to make my character jump but it keeps jumping when I keep pressing the button. I just want it to jump once a time. using UnityEngine; [RequireComponent(typeof(Rigidbody))] public class Jump : MonoBehaviour { Rigidbody rb; void Start() { rb = GetComponent<Rigidbody>(); } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { rb.AddForce(new Vector3(0, 5, 0), ForceMode.Impulse); } } } 回答1: add a state or flag the store the jumping state, when begin to jump, set it to be true

How to make a character jumping with just one jump at a time in Unity 3D?

為{幸葍}努か 提交于 2021-02-11 16:46:30
问题 I created a script to make my character jump but it keeps jumping when I keep pressing the button. I just want it to jump once a time. using UnityEngine; [RequireComponent(typeof(Rigidbody))] public class Jump : MonoBehaviour { Rigidbody rb; void Start() { rb = GetComponent<Rigidbody>(); } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { rb.AddForce(new Vector3(0, 5, 0), ForceMode.Impulse); } } } 回答1: add a state or flag the store the jumping state, when begin to jump, set it to be true

Unity - Projectile Motion, find the angle needed to hit coordinates x,y

我是研究僧i 提交于 2021-02-11 15:48:32
问题 Plenty of questions asked around the same topic, but nothing seems to be working for me. The problem is simple, a player and an enemy are on the x,y plane. I want to launch my projectile at a calculated angle in such way that the projectile will hit the enemy at it's coordinates. I've tried implementing both Angle of Reach and Angle required to hit x,y Both of these implementation end up doing the same for me; Shooting but not hitting the target in this manner Any help or pointers would be

Projectiles spawning with incorrect trajectory

笑着哭i 提交于 2021-02-11 15:30:32
问题 I wrote a script for gun and projectile but whenever I fire it only fires in the right direction when im pointing upwards, if i'm pointing to the sides it shoots downwards and if i'm pointing downwards it shoots up. I've been trying to get a simple script that makes the gun rotate to face the mouse (works) and then to spawn bullets going in the firection of the gun, however, they spawn weirdly when not facing upwards, i've tried changing the object that has the script but nothing else since i

Child of Player not detecting collision with rigidbody on other object

╄→尐↘猪︶ㄣ 提交于 2021-02-11 15:21:40
问题 I have a player with a character controller, and a child object with a capsule collider extending a little bit out of the player's characterController to detect if the player jumps on a cube with a rigidbody on it. The child of the player has a tag called "hammer", and the rigidbody cube has a script on it. For some reason, the child is not detecting collisions with the rigidbody. It only does so when the player and the child is touching the rigidbody. Here is the code for the rigidbody cube:

In Unity when I write Debug.Log(“ ”) it has an error saying that there is a difference between UnityEngine.Log and System.Log. How do I fix this?

最后都变了- 提交于 2021-02-11 15:19:02
问题 It says there is an ambiguous difference between UnityEngine.Log and System.Log and won't print anything. How do I fix it? I am sorry that people didn't like my question. I am just a new game dev looking for help. 回答1: Your simplest solution is just to always type, in that script: UnityEngine.Debug.Log("yo !!"); In general if it tells you "blah blah .. difference between AAA and BBB ..." Simply add either AAA. or BBB. in front of the command in question! (It is usually the "Unity" one you

In Unity when I write Debug.Log(“ ”) it has an error saying that there is a difference between UnityEngine.Log and System.Log. How do I fix this?

こ雲淡風輕ζ 提交于 2021-02-11 15:16:28
问题 It says there is an ambiguous difference between UnityEngine.Log and System.Log and won't print anything. How do I fix it? I am sorry that people didn't like my question. I am just a new game dev looking for help. 回答1: Your simplest solution is just to always type, in that script: UnityEngine.Debug.Log("yo !!"); In general if it tells you "blah blah .. difference between AAA and BBB ..." Simply add either AAA. or BBB. in front of the command in question! (It is usually the "Unity" one you

Can not get precise positioning of Rigidbody in Unity3D

本秂侑毒 提交于 2021-02-11 15:15:46
问题 I am creating a 3D endless runner that's a little different than the norm. There are 5 Lanes that are 1 unit wide, and the player can fall off the sides if they move too far to the left or right. The Player does not move Forward, Jump or Slide. It only has left or right movement. The player can get bounced backward if hit by an oncoming obstacle that increases in speed over time. In regards to the player's left/right movement, I got it pretty close. But I'm having trouble getting precise