unity3d

Per Tilemap Tile Data Storage & Retrieval

我是研究僧i 提交于 2021-01-28 14:08:39
问题 I have a scenario where I will need to know certain information about all of the tiles in a tilemap. From the research I've done and questions that others have had, this may not be the easiest thing to do. I am faced with 3 possible options, as far as I can tell: Don't use Unity's Tilemap, and build the tiles out by hand instead via a list of GameObjects and sprites. Then attach any sort of model I may need with custom values as a script to said GO. This will make it very simple to add logic

My Perlin Noise function having too many dark spots, and little strips of white

我是研究僧i 提交于 2021-01-28 12:26:33
问题 I created a Perlin noise function by loosely following a java tutorial in C#. I then used Unity to visualize it (I don't think the issue is with unity, as their inbuilt func works perfectly) The problem is that there are too many large dark spots. Here is a photo This is how I would like it to look As you can see, it looks as if the points are not blending well. Here is my code for the noise: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public

Unity3D: How to detect when a button is being held down and released [duplicate]

南楼画角 提交于 2021-01-28 12:24:44
问题 This question already has answers here : How to detect click/touch events on UI and GameObjects (4 answers) Closed 1 year ago . I have a UI button. I want to show a text when the user is pressing the button and hide the text when the user releases the button. How can I do this? 回答1: You have to create your own custom button by extending Button class and override method OnPoiterDown and OnPointerUp. Attach MyButton component instead of Button to your gameobject using UnityEngine; using

Unity3D: How to detect when a button is being held down and released [duplicate]

限于喜欢 提交于 2021-01-28 12:16:30
问题 This question already has answers here : How to detect click/touch events on UI and GameObjects (4 answers) Closed 1 year ago . I have a UI button. I want to show a text when the user is pressing the button and hide the text when the user releases the button. How can I do this? 回答1: You have to create your own custom button by extending Button class and override method OnPoiterDown and OnPointerUp. Attach MyButton component instead of Button to your gameobject using UnityEngine; using

Starting unity animation from n time ,not from the start

若如初见. 提交于 2021-01-28 11:00:51
问题 I want to ask if it is possible to trigger an animation in unity not from the start ,but from n time in the animation .If the animation lets say 2 second ,is it possible to start the animation sequence after 1 second . Thanks 来源: https://stackoverflow.com/questions/59512064/starting-unity-animation-from-n-time-not-from-the-start

What does “Mouse X” and “Mouse Y” return in Unity?

萝らか妹 提交于 2021-01-28 09:32:43
问题 I wrote the following update: void Update () { if( Input.GetMouseButton(0) ) { if( !dragging ) { dragging = true; xDragStart = Input.GetAxis("Mouse X"); yDragStart = Input.GetAxis("Mouse Y"); } xDrag = Input.GetAxis("Mouse X"); yDrag = Input.GetAxis("Mouse Y"); DragValuesText.text = "x = " + xDrag + ", y = " + yDrag; } else { if( dragging ) { dragging = false; } } } and made a Text UI to display DragValuesText . After this I found, that returned values are small while I am dragging and turn

Is it possible to create a DepthMask effect in Unity's HDRP?

假装没事ソ 提交于 2021-01-28 08:47:05
问题 I've been banging my head against this for a while but I cannot figure out if it is possible to create a DepthMask shader for HDRP (as descibed here). For my exact use, I'm trying to create a "hole" in the shape of whatever I have the material applied to, that shows the contents of a different camera rendered behind everything. I tried messing around with the render queue within the shader, different ZTest and ZWrite combinations, as well as some variations of the shader I found. On top of

Is there a better way to reset cooldown on Unity?

泄露秘密 提交于 2021-01-28 08:14:47
问题 I'm programming in C# on Unity. When ever I need to reset a variable in a certain interval, I would tend to declare a lot of variables and use the Update() function to do what I want. For example, here is my code for resetting a skill's cooldown ( Shoot() is called whenever player presses shoot key): using UnityEngine; using System.Collections; public class Player : MonoBehavior { private bool cooldown = false; private float shootTimer = 0f; private const float ShootInterval = 3f; void Update

Change PostProcessing bloom effect via script

♀尐吖头ヾ 提交于 2021-01-28 08:12:47
问题 I'm trying to change the bloom color (PostProcessing) via a script. In the inspector the color changes but not in the game view. Some help, please. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing; public class PostProcceserManager : MonoBehaviour { PostProcessVolume volume; Bloom bloomLayer; public ColorParameter [] ColorArray; private void Awake() { volume = gameObject.GetComponent<PostProcessVolume>(); volume.profile

Placing objects right in front of camera

我只是一个虾纸丫 提交于 2021-01-28 08:11:21
问题 I am trying to figure out how to modify HelloARController.cs from the example ARCore scene to place objects directly in front of the camera. My thinking is that we are raycasting from the camera to a Vector3 on an anchor or tracked plane, so can't we get the Vector3 of the start of that ray and place an object at or near that point? I have tried lots, and although I am somewhat a beginner, I have come up with this From my understanding, ScreenToWorldPoint should output a vector3 of the screen