_id
int64
0
49
text
stringlengths
71
4.19k
0
strategies for detecting regressions I know writing tests would be a good way to catch regressions. But what are some other strategies? TDD and game dev don't suit, but catching regressions is obviously something desirable. I would love to find some cheap and easier ways to catch regressions without having to invest a lot of effort or writing tests after the fact. Strategies suggested don't have to be perfect, if they can give rough ideas or things to playtest rapidly then that would also be beneficial. Please advise.
0
Black and white textures load as turquoise? I have some black and white, and some grayscale textures, that are loading in unity as turquoise and white textures. What is causing this and how can I fix this? Also, can somebody verify that I am supposed to load roughness textures into the "Metallic" slot of the Standard shader? That feels so weird. I was using Principled Shader in Blender to make the original materials. EDIT "Autodesk Interactive" shader has a "Roughness" input but most of my roughness textures and some b amp w textures are still turquoise, what is happening... Here is one of the problem textures (the others are too big, 6mb)
0
Best approach for destructible car in Unity I'm developing a simple racing car game. I'm wondering what is the best approach to manage visually car destruction. For instance i think one option (expensive) is to build car 3d model with 'separate' mesh, each for any component (bump, door, glass) and relative cooliders.. Other options ? Thanks
0
Prefabs moved to before position when zooming scene I have build some pipes for waterline drawing, like following screencast https youtu.be WnJb1JwOW78 As you can see, when I zoom in the scene, Pipes moved to lower position. When i zoom out, Pipes moved to higher position. Actually I have changed the position and moved down the pipe position before, the unexpected higher position was the pipe before position. So i guessing this problem might about cache clean. So I I try to clear the GI cache, but the problem still exist. And then I try to build a windows executable file and run game again, problem still. How to fix it? I am using Unity 2018.4
0
Roofs not appearing in Unity My buildings are fine until I import them to Unity. None of the formats I've come across( FBX, DAE, 3DS Max, Blender Files, any of the Autocad formats, OBJ, PRJ, WRL etc.), have roofs when importing the buildings as one cohesive file into Unity. In Sketchup, Blender etc. they all appear fine. Does anyone have suggestions?
0
Use eyeray trigger to speak with NPC in Unity3D for Vive I'm developing a first person player game in Unity for HTC Vive. Basically, I want my NPC to speak when my player looks at him for more than a second. I didn't find any eyeray tutorials to achieve this for Vive. Please help.
0
Unity RTS Multiple Selection Approacah I've recently solved the single selection problem but now I want to do multiple selections. I know I need to find two points with the mouse position to draw a box but it just won't work for me. void Update() if (Input.GetMouseButtonDown(0)) bool dragging true Debug.Log("Multiselect active") MultiSelect(dragging) private void MultiSelect(bool dragging) mouseDownPoint Input.mousePosition if (Input.GetMouseButtonUp(0) amp amp dragging) mouseUpPoint Input.mousePosition Debug.Log("First pos " mouseDownPoint " Second pos " mouseUpPoint) dragging false What is a better way to achieve what I'm trying? If someone can tell me a way that can also detect any units inside the area that'd be nice too.
0
How do you manage versioning across platforms in Unity? I'm just beginning to look into versioning games in Unity and noticed that Unity seems to offer different things depending on the platform you are building for. For instance, Android and iOS seem to have their own individual properties for versioning while Desktop has no versioning functionality at all out of the box. Since I'm working on a game that has builds for PC, Mac, Android, and iOS, I need to determine how we want to manage version numbers within our game without having to manually manage individual version for each platform. How do you solve this?
0
DontDestroyOnLoad() doesn't work in Unity I have a problem with DontDestroyOnLoad() in Unity. It does not work! My code private static PlayerSpawningScript instance public void Awake() Debug.Log ("PlayerSpawningScript awake") Debug.Log ("Instance " instance) if (instance null) Debug.Log ("Initializing PlayerSpawningScript instance") instance this DontDestroyOnLoad (gameObject) if (instance ! this) Debug.Log ("PlayerSpawningScript instance exists. Destroying new copy.") Destroy (gameObject) Debug.Log ("PlayerSpawningScript instance " instance) public void OnDestroy() Debug.Log ("Destroying PlayerSpawningSceript instance " instance.ToString ()) Basing on the console output, I successfully create an instance in scene1, but when I change the scene, it gets destroyed I know this because I get "Destroying PlayerSpawningScript (...)" before the new scene is loaded, and the same script set up in scene2 does not find an existing instance (which held data saved in scene1) and sets up itself as the instance instead of getting Destroyed. What am I doing wrong?
0
How can zoom into my object when that object is being clicked? Suppose that I have the three game(cube,Quard,sphere) object. When I click on a particular game object suppose think I have clicked on the cube,the cube object should get zoomed in on the screen. how can I do that? How do I center and zoom into my cube game object after selecting the cube? I think it has something to do with the camera but how do I center the view with the camera? I have used the below code for zooming the object.For one object its working.But when I place different object and apply this code then when i click on one object all the three object is getting zoomed. Can anyone help me out in solving this issue Here is the code function OnMouseDown() OrthoZoom(1.5) function OrthoZoom(size float) var cam Camera.main while (cam.orthographicSize ! size) cam.orthographicSize Mathf.MoveTowards(cam.orthographicSize, size, speed Time.deltaTime) yield
0
Unity Assets folder is empty after opening package from the asset store I downloaded the following Survival Shooter Tutorial from the Asset Store https www.assetstore.unity3d.com en ! content 40756 I was prompted to open it in Unity so I did and began following this tutorial https www.youtube.com watch?v lP6epjupJs I am only 2 minutes into the first video and am stuck. In the tutorial there are lots of folders in the assets folder. I took a screenshot of what my screen looks like to show that it is empty.
0
Directional light shadow on terrain When player is walking on terrrain, around him Unity is rendering shadow coming from directional light. But after some radius in the distance, shadows are not rendered. Only when player walks close to some prefab, shadow is being drawn. This is not very realistic. I would like that shadows are visible in the distance as in real terrain. How to fix that ?
0
Difference between Update method and FixedUpdate in Unity? i am starting to learn Unity3d and one of the confusion i get is difference between Update() and FixedUpdate(). I am following Lynda Unity 2D game development tutorial there, the instructor uses Update method, the player has RigidBody2D component and Box collider, he uses the Update method to translate the player, but when i do same in Update the player doesn't move but when i do it in FixedUpdate, everything works. He is giving tutorial from Unity 4.3 and i am taking the course in Unity 4.6. Where should i use Update and FixedUpdate?
0
SocketException No connection could be made because the target machine actively refused it I am working on connecting a client to a server using socket connection. I have a button, when I click on the button, it's giving the below exception in Unity. "SocketException No connection could be made because the target machine actively refused it.". What will be the issue? Can anyboady help me out? Below is the code I have written for connecting to the server internal Boolean socketReady false NetworkStream theStream StreamWriter writer StreamReader reader try connect new TcpClient (host, port) theStream connect.GetStream () writer new StreamWriter (theStream) reader new StreamReader (theStream) return true socketReady true catch(ObjectDisposedException) return false
0
Unity Input System On Screen Button doesn't work with touchscreen 2019.3.2f1 I am trying to make my player jump whenever the space button is pressed (if a keyboard is present), and I'm adding a on screen button for players on mobile. The on screen button works fine in the editor but when I try the game in a device the on screen button doesn't work. Here's how things are set up Change the Active Input Handling to Input System Package (New) on the player settings. Create the Jump action for the Player action map. Bind lt Keyboard gt space to my Jump action. Add a PlayerInput component to my player object, pass my actions file to it, and set up the events to call for each action. Change the StandaloneInputModule to an InputSystemUIInputModule in my event system object. In my canvas I add an image and add OnScreenButton component to it (I do NOT add a Button component). Set the control path to lt Keyboard gt space. When I try the game on the device the rest of the UI buttons work fine except the on screen button. On the editor though (using mouse input), the on screen button works fine. This is my first time using the Input System, I had actually found it somewhat nice to work with, however this does seem really strange. It is either a really strange bug (unlikely), or I messed up some setting (the setup process feels really convoluted actually).
0
Making a gameobject move back and forth in Unity So i have this enemy gameobject and i want it to move in a certain pattern like a patrol. So i want him to move from A to B to C then Back to B to A. The script I worked out makes him go from C to A directly but I dont want that. Can someone please help . The Length of PatrolPoint Array in 3 using UnityEngine using System.Collections public class EnemyPatrol MonoBehaviour public Transform patrolPoints An Array of path points to be followed private int currentPoint public float enemySpeed void Start() currentPoint 0 transform.position patrolPoints currentPoint .position Starting Point void Update() if(transform.position patrolPoints currentPoint .position) currentPoint if(currentPoint gt patrolPoints.Length) currentPoint 0 transform.position Vector3.MoveTowards(transform.position , patrolPoints currentPoint .position , enemySpeed Time.deltaTime)
0
How can I make a trail renderer flat with the normal of the nearest face? I'm making a basic skid system for a car model using a trail renderer. I have everything setup and working properly except that the trail renderer always faces the camera. I want the trails to be perfectly flat with the ground. So I thought if unity can make the faces all rotate towards the camera, then would it be able to rotate towards the normals of the nearest faces?
0
How do I roll a ball with a Rigidbody? I have a ball in a game that rolls around just fine with Rigidbody.AddForce(). I have other non physics balls, however, that I control directly with Rigidbody.MovePosition(). It seems that no matter what I do, no matter how interpolation and collision detection are set, the ball does not "roll" when moved with Rigidbody.MovePosition(). It teleports, but IsKinematic is not set , as instructed by the documentation. How do I get the ball to roll properly with Rigidbody.MovePosition()? Alternatively, if that's not possible, how do I calculate the rotations manually?
0
Unity 3D, Making contiguous looking worlds Im currently involved in making a third person cooperative mobile game in Unity and in said game there will be an area for players to walk around in with various elevations and whatnot throughout the field. Its designed to be set up with 4 biomes in the area to go along with the games theme but I was wondering what would be the best way to mask the "boundaries" or "cut off points" in this area? From certain vantage points its pretty obvious that the terrain used to make the world simply stops and I was wondering if anyone knew any tips and insights on how to best mask these boundaries without too much "padding" in the game area in order to keep it relatively less taxing on a mobile device. Thank you in advance.
0
In Unity, how to hide objects from specific cameras without using Layers The situation is that there are multiple players that can collect items. When a player collects an item, the item will disappear from that player's screen but still be visible to other players. I know I can use LayerMask to achieve this effect. However, what if there are more than 32 players? (Unity Layer has 32 bits). How can I still hold this effect? I tried using OnWillRender() to check which camera is rendering the object in order to disable its renderer. This does not work because once the renderer has been disabled, OnWillRender() will not be called again for other cameras.
0
Unity3d CarController character positioning issue I use the unity standard asset components CharacterController and Car and put an empty gameobject onto the car where the camera should be placed when i am inside the car. The empty gameobject is called "Driver". The character controller has an empty called "Head" where its head is. When i get in the car i perform the following operation GameObject car GameObject.Find("Car") transform.position car.transform.Find("Driver").transform.position Vector3.up 1 transform.parent car.transform.Find("Driver").transform Camera.main.transform.position car.transform.Find("Driver").transform.position Camera.main.transform.rotation car.transform.Find("Driver").transform.rotation and to get out of it, i use the following GameObject car GameObject.Find("Car") transform.position car.transform.position transform.parent null transform.rotation Quaternion.identity Camera.main.transform.position transform.Find("Head").transform.position My problem is when i get into the car and out again, the character is positioned at the position where i have entered the car, so it doesnt seems to update its position with the car movement. What am i doing wrong? Thanks in advance
0
Simple cartoon water shader shoreline I'm currently attempting to create a cartoon ish water shader with a shoreline. After looking around trying to find out how other games do it i figured out it has something to do with getting the distance from the depth map (which doesn't include the water when it's render queue is set to transparent) and the and the world position of the current pixel. From certain angles i'm actually getting very close to the desired result as show here The topmost island almost has the desired result, but as you can tell, the closer it gets to the camera, the more out of place the effect becomes. here's a zoomed out top down view illustrating the problem as per request, here's what the terrain looks like beneath the water surface (animated gif) and of course, here is my shader code Shader "Custom CartoonWater" Properties Color ("Color", Color) (1,1,1,1) Glossiness("Smoothness", Range(0,1)) 0.5 ShoreFade("Shoreline Distance", Float) 1 SubShader Tags "Queue" "Transparent" "RenderType" "Transparent" LOD 200 CGPROGRAM Physically based Standard lighting model, and enable shadows on all light types pragma surface surf StandardSpecular Use shader model 3.0 target, to get nicer looking lighting pragma target 3.0 sampler2D CameraDepthTexture struct Input float3 worldPos float4 screenPos half Glossiness fixed4 Color float ShoreFade void surf (Input IN, inout SurfaceOutputStandardSpecular o) o.Albedo Color.rgb o.Smoothness Glossiness fixed4 depth tex2Dproj( CameraDepthTexture, UNITY PROJ COORD(IN.screenPos)) o.Albedo Color if (distance(LinearEyeDepth(depth), distance( WorldSpaceCameraPos, IN.worldPos)) lt ShoreFade) o.Albedo fixed4(1, 1, 1, 1) ENDCG FallBack "Diffuse" any help is greatly appreciated ) thanks in advance.
0
Clicking in a UI Button activate another I'm new to unity and creating my first game to learn more about it. Now i got a problem wich i click on a button and sometimes another button active, for example i press "Options" on pause menu and it active "Restart" or the "Main Menu". if someone can help me, I appreciate it. I set them up like this, if there's any error or need more info please let me know. And in the first image i tried split in 2 canvas, but didn't work. P.S. It happens even with buttons with no actions or scripts on them. public void OnPause() Time.timeScale 0 isPaused true unPauseButton.SetActive(true) pauseButton.SetActive(false) PauseGameMenu.SetActive(true) GameObject.Find("PowerUpSpawner").GetComponent lt PowerUpManager gt ().enabled false public void UnPause() Time.timeScale 1 pauseButton.SetActive(true) unPauseButton.SetActive(false) PauseGameMenu.SetActive(false) GameObject.Find("PowerUpSpawner").GetComponent lt PowerUpManager gt ().enabled true isPaused false
0
Swiping with rigidbody My character moves continuously forward with rigidbody.velocity v3Force strength My Swipe script is based on a youtube tutorial from https www.youtube.com watch?v 9ZIHx09GevI I just changed the end result with rigidbody.AddForce(v2Force strength1) For Right Swipe and below for Left Swipe rigidbody.AddForce(v1Force strength1) Here are the vForce variables var v1Force Vector3 transform.right var v2Force Vector3 transform.right var v3Force Vector3 transform.forward The swipe works fine, but the result isn't what I'm aiming for because when I swipe left right my character seems to be moving only one frame left right. And then continues moving forward. When I disable the forward movement, the swipe works great and makes my character move right left for a period of time, after I swipe. My question is how do I reach this result(moving sideways more than just a frame) with my continuous forward movement enabled?
0
Making NavMeshAgent to look the direction it was moving when it stops I'm currently using NavMeshAgent as my player character controlled by keyboard or gamepad input. Also, I'm flipping my character instead of turning via controlling localScale as below. private void FixHeadRotation() float dir (myAgent.velocity.normalized.x gt 0) ? 1 1 transform.localScale new Vector3(1, 1, dir) However, since I'm relying on the velocity I'm getting the direction(flip) right when moving, but not when I'm not moving(x should be 1 but 1 since no velocity). I've noticed the NavMeshAgent has built in function displaying an arrow gizmo over the agent's head. Perhaps I could use that(don't know how atm)? or any other suggestions to this?
0
NullReferenceException until tile is spawned I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script is in tile my ray script is in my player so im reaching from my PlayerMove script to spawner script, but until my tile is spawned i get this error NullReferenceException Object reference not set to an instance of an object because tile is not spawned yet after its spawned error stops, but after tile is deleted it starts again how can i get rid of this error. PlayerScript private Spawner spawner private RaycastHit hit private void Update() spawner GameObject.FindGameObjectWithTag("Spawner").GetComponent lt Spawner gt () DrawRay() private void DrawRay() Ray ray Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0)) if(Physics.Raycast(ray,out hit)) if(hit.collider.tag "SpawnerCollider") if(hit.distance lt 5) Destroy(hit.collider) spawner.Spawn() SpawnerScript public Transform spawnPos public GameObject fireBall public void Spawn() for (int i 0 i lt spawnPos.Length i ) Instantiate(fireBall, spawnPos i .position, Quaternion.identity)
0
How do I set a scene up for two players? I m finishing a game in Unity, but I have a new requirement make it multiplayer. I will do this by splitting the screen and running two instances. Is there a way to instance a scene twice at the same time, and render them two a different part of the screen? Alternativley, what is the best approach to achieve this?
0
How would I go about adding a tooltip to a Unity UI Image? I'm going to try out the community here once more, I haven't had very good look in the past with getting help. I'm iterating through a series of List() and I'm creating a bar graph and a line graph based on those values, Later I'll replace the List with a file which it retrieves the values from. I'm having a problem though with creating a tooltip. I know how to add them to buttons created under OnGui() but that's about it. I've spent the past 2 days trying to figure this out and I'm just not sure how to go about making the bar images and dot's show up under public void OnPointerEnter(PointerEventData eventData) and OnPointerExit() I know that print(eventData.pointerCurrentRaycast.ToString()) will display the item I'm hovering over and it seems to work fine for everything except the GameObjects that are created by my script private GameObject CreateBar(Vector2 graphPos, float barWidth) GameObject gameObject new GameObject( quot bar quot , typeof(Image)) gameObject.transform.SetParent(graphContainer, false) gameObject.GetComponent lt Image gt ().color barColor RectTransform rectTransform gameObject.GetComponent lt RectTransform gt () rectTransform.anchoredPosition new Vector2(graphPos.x, 0f) rectTransform.sizeDelta new Vector2(barWidth barWidthMultiplier, graphPos.y) rectTransform.anchorMax new Vector2(0, 0) rectTransform.anchorMin new Vector2(0, 0) rectTransform.pivot new Vector2(.5f, 0f) return gameObject If anyone could give me a hand on how to make this show up under eventData I can figure the rest out from there. Or if you have a better method you wouldn't mind sharing I would appreciate that.
0
Very less vertical transformation Im using pretty basic code here charcter.transform.Translate(Vector2.up speed Time.deltaTime) Im using rigidbody 2d and I'm creating a platformer. When i press the button the character transforms very little in y axis.
0
Loop through multidimensional array in C (Unity) I have this data As you can see there's a 2nd board there. Now what i want is something like this PSEUDO CODE If the first boards table 1,1 is not NULL then I will need to find out now if table 0,1 and table 0,0 has the same length as table 1,1 and table 1,0 then display in the 2nd board a blue circle if it is the same in length if not red circle But if the table 1,1 is NULL then I need to know compare 1st column and 2nd column if they have the same length then display in the 2nd board a blue circle if it is the same in length if not red circle END PSEUDO CODE I tried doing the following COLUMN for(int col 0 col lt table.GetLength(0) col ) int sum 0 ROW for (int row 0 row lt table.GetLength(1) row ) if (table col, row ! null) Debug.Log("Column 1 has this value " table col, row ) Debug.Log("table column " col " has " sum " data") For now I can only get the whole Row and Column but I don't know how to do that pseudo code.
0
Prevent VS Code opening the Unity scripts twice Is it possible to prevent VS Code opening the Unity scripts twice? E.g. I opened Unity project, double clicked a script and got my project (Assets folder) opened in VS Code, now I go to Unity make a few changes and open another script file. The script file opens another instance of the VS Code. I would like to have the file opened in the currently opened instance instead of opening a new one. Is it possible? Thank you.
0
Loading next scene when counter is down to 0 I am trying to let my Unity project load next scene when the counter I have is down to 0. However I am unable to do that for some reason. The way I am trying to do it by int i SceneManager.GetActiveScene().buildIndex void Update () if (GameObject.FindGameObjectsWithTag("Birds") null) SceneManager.LoadScene(i 1) In the editor I have created a folder where I have made 3 scenes. Have called them Level 1, Level 2 etc. What am I doing wrong?
0
How do I set up a bullet to fire towards the mouse pointer? I am making an FPS, in Unity. I have a player with a gun, and I have a bullet prefab. I changed the mouse pointer to look like a crosshair, but I don't know how to place the bullet where the crosshair is aiming. The player movement is on the x and z axis. I have done lots of research on the Internet, and couldn't find anything suitable most of what I found, I could not understand enough to change it according to my needs. How do I set up a bullet to fire towards the mouse pointer?
0
Jenkins CI with Unity on local machine I have seen some people using Jenkins CI with Unity, would it be wise to install Jenkins locally and use it with Unity? I've never used Jenkins, so I can't imagine why not. Is this ill advised? I would have set up Jenkins on my old laptop, but I don't have windows on it. Is there any harm in using it locally?
0
Transactions on lists of coins of different values For learning purposes, I am developing the first steps of an idle game with exponentially higher income numbers. Usual int, long, etc. can't store big enough numbers for that. I looked through many threads which I found on google and using a list (or an array) which is separated in e.g. bronze coins, silver coins, gold coins, etc. seems to be the cleanest version. In my first approaches I created this list namespace Coins public class script coinHandler MonoBehaviour public List lt Coin gt coinList new List lt Coin gt () list based on the quot Coin quot class new Coin() Name quot bronze quot , new Coin() Name quot silver quot , new Coin() Name quot gold quot , new Coin() Name quot diamond quot , public class Coin public string Name get set public int Amount get set public int Multiplier get set I want each coin type to go up to 999999. This means 1 silver 1000000 bronze, 1 gold 1000000 silver. I can't get my head around a way to do maths with this list. Example Player has 3000 GOLD, 320000 SILVER, 524321 BRONZE Player wants to buy something for 20 GOLD, 120000 SILVER, 300000 BRONZE Just subtracting 20 from GOLD, 120000 from SILVER, and 300000 from BRONZE won't always work. For example when a Player has no BRONZE but some SILVER you can't subtract 300000 BRONZE without converting SILVER to BRONZE first. Q What would be an efficient function to subtract the price from the total amount? What about multiplying and dividing? Accuracy is not important. When spending a few GOLD, nobody will care about 10000 BRONZE.
0
Which collider to use on "island" situation? I have a 2d top down unity game where the player is on an island. The shape of the island is random generated and he is not able to "escape" from the island. So which Collider should I use for realizing this? Is there some form of an "inverted" collider? Are colliders able to have a hole in them? Or should I create a polygon collider with a small gap (This could be quite difficult if the polygon bends the wrong way)?
0
Unity3d crash on Launching on Ubuntu I have a problem that bugged me for quite some time now I'm trying to Install Ubity3d on Ubuntu I Followed some instructions that i've found after some research I downloaded and installed UnityHub and the latest release (UnitySetup 2019.1.0f2) that i found on Unity on Linux Release Notes and Known Issues and i moved the installed unity file from Home to opt folder and made it run on command unity3d and here is what i did exactly sudo mv Unity 2019.1.0f2 opt Unity3D sudo ln s opt Unity3D Editor Unity usr bin unity3d and the problem is that every time i open Unity editor (via both the command line and UnityHub) the unity Launcher appears for moments to proccess and then crashes and the editor doesn't open and the error changes everytime i try to open the program here are 3 forms of errors that appeared to me, here is the first Gtk Message GtkDialog mapped without a transient parent. This is discouraged. Gtk Message GtkDialog mapped without a transient parent. This is discouraged. Gtk Message GtkDialog mapped without a transient parent. This is discouraged. Gtk Message GtkDialog mapped without a transient parent. This is discouraged. Unity Package Manager (Upm) Parent process 5258 was terminated Segmentation fault (core dumped) and the second Gtk Message GtkDialog mapped without a transient parent. This is discouraged. Gtk Message GtkDialog mapped without a transient parent. This is discouraged. (unity editor 6651) Gtk CRITICAL gtk file chooser widget set current name assertion 'priv gt action GTK FILE CHOOSER ACTION SAVE priv gt action GTK FILE CHOOSER ACTION CREATE FOLDER' failed Gtk Message GtkDialog mapped without a transient parent. This is discouraged. Unity Package Manager (Upm) Parent process 6651 was terminated Segmentation fault (core dumped) the third is Gtk Message GtkDialog mapped without a transient parent. This is discouraged. 0616 110743 ERROR browser main loop.cc(161) Running without the SUID sandbox! See https code.google.com p chromium wiki LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on. 0616 110744 ERROR browser main loop.cc(207) Gtk gtk window present with time assertion 'GTK IS WINDOW (window)' failed ATTENTION default value of option force s3tc enable overridden by environment. USER USER Unity Package Manager (Upm) Parent process 7583 was terminated and stuck on that.... well i know that there's something wrong with GTK but i have no experiace with it and i didn't find anything useful on this matter on google OS Ubuntu 16.04 LTC
0
How to use rigid bodies for characters? First off, I am making a game similar to SSB, which relies heavily on physics, even though it is a sidescroller. I am currently using Unity. In Unity there are quot character controllers quot which are used for characters that move, but they don't interact with other physics objects. There are also rigid bodies, which are completely realistic physics components. I can't figure out how to use rigid bodies for human humanoid characters. Here's some questions I have How should I move the character? Applying forces is not the way to do it, right? Would you set velocities or pixel by pixel movement, perhaps? What kind of collider should I use? I've been using a capsule collider. But is that the best way? How do you make him not fall down!? After some experimenting, I discovered that the character falls over (from applying force velocity and from the capsule collider tipping it over). Would you constrain the rotation in the Z axis? What do you do when he gets hit? If you've ever played SSBB you'll be familiar with this topic. I'm thinking that applying a force would be best in this condition? If you did constrain the rotation, would you un constrain it?
0
Execute function every X points In my game, the score can go up quite rapidly and by varying amounts, depending on the action taken. For instance, at the start of the game, one could climb from 1 50 one by one, or they could rocket past 50 by getting a score of 10, 25, and 40. My question is How do I call a function every time they pass a factor of 50 (50, 100, 150, 200, etc.)?
0
Find the coordinates between two points based on third You can see two points in this picture. Points are surrounded by collider which is set to trigger. Points can either be Vector3 or Vector2, shouldn't make any difference. I need to get the coords on gray line if mouse enters the trigger, at the exact point where mouse and gray line form 90 degree angle. Gray line is just an straight line between 2 points. All the data left point coords right point coords mouse coords Is it possible with the data I have and how?
0
Understanding Torque in Unity This is (hopefully) a simple question that should avoid me asking a more complex question. This is in Unity (2D) but hopefully this is a general physics principle I am not getting. I am applying a torque to a 2D object. The object has a scale of 1, a RigidBody2D with a mass of 1 and no angular drag or undergoing gravity. It is a CircleCollider2D with a radius of 1. There is nothing else attached to the object. In the following code I apply a torque of Pi for one second. In linear motion (and from my understanding of torque) I would expect the angular velocity, after one second, to be Pi (or 180deg s). However, running this code and printing out the speed at t 1.0, the speed is 90deg s. void FixedUpdate() if (time lt 1.0f) rigidbody2D.AddTorque(Mathf.PI) This is consistent, applying a torque of 2Pi gives me a velocity of 1Pi after the time. Where is this factor of 2 coming from?
0
Does transparency work with SSS in Unity's HDRP Lit shader? I am using Unity's HDRP Lit shader in Shader Graph (all are version 4.8.0 preview) on Unity 2018.3.0b12. I am trying to use both transparency and subsurface scattering on the material. However, it appears that the visual appearance loses SSS when transparency is introduced. Example The cube on the left has transparency enabled, and has no visible SSS. The cube on the right has the same SSS settings as the left cube, however the right cube has no transparency enabled. I need transparency to fade in the cube depending on its position, like this And here is my master node If anyone has an alternative solution that sidesteps this potential limitation, I am all ears. Cheers!
0
Unity Vector3 position inside collider I am trying to create a "wander" action that will make my NPC walk to a random position. The catch is that the NPC should only go positions inside of a collider. I have a huge Sphere that has a collider on it now I only want my NPC to go to positions that are inside that Sphere collider. My question is how do i find a random position inside of a colider? Update So after testing i am unable to use colliders because the sphere is too big here is an image of my gameobject As you can see from the image I have a huge sphere that my NPC's will have to stay inside when wandering In order to use the Collider.ClosestPoint() the collider has to be a Box, sphere or a mesh collider with a convex. Sadly this is not feasible for me because the sphere should not collide with other objects. So my question is how do I find a point inside this gameobject?
0
Unity blur on one camera effects the other as well I'm trying to fake a DOF effect for Sprites by using 2 cameras, one for the sharp objects, one for the blurred ones. I have set up the layers like Blur and Sharp accordingly. So I have these 2 cameras, and I use Unity's Blur (optimized) script to blur things, and I have this script on only one camera, the one that is responsible for the blurred render. I have the cameras like Cam 1 Clear flags Don't clear (this is the main, sharp cam) Culling mask sharp layer has no blur effect (or any other post proc effect). Cam 2 Clear flags don't clear (this is the blur cam) culling mask blur Has Blur (optimized). Now, if this blur cam is on the back, meaning its depth is LESS than the main cam's depth, I have a sharp player ground and a blurry background. However, I need a blurry foreground too that should be on top of the player ground. The issue starts when I set the blur camera's depth higher than the main cam's. In this case, everything gets blurred, no matter that the main cam has no blur effect on it. Question is, how to set this up so only the desired layers get the blur?
0
How do developers implement custom systems (lighting, physics, etc.) in premade game engines that already have these systems, like Unreal or Unity? Unreal has built in systems for stuff like lighting, for example. If a developer wanted to create and use their own lighting system in Unreal, how do they go about doing that? Or are these systems already so customizable that creating a custom system isn't necessary?
0
Unity move Vector3 position with transform How can I move a new Vector3 position with a Transform? Like the transform is the parent the vector. Example if I want to push the x position for example by 10 value and I rotate the transform its push in world coordinate but I want to push by the rotation too. void Update () temp transform.Find("Transform").position temp new Vector3(temp.x 10.0f, temp.y, temp.z) Debug.DrawLine(transform.Find("Transform").position, temp)
0
How do I prevent floating and jittering when on the ground and using spherical gravity? TL DR My ship floats and jitters when it lands on a sphere. To elaborate on the title I'm experimenting with a 3D space game. I have created a sphere, which in turn has a larger sphere overlapping it, within which, gravity will take place. However, once my player's ship (currently using an arrowhead) lands on the planet, it doesn't actually make contact with the surface of the sphere, and then the ship begins to rotate erratically and jitter. Code below. private void OnTriggerStay(Collider other) if (other.CompareTag("SoI")) inSoI true This trigger checks to see if the ship is in the larger overlapping sphere. I have another identical block for OnTriggerExit which sets inSoI to false. I also have a OnCollisionEnter which sets another variable, landed to true, and a OnCollisionExit which sets it to false. private void FixedUpdate() if (inSoI amp amp !landed) gravityVector (planet.transform.position transform.position) rb.AddForce(gravityVector.normalized planetrb.mass rb.mass gravityVector.sqrMagnitude) Simply, if in the larger sphere, then accelerate towards the planet. I tried disabling gravity if in contact with the sphere. It removed a lot of the jitter, however it still floats, and it still rotates side to side. The sphere by the way, is the standard Unity sphere, scaled 10000x in every axis. I don't need code (though it would help), any solution is fine, even if it means abandoning the project.
0
Emit particles from only some parts of a mesh I have a 3D mesh with 3 sub meshes in it, for 3 different materials. I would like particles to spawn from the mesh, but only from location where one of the material is assigned. How can I make this happen?
0
Game is darker on build I've been recently doing test builds of my game. In Unity, I worked on baking the lighting to ensure everything looked fine. However, upon building, the game level becomes far darker and much of the lighting and baking is ineffective. Here is how the scene looks in the editor And here is how it looks in the built game It's much darker than intended. Here are my lighting settings which I've baked in Unity's Editor. These settings and lightmap parameters were designed to, at least in the editor, provide decent quality while making light bake times relatively quick. However, I've noticed that newer Unity's Lighting settings are way different now, so perhaps something is amiss here? I've been at my wits end trying to figure this out for the past while, but I can't figure out why this is happening or how to fix it. Any ideas?
0
Unity Vector3 position inside collider I am trying to create a "wander" action that will make my NPC walk to a random position. The catch is that the NPC should only go positions inside of a collider. I have a huge Sphere that has a collider on it now I only want my NPC to go to positions that are inside that Sphere collider. My question is how do i find a random position inside of a colider? Update So after testing i am unable to use colliders because the sphere is too big here is an image of my gameobject As you can see from the image I have a huge sphere that my NPC's will have to stay inside when wandering In order to use the Collider.ClosestPoint() the collider has to be a Box, sphere or a mesh collider with a convex. Sadly this is not feasible for me because the sphere should not collide with other objects. So my question is how do I find a point inside this gameobject?
0
Animator.SetTrigger does not trigger an Animation I have a basic animator setup for my Unity Character which has a "block" functionality when pressing the E key. So far, so good. However I've made a transition from "Blocking Idle" to "Blocking React" (which means that the character was hit) using a Trigger "tookDamage" (default to false). The problem is that the character gets hit but does not transition to "Blocking React" animation. Code Sample From Character Controller script if (Input.GetKeyDown(KeyCode.E) amp amp ! isBlocking) animator.SetBool("isBlocking", true) isBlocking true else if (Input.GetKeyUp(KeyCode.E) amp amp isBlocking) animator.SetBool("isBlocking", false) isBlocking false From my Character script public void TakeDamage(float damage) health damage this.GetComponent lt Animator gt ().SetTrigger("tookDamage") And this is my transition Am I missing something?
0
How to check if a test ad is ready I was going through UnityAds for Unity3D, and came across this setting AD TEST MODE Force all So as I understood it states that I will be able to see real ads, in test mode, without monetizations on my testing tool, which in my case is Unity3D IDE, but I am still getting that blue sample ad screen quot Here would be your ad screen quot . Is there anything that I can do to check if any ad is placed for my app, and check this via code before Advertisement.Show() statement? Or am I missing something?
0
Iterating through all animator layers in Unity Mecanim I'm aware of how SetAnimatorLayerWeight works, I'm looking for a way to iterate through all layers of my controller at runtime. I've four layers and expect more, and need to update them at once, in essence, what I'm trying to do is something like this. To clarify The code below is boilerplate of what I'm trying to do. void SetCurrentWeaponLayerWeight(int index) animator.SetLayerWeight(index, 1) foreach(AnimatorLayer l in Animator.Layers) if (l.index ! index) animator.SetLayerWeight(l.index, 0)
0
Is wireframe effect possible without geometry shader? I am trying to write a shader that highlight the edge between each pair of vertices, much like the UCLA Wireframe Shader. All implementations I came across require geometry shader support. I am wondering if this is possible with just vertex and fragment shaders? (Of course, I can use texture to workaround it but I am trying to avoid create custom textures for each model that I need this effect. On the other hand, I could just use geometry shader but it presents quite a problem when porting to iOS, which lacks support.)
0
Build includes sprite packer atlas and its original textures I use Unity's Sprite Packer, it's working great. However, when I looked at the build report (in the Editor.log) it turns out that the build often includes the generated atlas texture and its original textures too. It wastes too much space. I checked the size of the unzipped APK and the build report was correct. I tried several configurations (adding and removing textures) but I could not find any regularities. Some observations I could reproduce this only if I use 25 textures in an atlas with variable sizes. Texture compression settings did not matter. Packer policy could modify the result but did not solve the problem. Has anybody had similar experience? I can upload my test project if necessary.
0
Why does my tile palette not arrange nicely? I made my own Hex Point Top Tile sprite sheet, ensuring it's pixel perfect and align well. Slicing in Sprite Editor has no problem too. However, when I drag the sprite sheet to a new Palette in the Tile Palette panel, the tiles show up with random spaces. See screenshot below What did I miss? The sprite sheet is here, 30 x 30px offset, 24 x 24px padding, 66 x 66px tile size I'm using Unity 2019.3.10f1.
0
How to know my lighting shaders matches famous models? I have some diffuse and specular lighting shaders based on famous models like lambert etc. Thing is, how can I know that my shader is actually implementing the correct formula? I can see my materials does reflect light but how can I be sure that my formula matches the models. Any way to test this?
0
Unity c How to slow down rotation over time? I am making a space combat game, in which the player can press q and e to roll their ship. I did this by adding torque to the rigid body when the player press q or e. However, after they do so, they keep on rotating. How do i make the angular velocity slowly go back to zero? I tried using angular drag, but that does not work. public float TurnSpeed public Rigidbody rb float currentturn Vector3 turn float turnEnabler bool iszero public float dampener Update is called once per frame void Update() rb.AddTorque(new Vector3(0, 0, turnEnabler)) if (Input.GetKey("e")) turnEnabler TurnSpeed if (Input.GetKey("q")) turnEnabler TurnSpeed rb.angularDrag dampener
0
Unity store data in database Is it possible to store assets used in a Unity game (2D or 3D) in the database? I think it is less efficient but want to have single source of truth and maybe have the game contact the database everytime it loads to get the new updates.
0
Why are cube map axes sometimes labelled incorrectly? In both 3ds Max (which uses a right handed coordinate system) and Unity (which uses a left handed coordinate system), the cube map faces labelled "left" and "right" show the view facing the opposite direction. This is not the case with the front, back, up, or down directions. In 3ds Max, this is in the context of rendering cube map images from a Reflect Refract map. In Unity, both cube map textures and skyboxes exhibit the same left right "confusion". Oddly, however, the GUI labels for cube maps indicate that left is the X direction and right is the X direction which is correct in Unity while skyboxes indicate the opposite (all other axial labels are consistent between the two). The upshot of this is that cube map images rendered by 3ds Max (which each have a suffix indicating their viewing direction) can be assigned to the texture slots in Unity with the same name and everything will work, but only because both programs label the left view as "right" and vice versa. The only discussion of this I was able to find online was in a blog post on floored.com (search for "Unity Skybox Weirdness" and it should come up I'd post a link but I lack sufficient reputation to include more than two). Here's an image from the post that illustrates the issue Is there a reason why the left right axes of cube maps are mislabelled in both of these programs? Although it's trivial to ignore once you're aware of it, it seems like there should be a good (or at least historical) explanation for it, unless it's simply a case of a long overlooked bug in 3ds Max that the Unity developers decided to accommodate. Any thoughts would be appreciated!
0
How to disable animation root motion I downloaded some animations with root motion from Mixamo and the corresponding character model. After created an animator with those animations and added it to the character game object, the root motion was causing the transform to move around, which was not supposed to happen. I tried to uncheck "Apply Root Motion", and set "Motion Root Motion Node" to "None", but neither of them worked. The only thing that worked is checking "Loop Time Loop Pose", but it doesn't make much sense to mess with root motion, someone even proposed it shouldn't disable root motion. So, how to disable animation root motion? Also I'm confused, is root motion optional? Must I get animations without root motion if it's not needed?
0
Voxel terrain generation performance problems I am trying to create a minecraft clone to practice some stuff in Unity including Raycasting, terrain generation and player controlls. Terrain is generating without any problem with a perlinNoise. My problem is the then following performance problems. The terrain is only 1 block high with no underlying blocks. Each block constist out of 6 quads with a 64x64 texture. I generate terrain at 200 x 200 size. I can't imagine why 4000 voxels with such simple textures can lag out whilst my pc runs objects with 50k tris and complex textures without any problem. My code ... public int xVoxels 200 public int zVoxels 200 ... for (int x 0 x lt xVoxels x ) for (int z 0 z lt zVoxels z ) voxel script parameter GameObject newVoxel GameObject.Instantiate(voxel) Vector3 position new Vector3() position.x xVoxels 2 x position.z zVoxels 2 z PerlinNoise stripped out for testing position.y 0f newVoxel.transform.position position Solutions I tried Combining meshes Combining all meshes to a single one per material worked wonderfully... until I wanted to interact with each voxel determined by Raycasting from the Camera, I had a raycast hit to the combined mesh and not to my determined voxel Generating the planes myself Instead of using the unity plane object I generated all vertecies myself, same performance problems
0
How can I simulate a "Hot Swap" betwen Audio Clips? I have a Unity project with 3 separate looping Audio Clips and a single Audio Source. Based on certain events, I swap between which of them are playing. This works fine, but whenever I swap between Audio Clips, the AudioSource stops playing, and must be restarted... which means it starts over from the beginning. As the Audio Clips are the same length, how should I handle the logic to pickup where the previous Clip last left off? Neither Unity's AudioClip nor AudioSource classes seem to have either a "PlayFromTime()" or "GetPercentPlayed()" method that would facilitate using a single Audio Source. What's the expected way to handle such a scenario? Simultaneously "play" from 3 AudioSources at once, muting 2 of them and leaving the last the only one that is actually heard?
0
Unity Mesh importing as child of armature I'm following along with this tutorial by Sebastian Lague https www.youtube.com watch?v yhPRkihs Yg amp list PLFt AvWsXl0f4c56CbvYi038zmCmoZ4CQ amp index 14 However, when I import my character from Blender into Unity, the sword and shield mesh are children of the armature instead of siblings like the shirt pants shoes etc. I'm fairly certain this is because the sword and shield are parented directly to bones on the hands, I'm just not sure why they import as children of the mesh unlike in the video.
0
Breaking up List into sublists by multiple values I'm trying to break up a C List lt InventoryItem gt into multiple lists based on two different values InventoryItem.name and InventoryItem.isStackable. I want the list to be broken up into multiple lists for the purpose of populating my UI with the data while keeping non stackable items in their own list (one item per item slot in UI terms.) If this is the input InventoryItem name apple, stackable true InventoryItem name apple, stackable true InventoryItem name carrot, stackable true InventoryItem name knife, stackable false InventoryItem name knife, stackable false I should get this output InventoryItem name apple, stackable true InventoryItem name apple, stackable true InventoryItem name carrot, stackable true InventoryItem name knife, stackable false InventoryItem name knife, stackable false I'm successfully separating by name alone (see below), but I'm not sure how to take isStackable into account. I'm also using LINQ which I'd prefer to avoid if possible. var itemsByType new List lt List lt InventoryItem gt gt () var inventoryByItem inventory.GroupBy(x gt x.name) foreach(var v in inventoryByItem) var itemList v.ToList() itemsByType.Add(itemList)
0
Text Pooling Optimizations In my game I have created popup text for gained points when enemies are killed. it pops up wherever the enemy was and will say something like " 32" float up a bit and fade away at the same time. This transition lasts for a few seconds if that. and hundreds could appear at a time when AoE attacks destroy a lot of enemies. That's all well and good. and it works! but I fear that this could become quite slow on mobile devices. So I did what any good game dev does. I pooled it! Then it occurred to me. I'll still be changing the display value of the text elements dynamically and libraries like TextMeshPro already, in surely an optimized way, instantiate actual meshes to render text. So is pooling these text elements really a big optimization? so here goes my question for experienced and knowledgeable devs. Is it more efficient to pool each character I need and assemble my short strings dynamically as sets of pooled gameobjects for these popups of just a few characters or should I simply pool text elements that will change their text just before appearing? Assume the memory usage difference is minimal. only worried about speed. This is on top of the game having possibly thousands of projectiles moving at any given time, so I believe it is a valid optimization question, but I ask this more for curiosity than practicality. For now, I already have a working solution. but I believe such an issue could arise in the future. and want to satisfy my curiosity now.
0
How to handle multiple enemies with the same script? i'm working on a basic Top Down Shooter, kind of like... Nuclear Throne or The Binding of Isaac, but since i'm new to Unity, and it's something i'm required to do for school, i'm quite in a rush so i didn't have enought time to look at all the documentation i should've, so i apologize if i'm asking too much. The thing is like this I have the Player that moves around, and a Sword that rotates in the mouse direction, clicking the mouse activates a Trigger Collider around the Sword, and it's suposed to Hit all enemies inside its range The problem How should i "plan" my Scripts? i mean, i have a Sword script that handles the click and the OnTriggerEnter, and it should, somehow (Working on it), check if it hit an enemy, and access the Enemy Script to modify its Life Points, but how do handle the GameObject Enemy GameObject.FindObjectWithTag("Enemy") ... ? since this just gives me one enemy... I apologize again since i'm really bad at focusing on one point, i dont think it's neccessary to provide all the code since i dont really need you to provide me with code, just... guidelines or a basic pattern of doing this kind of things. Thank you a lot!.
0
Custom List Editor dependent on data from separate class's data I want to make a custom inspector that I'm not really sure how to approach. The idea is I have a quest framework with a class that holds onto the quest data and another class that is intended to hold onto dialogue data. The quest system is agnostic of my dialogue system. I want to be able to display the quest and dialogue data this way QuestName0 DialogueGiveQuest (TextAsset field) DialogueQuestIsActive (TextAsset field) DialogueQuestIsComplete (TextAsset field) QuestName1 DialogueGiveQuest (TextAsset field) DialogueQuestIsActive (TextAsset field) DialogueQuestIsComplete (TextAsset field) etc... Here's a pseudocode class layout public class QuestData MonoBehaviour List lt Quest gt quests public class DialogueData MonoBehaviour public TextAsset dialogueGiveQuest public TextAsset dialogueQuestIsActive public TextAsset dialogueQuestIsComplete public class Interaction MonoBehaviour QuestData questData List lt DialogueData gt dialogueData CustomEditor(typeof(Interaction)) public class InteractionEditor Editor public override void OnInspectorGUI() var interactionData (InteractionData)target foreach interactionData.questData.quests draw quest name make sure there's a dialogueData element for each quest draw field for each DialogueData An obvious issue is dialogueData doesn't care about what's going on with questData.quests so if the inspector were to draw normally it would display 2 lists. I'd like the dialogue data to add and remove elements to itself depending on the quest data but that sounds like it be a real challenge to serialize.
0
How can I make the player(transform) to rotate once each time the player exist the collider and to rotate him slowly smooth? using System.Collections using System.Collections.Generic using UnityEngine public class PlayerSpaceshipAreaColliding MonoBehaviour private float timeElapsed 0 private float lerpDuration 3 private float startValue 1 private float endValue 0 private float valueToLerp 0 private Animator playerAnimator private bool exitSpaceShipSurroundingArea false Start is called before the first frame update void Start() playerAnimator GetComponent lt Animator gt () Update is called once per frame void Update() if (exitSpaceShipSurroundingArea) SlowDown() if (playerAnimator.GetFloat( quot Forward quot ) 0) transform.rotation Quaternion.Inverse(transform.rotation) private void OnTriggerEnter(Collider other) if (other.name quot CrashLandedShipUpDown quot ) exitSpaceShipSurroundingArea false Debug.Log( quot Entered Spaceship Area ! quot ) private void OnTriggerExit(Collider other) if (other.name quot CrashLandedShipUpDown quot ) exitSpaceShipSurroundingArea true Debug.Log( quot Exited Spaceship Area ! quot ) private void SlowDown() if (timeElapsed lt lerpDuration) valueToLerp Mathf.Lerp(startValue, endValue, timeElapsed lerpDuration) playerAnimator.SetFloat( quot Forward quot , valueToLerp) timeElapsed Time.deltaTime playerAnimator.SetFloat( quot Forward quot , valueToLerp) valueToLerp 0 When the player exit the collider area he slow down then stop. at this point I want the player to start rotating and start moving back inside the colliding area. The exit and the slow down are working but the rotation is not working and not sure how to make him start moving again slowly to max speed when entering back. The main goal is to prevent the player to leave the marked colliding area with some slow down and rotation. For the rotation I did transform.rotation Quaternion.Inverse(transform.rotation) but it keep rotating non stop and not slowly smooth like using Lerp.
0
Change velocity of CharacterController? I'm trying to change the velocity of a character controller component on a Third Person Controller, but when I try to change it, the console says the velocity is read only. This is my code. P.GetComponent(CharacterController).velocity 0 (P is my player GameObject variable) So, any ideas on how to change this? Thanks, Chris.
0
Pointers in C Unity Hey I've just learned about pointers recently and am wondering how I can use them in c (I just learned about them in c ) in unity. I do have some questions though. Pointers use low level programming to find positions of different values on the computer so does that mean that you can just access a the value of a variable from any script? If so how do I just call upon a location of a variable with just its location code? Are there any discernible differences between pointers in C and C that I should know? How can I use pointers with the variable types in Unity (Vector3s, Transforms, GameObjects, etc...)? There are so many more questions I probably should and would like to ask so if you have any additional info or sources.
0
Unity Car Rollover Protection I have a standart Unity car with Unity Car physics. What would be the best approach to protect my car from a rollover? I dont want to mess up and try and error 10 different approaches, so maybe here is an expert who really knows how to do it right? I couldnt find anything decent on the internet.
0
Do Gradle 'implementation' replace Unity Jar Resolver dependencies? I have a project with several Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins Android. When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file dependencies Your other dependencies compile fileTree(dir 'libs', include ' .jar' ) compile 'com.google.android.gms play services ads identifier 16.0.0' compile 'com.android.support support v4 27.1.1' DEPS Your other dependencies ... AdMob's dependency compile 'com.google.android.gms play services ads 17.1.1' Because one of my dependencies that the jar resolver imports is an older version of support v4 my build fails. Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process? Is there any pros cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.
0
How to add time delay in Unity C So I'm trying to make a camera zoom in, but Thread.Sleep doesn't work. Here is the code void Start() for (int a 0 a gt 1000 a a 1) Debug.Log( quot Done! quot ) Thread.Sleep(100) The error code is this Assets StartScene CamScript.cs(12,13) error CS0103 The name 'Thread' does not exist in the current context
0
Is there a way to convert shader graph to shader code for older version? Editing Shader in a graph is brilliant feature, however it's only works in Unity 2018 with Lightweight RP template. So I want to use the shader made from shader graph in Unity 2018 to older versions, such as 2017 or 5.x. There is a button to compile the shader to code but unfortunately when I drag into 2017 it gives me syntax error so I can't use it. Is there a way to use the shader made from Unity 2018's graph editor to older versions of Unity?
0
Execute a function for ten seconds and disable it for two seconds I have a particular function which I am calling in Update function. For the first ten seconds, the function should get called in Update function, then it should get disabled for next two seconds, then again enable it for next ten seconds. This cycle should keep repeating? How can I execute it?
0
How to create "broken glass" animation? I have started making a 3D game in Unity5 that consists in avoiding obstacles. It is very easy but I want to add a collision effect when I collide on the wall. I would like to slice the screen into many parts (random pieces is better) that are falling down from screen with gravity. An example of what I mean How can I do this? I've tried using a lot of different images (shapes) but I'm sure that is not the best way... Thanks for any suggestions.
0
How I randomise a list of audio clips in Unity and remove it from the list once the clip is finished? I have 4 audio clips. When I play a press a certain button in Unity, the data is sent to MAX MSP and the audio is played. I created a list a signals (As shown below in the code). What I want is that, the signal list is randomised. The user presses a button to listen to the audio (which works fine). Once the clip is finished the user presses Next Trial button. Once the Next Trial is pressed. The previous clip is removed from the list. Once all the clips are finished. A message is displayed in the Debug.Log( quot All trials finished quot ). I have the following problems One of the audio clips is repeated again. It appears that the audio clips are not removed from the list. How do I write the audioclip index to a csv file? Code public class SignalToMax MonoBehaviour private static int localPort private string IP define in init public int port 8050 define in init quot connection quot things IPEndPoint remoteEndPoint UdpClient client experiment case public string experimentCase quot A quot string strMessage quot quot public List lt int gt signals public static int stimIndex void Start() NextTrial GameObject.FindGameObjectWithTag( quot NextTrial quot ).GetComponent() signals new List lt int gt 1, 2, 3, 4 define IP quot 127.0.0.1 quot port 8050 Senden remoteEndPoint new IPEndPoint(IPAddress.Parse(IP), port) client new UdpClient() NextTrial.onClick.AddListener(Advance Trial) void Advance Trial() int signalIndex Random.Range(0, signals.Count) int currentSignal signals signalIndex stimIndex currentSignal signals.RemoveAt(signalIndex) string text signalIndex.ToString() byte data5 Encoding.ASCII.GetBytes(text) client.Send(data5, data5.Length, remoteEndPoint) Debug.Log( quot lt color magenta gt Current source signal is lt color gt quot currentSignal) if (signals.Count gt 0) Debug.Log( quot lt color blue gt Signal count before removal was lt color gt quot signals.Count) Debug.Log( quot lt color yellow gt Source signal removed lt color gt quot ) else Debug.Log( quot lt color green gt All Trials finished lt color gt quot )
0
2D Boat controlling physics I'm working on a top down 2D boat game with Unity3D. I couldn't able to understand how to implement physics of rudder controlling. My physics knowledge is not enough to think how rudder dynamics work. How rudder dynamics works in water? Can you help me for finding a starting point for this? Since I'm not able to think any solution for this, I can't provide an example code. EDIT I'm trying to apply a force to rigidbody2D of the ship at the point of rudder with angle of the rudder. But I couldn't able to make something working Sample Code I draw a sketch. Red point is location of rudder. I'm trying to apply a force at that point with angle of rudder relative to ship heading on each Update. How can I do this?
0
Models keep turning white Unity 5.3.5p1 I'm using Unit 5.3.5p1 but for some reason my models randomly turn white after I build an exe to run outside the editor. The textures work perfectly fine within the editor, but as soon as I build and run outside they sometimes show with appropriate colour, but many times do not and end up blank white. Does anyone know what might be causing this in general? I've downloaded the latest unity shaders and replaced all current shaders. Currently I'm using the Standard shader only, and it is 100 unmodified.
0
How can I have my third person camera track slightly ahead of the player as he or she moves? I have a 3rd person camera controller in a top down game. I have my cameran following the player and I currently use linear interpolation to make the movement smooth and a little laggy. But I would like to do the opposite when the player moves in a certain direction the camera moves a little bit ahead, so as to reveal more of what is ahead of the player. void Update () var newX player.transform.position.x var newZ player.transform.position.z 17 var y transform.position.y var targetPosition new Vector3 (newX, y, newZ) transform.position Vector3.Lerp (transform.position, targetPosition, 0.01f)
0
Implementing online connectivity and multiplayer PVP for a newbie Background I'm a noob programmer looking to create a simple turn based mobile game as a side project. I've pretty much got the game logic down and am left with implementing the online multiplayer PVP portion. More specifically, i'm looking to implementing a system when the player clicks play and will be matched with an opponent in a 1 v 1 format, without any lobbies etc etc. I'm currently trying to develop my game in android studio(i'm new) but am also open to unity if it makes the development easier.(I have no experience in Unity). What i want to know From what i understand,i need to create and host my own server for the multiplayer to run(i.e matching of player to opponent). Do i also need the server to run the game itself or am i able to connect the player to the opponent and simply record the result of the game to my server database? Also, how would i go about creating and running hosting the server? I heard nodeJS is a good choice for writing the server. End Goal I just wanna publish my game onto the app store, IOS store, etc.
0
How do I use virtual joysticks in Unity2d ()top view? I want to use virtual joysticks for character movement, in a top down 2D game, that includes rotating the character. I tried an Easy Joystick Unity Package, but it doesn't work properly, so what do I do? Does anyone have a script (preferably in C ) that would use virtual joysticks to move a character?
0
Random scene manager in Unity This may be hard to understand because this is hard to explain I have 6 scenes and one 'start' scene. The start scene will be where my scene manager is. So I want function where when the player clicks on the the start scene it goes to a random scene (from the 6 scenes) and then it goes to start. Then when you click again it goes to random scene, but this time these random scenes will be between the remaining 5 (excluding the scene the player just went on) and then it goes back to start. Then it goes to a random scene time, this time these random scene will be between the remaining 4. And so one. I already know how to go a random scene and back but I don't know how to do the remaining
0
How to make multiple AI surround a player I am working on a top down RPG game and I have come across a problem. I am working on an AI system to allow the enemy AI to surround the player. I've been trying to keep my implementation really simple, however, I've been running into problems. Here is what it currently looks like X represents the player and Y represents the friendly AI. There are 42 waypoints in total that the enemy can potentially occupy. However, if any of the waypoints of the player object encounters an obstacle, or if another friendly AI is too close, it will disable those waypoints This poses a big problem because I do not have all 42 waypoints. From the looks of it, I might need something more dynamic in my case. Are there any alternative ways to allow a large number of AI to surround the player or its allies?
0
How can I convert screen space to GUI Space View Space? Is there any way available to convert screen space into view space as like in the following figure
0
Unity 3D Slow car (wheel colliders) My car is moving very slowly even though I apply high amounts of torque to the wheel colliders. The only thing I found to be helpful was to increase the wheel's friction stiffness, but that really messes up the braking and makes the car shake. The values I use for setting up the car and torque are realistic (1500 kg car, 20 kg wheels, a realistic torque value accounting for gear ratios etc.), so I don't understand the problem.
0
Play a sound on button click before loading the load scene in Unity3D I am trying to play the sound of the button click before loading the scene in unity. However, the sound is never played. Below is my code, help would be appreciated. public void RestartGame() audioManager.PlaySound(forwardSound) StartCoroutine(DelaySceneLoad("Gameplay")) IEnumerator DelaySceneLoad(string scene) yield return new WaitForSeconds(forwardSound.length) GameTracker.SetGameOver(false) SceneManager.LoadScene(scene)
0
How to add tiles randomly? I made a set of 10 different "ocean" tiles, all interchangeable with one another, and I'd like to randomly attach these 10 different tiles together in different combinations over a large rectangular area what would be the best way to do so? I've thought of just adding each sprite into a script and then calling a for foreach loop to add it into my world but that seems extremely expensive since I'd be adding over 1000 sprites. I don't want to reduce the number of sprites I have to add, I'm just seeing if there's a typical way people do this sort of thing.
0
How to display a GUI Texture for a certain amount of time Is it possible to make a gui Texture display for a certain amount of Time.
0
How can I fade player character when he goes inside or outside of the area? I want to fade the player when he goes out of the area. For example, suppose a person enters a building. When a person is outside of the building, he shouldn't be seen, but when he enters he gradually becomes visible (using fading effect). when elephant is inside green area his alpha should be 1 when elephant is outside of green area his alpha should be 0
0
Is there any way to bring animation into unity without a rig bones? I am developing for mobile and to make the game run on lower spec mobiles, I was only going to import bones rig for the main character. There are other humanoid characters in the scene which do move about and are rigged already in my 3d app but since they wont be controlled in anyway by the player in the game, I just wanted to bake and import their animations alone without the bones. I know unity can handle blendshapes but I am more comfortable with rigs and also cos these characters are already rigged properly.
0
Recommended data structure for storage and fast access of infinite chunk based heightmap terrain I'm aiming to create a chunk based heightmap terrain in Unity. I already have a basic multifractal simplex noise set up and working, able to generate heightfields and meshes at runtime... but only individually for the moment. I'm attempting to work out how best to store and access each chunk. I already have a couple of methods worked out to convert global positions to chunk coordinates and chunk local barycentric triangle coordinates, so I can interpolate heights. I've used that to build a method to march a camera space to world space ray across the mesh and iterate through x z plane intersections until it finds the height intersection for a fast way to look up mouse position on the terrain without having to attach physics collision meshes for each chunk and use Unity's raycasting. That's all working nicely. I'm just a bit stumped now on how to implement the main infinite grid storage that I'll generate chunk meshes from. This is planned to be in service of a game with an isometric perspective, revealing the world as units explore fog of war over time... with the ability to move the camera around the uncovered terrain fairly quickly, so I'm guessing there might be limited scope for unloading previously generated chunks... it'll be an ever expanding dataset (so I'll presumably have to be looking for ways to keep it light on memory) I figure I can either Create a 2 dimensional array of float (or perhaps short 64k height levels should probably be plenty) for the entire terrain, and dynamically resize the array as each x z boundary is pushed back. Generate just the terrain mesh in chunks, to keep each mesh chunk under the Unity 64k vertex limit. Create a grid manager class, which has some kind of dynamic data structure that stores map chunk objects, and instantiates them retains references to them as they're demanded, each of which would contain its own (res res) sized heightmap array. Something else? I'm assuming option 2 will have the most mileage, but what I'm most unsure about is what kind of dynamic data structure to use. I'd guess some kind of key object pair structure, where the key is built from the chunk coordinates? Assuming I'll want to access height values quickly and constantly, across chunk boundaries, for things like my mouse ray intersection method, and for pathfinding code, etc... I presume I'll need a way to access chunks that is nearly as fast as looking up arrays by indices, and O(1) complexity. Or perhaps some way of caching recently accessed chunks or chunks that the camera is near? Or pointers to them, or something? As you can probably tell I'm fairly new to the gamedev side of things, but I have a VFX background, and so know my way around 3D geometry math and basic scripting. In terms of designing structuring implementing a game, I'm a total novice though, so any pointers to relevant tutorials and such would be much appreciated.
0
Avoiding singletons for puzzle system Say for instance I have a puzzle with 3 switches that need to be in some configuration (say all on) in one room, that opens a door in another, with a load screen separating, so I can't link the switches directly to the door. My first thought was to create a singleton that stored the state of each "solution element" which in this case is the switches, but could be a correctly turned knob, ect. then a given "Puzzle Gate" like a locked door would check the required solution elements to decide it's own state, but I'm hesitant to use singletons for all of the commonly given reasons. What alternatives do I have to singletons that would give me the same or similar control?
0
Why is my character jumping at different heights randomly? I have a character controller on my character's gameobject and I'm trying to make the character jump. This is working but sometimes he jumps way higher than other times. Does anyone know why this is happening? Here's the code using System.Collections using System.Collections.Generic using UnityEngine public class Movement MonoBehaviour CharacterController cc public float Speed float Forward float Sideways float vertical public float gravity public float Jump Start is called before the first frame update void Start() cc GetComponent lt CharacterController gt () Update is called once per frame void Update() Forward Input.GetAxis("Vertical") Speed Sideways Input.GetAxis("Horizontal") Speed if (!cc.isGrounded) vertical gravity Time.deltaTime else if (Input.GetKeyDown(KeyCode.Space)) vertical Jump Time.deltaTime vertical 8 Time.deltaTime Vector3 Delta transform.TransformDirection(Sideways, vertical, Forward) cc.Move(Delta Time.deltaTime)
0
FBX model for 2d sprite charachter I was following along the unity platformer tutorial. https www.youtube.com watch?v 9WhZ1svdC3Q It is great. After looking the animation I found that there was a fbx model for 2d sprite character. I just want to ask can you use 3d animation like motion capture animation once you rig a character using bone for 2d(fbx model). I search but unable to find any good tutorial of how to create fbx model for 2d character and creating maps for these 2d character. I am really confused. Thank you so much for helping.
0
My Earthbound like Movement Script works in Unity Gameview, but runs differently in Gamebuild First programming question I've ever made in my short journey. I'm trying to create a script which moves members of your party in a line behind you (think Chronotrigger or Earthbound). Here's a clip of what I want it to look like. Problem Everything looks fine in the Game window when I play, but when I build the game to test, the characters begin to stack one on top of each other. I assume it has something to do with Update() frames dramatically increasing the frequency with which I enqueue the positions of the leading character (although I'm not experienced enough to say for sure, clarification on this would be helpful). I've tried increasing the offset, but this solution is variable depending on the players computer fps so that wont work. I've tried running both scripts in FixedUpdate() but a lot of my other systems run on Update() and so everything stutters. I've tried enqueue'ing from an IEnumerator and waiting for .1 second between each enqueue but that stutters as well.. What I'm doing The leading character has a script called PlayerTrail which creates a Queue of Vector3s. In Update the game object's transform.position is enqueued. The following character has a script called PlayerFollower which looks at the Queue and Vector3.MoveTowards the position, then dequeues that position and repeats. Each character only looks at the trail of the character in front of it. Everything seemingly works fine and well in the Unity program, this issue only arises once I build the actual game. Code Supplied Bellow using System.Collections using System.Collections.Generic using UnityEngine public class PlayerTrail MonoBehaviour public Queue lt Vector3 gt LeaderTrail public Vector3 LastMovement private void Start() LeaderTrail new Queue lt Vector3 gt () private void Update() if (this.transform.position ! LastMovement) LastMovement transform.position LeaderTrail.Enqueue(this.transform.position) using System.Collections using System.Collections.Generic using UnityEngine public class PlayerFollower MonoBehaviour public GameObject leaderObject public int Offset public int moveSpeed private PlayerTrail leaderTrail private Animator animator void Start() animator gameObject.GetComponent lt Animator gt () leaderTrail leaderObject.GetComponent lt PlayerTrail gt () void Update() if (leaderTrail.LeaderTrail.Count lt Offset) animator.SetBool( quot isMoving quot , false) return else Vector3 direction (leaderTrail.LeaderTrail.Peek() transform.position).normalized this.transform.position Vector3.MoveTowards(this.transform.position, leaderTrail.LeaderTrail.Peek(), moveSpeed Time.deltaTime) animator.SetBool( quot isMoving quot , true) animator.SetFloat( quot moveX quot , direction.x) animator.SetFloat( quot moveY quot , direction.y) Debug.DrawRay(this.transform.position, direction) leaderTrail.LeaderTrail.Dequeue()
0
Loading an image from Disk to used to replace a source image for an image object I am working on a Unity project where I need to be able to grab an image from disk and then have it be replaced as the source image for an image gameobject. Currently I already have a filebrowser implemented that gives me the filepath. if (File.Exists(output)) GameOjbect imageselect GameObject.Find("ImageSelection") imageselect.GetComponent lt Image gt () I need to make the file location at path output be the sprite? sourceimage? for imageselect Sorry if this has already been asked, I have been looking at other examples this morning with no luck.
0
Can I clip a collection of geometry to render only inside a particular worldspace volume? I am making a VR app in Unity. I have a giant map that I want to display on a virtual table. The map is too large to fit on the table, and I cannot change its size. (It is a third party asset, and does not easily have that capability.) How can I tell the camera not to render the parts of the map that fall off of the table? Perhaps something along the lines of Camera.DoNotRender(new Vector3(100, 0, 0)) I have been looking into using some MonoBehaviour messages such as OnPreRender, OnRenderObject, etc. But I do not know which one can help me, if any. Ideally, the pixels behind the non rendered pixels should be rendered, but that is not my priority. The map is made up of 100s of little renderers How can I have my Camera not render specific world space pixels?
0
Best practice for toggling between ragdoll and CharacterController One feature of the game I'm working on is that if a character is hit with a certain amount of force, it will temporarily ragdoll, then get up off the ground after a small period of time. This character is moved by a CharacterController (CC) component. At the moment, I have the model as a child of an object with a CC component and movement script. My issue is that when the ragdoll is activated animator is disabled, the model moves independently of the CC if it ragdolls with some arbitrary force in any direction, the CC does not move with it (as you'd expect). This would be fine if the ragdoll wasn't meant to be re enabled, but it is. At this stage, the model teleports moves to where the CC is, and it looks very weird. I have tried a few different methods to synchronize the two Decoupling the CC and model. Both objects are children of a shared parent, and I added them both to an PhysicsIgnoreLayer (for now eventually if I go with this I'll probably add all the ragdoll colliders to an array and ignore them individually). When the ragdoll state is enabled in the parent, the CC is disabled and the object is teleported to the root bone every frame. When the CC is enabled, the model is teleported to the CC object every frame. See here. The issue here is that setting the position means extra Update() calls and it lags behind the controller a little. Also, because the model isn't a child of the controller, it doesn't inherit the velocity of the controller, so it needs to be manually applied. Changing the parented GameObject at runtime. Depending on the state of the character, the CC model will be parented to each other if the CC is active, the model is set as its child and vice versa using SetParent. I couldn't get this one working (the local position variable was a little confusing to me, but no configuration I tried worked for me). Conjoined CC and model. I placed the CC on the same object as the model. This isn't really ideal for me because I want greater control over the rotation and presentation of the model. I couldn't get this one working either I don't know how I could set the position of the CC without moving the whole thing. Is there a more effective way of doing this? If so, what? I feel like I am greatly overcomplicating this. Any help would be great. In an ideal situation, I could have the model as a child of the controller (or behave that way) and move the CC when it is inactive without affecting the model position.