_id
int64 0
49
| text
stringlengths 71
4.19k
|
---|---|
0 | How can I rotate a camera on the X and lookat target and once looking at the target to stop slowly the rotation? This is a screenshot showing the camera position. I want it to rotate slowly smooth to the left and once looking at the soldier to stop rotating. using System.Collections using System.Collections.Generic using UnityEngine public class SoldierNaviFight MonoBehaviour public Camera fightCam public Transform target public float speed 2f Use this for initialization void Start () Update is called once per frame void Update () The script is attached to a empty gameobject. What I want to do is once the camera stopped rotating and looking at the soldier to make the soldier start moving to the right and camera should follow the soldier rotating and keep follow the soldier moving. The main idea is to create a cut scene. The camera is position at this point just to display the cut scene. To make the first rotation to the target I tried this using System.Collections using System.Collections.Generic using UnityEngine public class SoldierNaviFight MonoBehaviour public Camera fightCam public Transform target public float speed 2f Quaternion targetRotation Use this for initialization void Start () targetRotation target.rotation Update is called once per frame void Update () Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime speed) But the camera is not rotating at all. This is screenshot of the Hierarchy and Inspector The script is attached to GameObject SoldierNaviFight The camera that I want to move is the child of SoldierNaviFight SoldierNaviFightCamera UPDATE This will rotate the camera but it's rotating it to the right instead to the left to the soldier. Not sure why using System.Collections using System.Collections.Generic using UnityEngine public class SoldierNaviFight MonoBehaviour public Camera fightCam public Transform target public float speed 2f Quaternion targetRotation Use this for initialization void Start () targetRotation target.rotation Update is called once per frame void Update () fightCam.transform.rotation Quaternion.RotateTowards(fightCam.transform.rotation, targetRotation, Time.deltaTime speed) |
0 | How can I transform a world space point to a camera's screen coordinate? I'm trying to transform a point in fragment shader from world space to screen coordinate of a second camera. Not the main one. I think I know how to achieve that to the main camera, but I'm struggling to find an easy way to transform a point in world space to screen coordinate of camera2. |
0 | Making certain GameObjects visible for a camera I have 2 cameras in my 2D game. One displays gameobjects normally, and the other camera draws some of these gameobjects reflected (scale.y 1). The reflected camera would draw only objects in the "Water" layer, and I would change the layer of the GameObjects I want to reflect on the precull and postrender functions. This way I can decide which GameObjects would be reflected, changing the layer on the fly at runtime, which is a requirement. Precull Change the desired GameObjects layer to "water", and apply scale.y 1 OnPostRender Change the Gameobjects layer to their original value, and apply scale 1 This was working correctly when my objects were simple, but now my objects are more complex, and I can't rely on changing the layer of the gameobjectson the fly, as I can't tell what their original layer was for each part of the object, in order to revert the changes applied during the precull. Is there anyway to tell a camera which objects should it render besides using the culling mask? |
0 | Rotate object always at same speed on screen, no matter camera distance? I am rotating a globe like XCOM's hologlobe, I rotate it using Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta). I found a good value for maxDegreesDelta, in my case it is 5.0f. There is a limit on how close or far the camera can be, let's assume clos is 1.0f and far is 2.0f. I want to be able to zoom into the globe, but obviously when I do, it rotates a bit too fast then. When zoomed out, rotation speed is satisfying When zoomed in, rotation is too fast, making it more difficult to manipulate And the problem is even more evident as game view size gets bigger, i.e. fullscreen. Using Mathf.Lerp and Mathf.InverseLerp, I've tried to make maxDegreesDelta and mouse delta proportional to the distance the camera is but it's hardly convincing. Note I rotate the globe, not the camera. Question How can I ensure object rotates at same speed on screen, no matter how close or far camera is ? Code (assumes there is a sphere of radius 0.5 at Vector3.zero and camera is positioned at Vector3.back) using UnityEngine using UnityEngine.InputSystem namespace Test2 public class GeoScapeController MonoBehaviour region Public public Transform TargetObject public Camera TargetCamera Range(0.01f, 1.0f) public float Sensitivity public bool Smooth public float ZoomDistanceMin public float ZoomDistanceMax endregion region Private SerializeField HideInInspector private Quaternion TargetRotation SerializeField HideInInspector private int ZoomLevel SerializeField HideInInspector private int ZoomLevels SerializeField HideInInspector private Vector3 ZoomVector SerializeField HideInInspector private Vector3 ZoomVelocity private void Reset() Sensitivity 0.05f Smooth true ZoomDistanceMin 0.625F ZoomDistanceMax 1.25F ZoomLevels 10 private void Start() TargetRotation Quaternion.LookRotation(TargetObject.forward, TargetObject.up) ZoomVector TargetCamera.transform.position private void Update() var mouse Mouse.current var delta mouse.delta.ReadValue() var scale new Vector4( 1.0f, 1.0f, 1.0f) var x mouse.leftButton.isPressed ? delta.y scale.y Sensitivity 0.0f var y mouse.leftButton.isPressed ? delta.x scale.x Sensitivity 0.0f var z mouse.middleButton.isPressed ? delta.x scale.z Sensitivity 0.0f var r Quaternion.AngleAxis(x, Vector3.right) Quaternion.AngleAxis(y, Vector3.up) Quaternion.AngleAxis(z, Vector3.forward) if (Smooth) hopefully, quaternion limits won't be crossed ! TargetRotation Quaternion.RotateTowards(TargetRotation, r TargetRotation, 2.5f) TargetObject.rotation Quaternion.Slerp(TargetObject.rotation, TargetRotation, Time.deltaTime 5.0f) else TargetObject.rotation TargetRotation r TargetRotation var wheel (int) mouse.scroll.ReadValue().y 120 if (wheel ! 0) ZoomLevel Mathf.Clamp(ZoomLevel wheel, 0, ZoomLevels) var lerp1 Mathf.InverseLerp(ZoomLevels, 0, ZoomLevel) var lerp2 Mathf.Lerp(ZoomDistanceMin, ZoomDistanceMax, lerp1) ZoomVector Vector3.back lerp2 TargetCamera.transform.position Smooth ? Vector3.SmoothDamp(TargetCamera.transform.position, ZoomVector, ref ZoomVelocity, 0.3f) ZoomVector endregion |
0 | Unity 5 Input Field How to confirm password entry with ENTER only and not a click loss of focus I have an input field password box, currently the password is 'submitted' either by clicking Enter or by clicking elsewhere on the screen. This seems to be the designed way, as it states this in the documentation (https docs.unity3d.com Manual script InputField.html) "A UnityEvent that is invoked when the user finishes editing the text content either by submitting or by clicking somewhere that removes the focus from the Input Field." As I have other buttons on the same screen that users can click on, I would like it so mouse clicks are not counted as an invoke. Is this possible? Many thanks in advance |
0 | Environment collision in a pseudo 3d 2d space The game is a 2D brawler with depth movement in the vein of Golden Axe, Final Fight, Castle Crashers etc. Characters and environment are all 2d sprites as well. I've had no real issue setting up collision between characters to take the depth into account either. However, it's just not a proper brawler without higher ground to jump to and pits to throw the enemy into, and that is where I run into a bit of an issue with how best to implement it. I considered making the collision boxes for the level in the 3D space and having the sprites just translate the z movement of their game object into y movement of the visual component, but I don't particularly like that approach because it feels difficult to work with for doing the level design of matching 3D colliders to a drawn backdrop and placing objects in there. Any suggestions for a design that is the 2D first, so to speak? Ideally being able to "paint" height levels and pits in the 2D design wise. If it matters, I'm working in unity with a primarily 2d space (though involving the third dimension here will be necessary), but I think the base design problem would be fairly engine language agnostic. |
0 | Is this Code saving performance ? It is kind of a Occlusion Culling I wanted to do Occlusion Culling on my Scene but I just get a bunch of Errors like "Couldn't load geometry..." etc. I tried to do like another way but the same thing, the Occlusion Culling just disables the Objects the Camera dont see. I tried it with OnTriggerEnter and Exit. I have 2 Areas one is on the left and one on the right, when the Player is walking in the first Area the Box Collider checks it and disables the Objects in Area2 but when Player is walking into Area2, Objects in Area1 disables and Different. Got the Script on both Areas that it disables a list of arrays as GameObjects. My Question is, does this save performance ? public GameObject deactivatingModels bool playerEntered false void OnTriggerEnter (Collider other) foreach(GameObject envis in deactivatingModels) if(other.gameObject.tag "OcclusionCuller") envis.SetActive(false) Debug.Log ("Player has entered Occuling Zone") void OnTriggerExit(Collider other) foreach(GameObject envis in deactivatingModels) if(other.gameObject.tag "OcclusionCuller") envis.SetActive(true) Debug.Log ("Player has left Occuling Zone") |
0 | Unity build does not launch and leaves no logs errors I have released my first title Audio Infection ( https store.steampowered.com app 911580 Audio Infection ) for a bit over a year ago. Recently 1 user has so far encountered an issue where the game does not launch. He is the only user that encounters this problem. He has this issue on both Win 7 and Win 10. His system specs are fine and his drivers are up to date. The game does not leave a log file, rather it looks like it is unable to boot. There are no Windows error reports on it either. I watched it through Discord screenshare because I could not properly understand his issue. I had asked a few other random people to test my game and demo (he has the issue with both, the demo and full version) however no one else (including me) is able to reproduce this behavior. At this point I have tried updating Unity from 2018 to 2019 (no change in behavior) added manual logging (with no results) updating drivers (on his system) installing Visual C (on his system) empty project with Unity sample scene (he was able to load the sample scene!) deleting crashhandler.exe (used to fix similar issue in the past based on older threads) modifying files deleting and downloading the files What else can I try in order to figure out what is causing the issue? I am honestly clueless. Since the sample project was able to boot on his system there is definitely something wrong with the build on my end. However he is the first person with this issue. It doesn't even get to the point of launching on his system and it can't be found in the memory either. It is almost as if Windows is blocking it from launching, however that is not the case. But the result is very similar to that. There is a free demo on the store page available in case you want to see if it boots on your system. It works for both VR and non VR systems. When no VR devices are detected all VR related contents are disabled. This has been thoroughly tested and worked on loads of different Windows systems with different specs, with VR and no VR. Once again, there are no errors, no logs, the build doesn't even make it to that point, yet that exact same build works for literally everyone else on various systems. I am absolutely clueless about what to do in order to resolve this issue. Any help advice or pointers towards the right direction are greatly appreciated! PS he is not a troll, I have known this guy for a long time now and he genuinely wants to support me. |
0 | Particle spawn on collision spawns too many particles So i have the following code private void OnCollisionEnter(Collision collision) foreach (ContactPoint contact in collision.contacts) if (contact.otherCollider.CompareTag("Ground")) Instantiate your particle system here. Instantiate(Effect, contact.point, Quaternion.identity) Now this works great however it spawns way too many particles (as the animation I am doing with the item hits the ground a lot). Is there a way to limit the particles in a sensible way? |
0 | How do I link a GameObject activated state to a UI button being held? How do I go about this functionality When a user taps and still holds onto a UI button, a GameObject will be set active, when they release the UI button, the GameObject will be deactivated. |
0 | unity how to keep prefabs updated I have a number of prefabs in unity and I regulary update them, is there an easy way make sure unity updates these prefabs so that I don't have to update 20 identical objects in identical ways acros 10 different scenes? |
0 | How to prevent a cube from falling through a plane in Unity I am trying to prevent a player cube from falling through the plane (Battleground) in Unity, but after adding Mesh collider to both the cube and plane, as well as adding a rigidbody, nothing seems to work. The only way I can prevent this from happening is by locking the y axis of the cube, but this is a problem because I am adding in a jumping ability, and the player needs to be able to fall of the map. Is this something I can do within the Unity editor, or do I need to make a script that does that. To verify, all 3 colliders have "Is Trigger" Enabled, the platform is not designed to be moved, so the X, Y and Z of both the plan's rotation and position are locked, and the material for the colliders are all default. Each of the cubes and the plane's material are custom (Not the collider's material). The X, Y and Z of the cube's rotation are locked. Both cubes have the tag 'player' The code for player movement is using System.Collections using System.Collections.Generic using UnityEngine public class PlayerMove MonoBehaviour private Rigidbody rb Use this for initialization void Start() rb GetComponent lt Rigidbody gt () Update is called once per frame void FixedUpdate() float h Input.GetAxis("Horizontal") 5 float v Input.GetAxis("Vertical") 5 Vector3 vel rb.velocity vel.x h vel.z v rb.velocity vel |
0 | Managing multiple animation files in a Unity project I am on my project, but find it hard to understand what I'm missing from those few animation and rigging tutorials. I have an FBX I modelled and rigged from blender... Or I could just take a model from Mixamo or other resources. Is it possible to have loosely coupled .anim files which could be mix matched at runtime with different FBXs? It seems the Animator Controller can reference each .anim file independently if necessary, so I guess we can make one animation per fbx and split anim files in Unity project explorer... There must be a better way, right? |
0 | Tweaking screen transitions not to fire every time in Unity I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one). This is cool and all but poses two problems firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place. How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene? Maybe there's some way to pass some kind of a parameter when loading a new scene that I'm not aware of? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts? |
0 | Move a point to another, along an elipse according to this picture, I want to move my yellow object, smoothly to the red one. And I want to have an eliptic trajectory in relation to my center point. So for now I'm having this code yellowPoint.position Vector3.SmoothDamp(yellowPoint.position, redPoint.position, ref currentVelocity, dampingMove) How can I change it to add the elipse, depending on a third center point ? the itinial code can change of course. Thanks you ! |
0 | iOS build size is too large in Unity I have finally completed my game and ready to upload my game to the App store, but my build size is too large. I have checked log statement and it is roughly 13.3 mb but when i build my game and test on iOS device it is 80.0 mb. Also Scripting Backend is 'Mono2x' Stripping Level is 'use micro mscorlib' Script Call Optimisation is 'Fast but no Exception' My Game size must be around 15 to 20 mb why it is too large? What i am missing? |
0 | Determining how loud an AudioClip is I have some code that uses GetSpectrumData from an AudioSource playing a song to create a level layout for the player to play. I want to add a functionality where the players can upload their own songs and play the levels created with the data from these songs. Unfortunately, when comparing different audio files, I encountered this As you can see, the amplitude differs drastically from clip to clip, subsequently creating levels that are trivial to complete or almost impossible. I want to find a way to determine this "loudness" so I can tone it down or amplify it with a multiplier after getting the data from the song. Also, is there a way to extract this data without playing the song? |
0 | AddListener will not listen to onClick event Based on this question on the Unity forum, I've made this code to instantiate a button and add an onClick event. Setting some other component properties right of the prefab. shopTurretItem.GetComponent lt UnityEngine.UI.Button gt ().onClick.AddListener(() gt UnityEngine.Debug.Log("Click") ) Instantiate(shopTurretItem, transform) The variabele shopTurretItem is my prefab type of UnityEngine.GameObject. The problem is that the log Click will never be shown. If I add breakpoints on the first code line, the compiler will stop the code. If I place it into the closure, it'll never be hit if I click on that button. This is the inspector of my prefab shopTurretItem. What's wrong with this code? |
0 | How to teleport a game object to an empty game object? I am trying to make a respawn system where if the player touches a plane, (the name of the object is tutlvl1 flrdead) they get teleported to an empty object at player spawn named quot RESPAWN quot . But, several tutorials and unity answers threads lead me to nowhere since they were written from back in 2013 or somewhere around there. Code using System.Collections using System.Collections.Generic using UnityEngine public class deathfloor MonoBehaviour Start is called before the first frame update void Start() Update is called once per frame void Update() public gameObject myObject You can name it whatever you want. myObject.transform.position new Vector3(3.076, 1.74, 3.651) How can I fix this to do what I need for my game? |
0 | Unity Built In Scrollable Containers? Is there a way to get a scrollable container in Unity without purchasing a plugin such as NGUI or TK2D? I want to create a scrollable container of interactive elements that can be clicked on individually and be scrolled horizontally by the user dragging their finger. You can kind of think of this as something similar to the shop menus in Clash of Clans. Here's a quick mock that I made to demonstrate the behavior I'm looking for https www.youtube.com watch?v bOJSMDPdFUQ Is there a built in way to do this in Unity without the need of purchasing an extra plugin such as NGUI or TK2D? |
0 | How can I reduce this code? Could you help me to reduce this code as much as possible? public GameObject TextPage public void Skin0() foreach (GameObject go in TextPage) go.SetActive(false) TextPage 0 .SetActive(true) public void Skin1() foreach (GameObject go in TextPage) go.SetActive(false) TextPage 1 .SetActive(true) public void Skin2() foreach (GameObject go in TextPage) go.SetActive(false) TextPage 2 .SetActive(true) |
0 | How do I rotate a sphere so that a position on it comes to a specific location? Sorry for my english. I added a picture to explain what i want. I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position) not black point moving, whole sphere moving. or is it better to move camera to black point? which API should i use? |
0 | Runtime NavMesh Builder source mesh combined mesh is skipped because it does not allow read access I'm getting this error Runtime NavMesh Builder source mesh combined mesh is skipped because it does not allow read access I checked all the models and it has the read permission. I also noticed, that in some cases unchecking the static checkbox helps and I'm getting a smaller amount of these errors. |
0 | How can I my homing missile avoid walls (2D)? Okay, I have the homing missile implemented. It will follow the player, but I want it to avoid the walls. I tried out A but I want to make my own. I need some help plzz. |
0 | Grid of buttons in Unity button bounds are stretching beyond their visuals, capturing clicks meant for other buttons I am using unity UI for the first time and trying to create a level selection menu just like Angry Birds. I had successfully created the dynamic level selection menu. It was all good in the inspector but when I build and run it, something strange happens when I click on the first button of the first row, instead of that button, the last button of that row got clicked. I searched and found that the image was not stretching (because of preserve aspect property checked) but the bounds were stretching with the resolution so the bounds were overlaping and the wrong button was getting clicked. There is a panel which is child of the canvas gameObject. Buttons are child of panel gameObject. Panel's anchors are set to stretch the canvas. Buttons' anchors are set to stretch the panel. Here is the code to create menu dynamically. public class UITest MonoBehaviour public Button button public RectTransform parent void Start() SetupButtons() void SetupButtons() float x 155 float y 55 for(int i 1 i lt 15 i ) var I i var btn Instantiate(button) as Button var btnRect btn.GetComponent lt RectTransform gt () float width btnRect.rect.width 5 float height btnRect.rect.height 5 btn.transform.SetParent(parent, false) btnRect.anchoredPosition new Vector2(x, y) btn.onClick.AddListener(() gt Temp(btn, I)) if(i 5 0) y (height) x 155f else x width Debug.Log(width ", " height) void Temp(Button btn, int i) Debug.Log("Clicked " i) Debug.Log(btn.GetComponent lt RectTransform gt ().anchoredPosition " " btn.GetComponent lt RectTransform gt ().rect) Here are some screenshots to better understand the problem. I hope you guys have understood the problem please help me solve the problem. |
0 | How to be sure that a target goal in a match 3 game level will not be impossible? This is clearly not a coding problem but the logical one. I am starting to learn how to make a match 3 game. but there is a question rising in my mind. when i will set goal to complete the level, how will i know the goal is achievable ? suppose in a level where i have to collect 5 Red, 12 blue, 9 green objects by matching the same(like farm heros). how would i decide how much moves i need to set to make this goal achievable. i mean it should be challenging but not be impossible. since the objects spawn in a random whats the surety that there will be enough number of gem in the game to not make impossible. is there some logical explanation for this, or i just have to test and look out how many moves it takes to achieve the goal. Is there an algorithm which generates the gems according to target set, or they are generated in random manner? To be more clear towards my question i am going to take an example of King.com's farm heros saga . In level 9 the target is to collect number of four types of objects 26,26,14,5 respectively. and the maximum number of moves are 22. now this goal may be achievable and challenging(i mean you can achieve it in two or three trials ) but not impossible. Now my question is what made those guys so sure that it will not be impossible, how they decided that 22 move will be enough and challenging. well.. they could have put the maximum number of moves to 5 or 6. but that would surely make it impossible to clear the level. so how they decided to keep move 22 or this. Are they using static pattern to generate and spawn objects, or ratio of collectible gems is fixed(i.e in total gameplay there will be X ,Y ,Z ,M of gems respectively ), or there is some other way. I just need some hint what should i look for.. |
0 | How can I add orbit effect to the camera? On my player I have the component Animator , Rigidbody , Capsule Collider , Third Person User Control script , Third Person Character script. On the Main Camera there are two scripts but only one is activated for now Camera Follow and Mouse Orbit With Zoom The Camera Follow script is working fine. The problem is when I'm activating the Mouse Orbit With Zoom script if I move the player with the keys WASD and also rotate orbit the camera with the mouse the player lose focus. He does change his direction according to the mouse rotation but also lost focus And also for some reason I can make the camera rotation to be diagonal The reason Main Camera is not child of the player is that it's making the camera stuttering and rotating very fast on place. That is why I added the Camera Follow script. The Camera Follow script using System.Collections using System.Collections.Generic using UnityEngine public class CameraFollow MonoBehaviour public Transform player public Vector3 offset Update is called once per frame void Update() transform.position player.position offset The orbit script using UnityEngine using System.Collections AddComponentMenu( quot Camera Control Mouse Orbit with zoom quot ) public class MouseCameraOrbit MonoBehaviour public Transform target public float speed private void Update() if (Input.GetMouseButton(0)) transform.RotateAround(target.position, transform.up, Input.GetAxis( quot Mouse X quot ) speed) transform.RotateAround(target.transform.position, transform.right, Input.GetAxis( quot Mouse Y quot ) speed) My game is adventure game type and the main goal is to make player movement to be with the keys and also to be able to look around like orbiting with the mouse because only following the player will not show where to go , that is why I'm trying to add orbiting, but the orbiting part is just not working good. |
0 | Moving large group of units 1 by 1 takes too long, how can I improve this? I use use Unity's own NavMesh AI system and I think it works pretty well. The only problem I have is that when I move large groups of units, they will find a path one by one, but it takes a really long time as you can see in the video https gfycat.com blankhalfdartfrog To set destinations I use this public bool SetDestination(Vector3 point) if (SamplePosition(point)) agent.SetDestination(point) return true return false I know I could wait until they all have pathPending false, but that would mean the entire group moves with a huge delay. Is there some way I can improve or fix this issue? Edit It is quite simple to recreate (if you have some basic knowledge on Unity NavMesh) simply create a "click to move" script that moves a List of units to where you clicked using the code above (just fill the list in Start on each unit). Put down a few obstacles and you're done. |
0 | Level Modeling Workflows in Maya for Unity I'm wondering what the standard workflow for modeling static levels for Unity (or for that matter, other High Level engines) is? My somewhat limited knowledge tells me that the best process is modeling the entire static level in Maya, texturing, then baking AO and some static lighting into the scene, then importing the single level asset into unity to add dynamic objects. Is there another way that I should be doing this that is more efficient in a performance sense or from a workflow point of view? I know the question is somewhat open ended, but generally i'm asking what the standard workflow for level modeling is. Thanks! |
0 | Unity block chunk generation pattern I am trying to do something like Minecraft game in Unity. Currently I am trying to generate a chunk of blocks, given dimensions. I can successfully create a chunk of N x 0 x 0 sized chunk, but due to lack of logic, I have no idea on how to make triangles and vertices match for other blocks. Basically, what I mean is, I can generate something like this But can't do this My Block vertices and Triangles Vector3 cVerts new Vector3 (0, 0, 0), 0 new Vector3 (1, 0, 0), 1 new Vector3 (1, 1, 0), 2 new Vector3 (0, 1, 0), 3 new Vector3 (0, 1, 1), 4 new Vector3 (1, 1, 1), 5 new Vector3 (1, 0, 1), 6 new Vector3 (0, 0, 1), 7 int cTris 0, 2, 1, face front 0, 3, 2, 2, 3, 4, face top 2, 4, 5, 1, 2, 5, face right 1, 5, 6, 0, 7, 4, face left 0, 4, 3, 5, 4, 7, face back 5, 7, 6, 0, 6, 7, face bottom 0, 1, 6 Chunk creation method void CreateChunk() ... for (int x 0 x lt 100 x ) for(int y 0 y lt 10 y ) for (int z 0 z lt 1 z ) AddBlockAtPosition(new VectorInt(x, y, z), "Grass") ChunkMesh.vertices CurrentChunkVerts.ToArray() ChunkMesh.triangles CurrentChunkTris.ToArray() ChunkMesh.uv uvs.ToArray() ChunkMesh.RecalculateNormals() AddBlockAtPosition() method void AddBlockAtPosition(VectorInt pos, string name) int x pos.x, y pos.y, z pos.z create separate cube data CubeMesh cube new CubeMesh(vertices.ToArray(), triangles.ToArray(), uvs.ToArray()) I use MoveCube() to change each Block's vertex and triangle numbers, so they will "match" in a Chunk mesh, when they become part of it. cube.MoveCube(new Vector3(x, y, z), (x y z) 8) cube.MoveUV(new Vector2(x y z, x y z)) CurrentChunkVerts.AddRange(cube.Vertices()) CurrentChunkTris.AddRange(cube.Triangles()) CurrentChunkUV.AddRange(cube.UVs()) And most importantly, that's where my problems are, MoveCube() Class Cube private Vector3 vertices private int triangles ... public void MoveCube(Vector3 direction, int n) for(int i 0 i lt vertices.Length i ) vertices i direction for (int i 0 i lt triangles.Length i ) triangles i triangles i n I know that I am not the first to re create minecraft, I have found this tutorial https www.blockstory.net node 56 But for me as a beginner, some "simple" parts like these I have problems with are skipped. And other tutorials just generalize the idea, which isn't enough for me. |
0 | Making a cube follow my finger in Unity2d? I would like to make a cube follow my finger when i touch an iphone screen and drag in unity 2d. |
0 | Unity Scripting Runtime Version Option Missing I have been trying to open and run my couple months old project in Unity3D, and I'm getting about 500 errors. So idecided to reinstall Unity. On the tutorial for the project, it tells us to make sure the "Scripting Runtime Version" is set to 4.x equivalent. Only problem for me is I cannot see such an option in Unity5.5.4p4. How can I set .NET 4.x in Unity for good? |
0 | Need advice concerning the creation of open world game in Unity 3D I just wanted to ask for advice those being an expert in Unity 3d and overall in game industry about how it is possible to create an open world game by means of Unity 3D, that is, I already tried to combine several tiles of terrains, 4 to be exact, and their respective size is 500x500. However, once I started to add the fifth terrain to those terrains, Unity stopped working. Moreover, another problem that I faced was with light mapping in Unity, that is, the more terrain I add to the scene the more it is difficult to bake the light mapping. The question is if I am doing correctly by adding terrains to each other and how open world games are actually created. Yes, I heard of chunk loading but is it possible to code it on my own without using ready plugins. Lastly, Is it possible to combine tiles of terrains just manually without using any tools like Terrain Slicing kit or Gaia please I really need your help Thank you for your attention))). |
0 | Coins don't show up in game in Unity I have a 2D game I'm making with Unity, and I want the player to be able to collect coins that I place all over the game. I used the coin prefab with a 2D circle collider and an animation to make it spin. The problem is that only the first coin I put into the scene shows up in the game, and when I collect that one coin, the counter shows that all the others have been collected as well. Here's the script I attached to the player for the coins private uint tokens 0 void OnGUI() GUILayout.Label ("Tokens " tokens) void CollectToken(Collider2D tokenCollider) tokens Destroy (tokenCollider.gameObject) void OnTriggerEnter2D(Collider2D col) if (col.gameObject.CompareTag ("token")) CollectToken(col) This is my current setup for the object properties Thank you for any help! |
0 | Character on platform move slowly I'm having a problem similar to this link http answers.unity3d.com questions 1295955 character on a moving platform slows down.html But... My 2D character is on an elevator (which does not have any physics) and is being moved up and down through an animation (transform). But when my character is on the elevator, the colliders2D overlaps another, as my character's RigidBody2D stands still as I move the game object elevator (crossing each other). My solution was to try to attach my character as the child of the elevator (SetParent), and this solved the problem of overcoming the colliders, but it gave me a new problem. The new problem consists of a certain slowness in the movement of the character while it is on the elevator. I believe the problem is because the transform of my character is in motion while the elevator goes up and my rigidbody don't add any force. Do I need move the elevator with physics to stay movent? Or am I thinking the wrong way?" How to solve this problem? See the player movement script using UnityEngine using System.Collections public class Move MonoBehaviour public float speed public float jump public GameObject rayOrigin public float rayCheckDistance Rigidbody2D rb void Start () rb GetComponent lt Rigidbody2D gt () void FixedUpdate () float x Input.GetAxis ("Horizontal") if (Input.GetAxis ("Jump") gt 0) RaycastHit2D hit Physics2D.Raycast(rayOrigin.transform.position, Vector2.down, rayCheckDistance) if (hit.collider ! null) rb.AddForce (Vector2.up jump, ForceMode2D.Impulse) rb.velocity new Vector3 (x speed, rb.velocity.y, 0) |
0 | Fast zoom in and out in Unity Editor Is it possible to zoom out and zoom in in Unity Editor in Scene View faster than just with the help of scroll wheel on the mouse? I hope there are exist some shortcut for that. Am I right? |
0 | OnMouseOver not registering collisions I'm working on a UI heavy game and I'd like to add sound effects for when the player mouses over a UI button (using TMP, if that matters). I've tried OnMouseOver and its siblings OnMouseEnter and OnMouseStay, I've tried with and without 2D Box Colliders, but so far nothing I've tried seems to register that the mouse is over the button i.e. nothing happens. If a collision or Raycast hit were registered, all that I'm asking right now is for it to run the line Debug.Log( quot Collision detected quot ) I know that Unity is able to register hits on the UI element I'm testing on, because mousing over it engages the Sprite Swap function that's part of the Button component, which it would not do if it were not accepting Raycast hits. I'm sure there's some very simple solution to this, like a check box I haven't ticked, but I could really use some help here. Many thanks! |
0 | IndexOutOfRangeException Array index is out of range even though the inspector clues otherwise I am currently making a randomized infinite platform with GameObject already made platforms in 3 arrays. In the inspector everything is obviously running quite smoothly but I keep weirdly keep getting uncalled for errors like IndexOutOfRangeException Array index is out of range. Here is my code using System.Collections using System.Collections.Generic using UnityEngine public class BackFloorSetter MonoBehaviour public GameObject gameBackFloorsOne public GameObject gameBackFloorsTwo public GameObject gameBackFloorsFinal public Vector3 nextPosition public float unroundedFinalOrTwo public int finalOrTwo public float unroundedTwoFloor public int twoFloor public float unroundedFinalFloor public int finalFloor public GameObject currentSpawnFloor public float floorSpawnCounter public int counterGoal 5 void Start() nextPosition new Vector3(0, 0, 0) Instantiate(gameBackFloorsOne 0 , nextPosition, Quaternion.identity) void Update() floorSpawnCounter 1 Time.deltaTime if(floorSpawnCounter counterGoal) floorSpawner() counterGoal 5 unroundedFinalOrTwo Random.Range(0.6f, 2.4f) finalOrTwo Mathf.RoundToInt(unroundedFinalOrTwo) unroundedTwoFloor Random.Range( 0.6f, 3.4f) twoFloor Mathf.RoundToInt(unroundedTwoFloor) unroundedFinalFloor Random.Range( 0.6f, 4.4f) finalFloor Mathf.RoundToInt(unroundedFinalFloor) if (finalOrTwo 1) currentSpawnFloor gameBackFloorsTwo twoFloor if (finalOrTwo 2) currentSpawnFloor gameBackFloorsFinal finalFloor public void floorSpawner() nextPosition.x 232 Instantiate(currentSpawnFloor, nextPosition, Quaternion.identity) public void flatGroundSpawner() nextPosition.x 232 Instantiate(gameBackFloorsOne 0 , nextPosition, Quaternion.identity) |
0 | Mouse detect object without Collider? Is there any method for mouse or ray to detect object doesn't have collider ? If no, what also can I use ? |
0 | Unity3D Build Configuration for Deployment Publish Is there the option within Unity3D to specify build configurations? My goal is relatively simple when building for mobile stores (Play Store App Store) I want to make sure my app is pointing to the production services, rather than the test one I use in the editor testing on devices. It's controlled by a field on a MonoBehaviour currently, but we I need to remember to flip it from Test to Production before doing a build and publish. |
0 | Custom FPS Controller in Unity 5.6.6f2 not letting me look up or down Due to the FPS Controller seeming to be broken in Unity now, I started using a custom one by kinifi on GitHub. For some reason though I can't look up or down. I removed the Main Camera so it should of fixed it but no. Is there anything I can change in this script to allow me to look up and down. using System.Collections using System.Collections.Generic using UnityEngine RequireComponent(typeof(Rigidbody)) public class FPS MonoBehaviour private float speed 5.0f private float m MovX private float m MovY private Vector3 m moveHorizontal private Vector3 m movVertical private Vector3 m velocity private Rigidbody m Rigid private float m yRot private float m xRot private Vector3 m rotation private Vector3 m cameraRotation private float m lookSensitivity 3.0f private bool m cursorIsLocked true Header("The Camera the player looks through") public Camera m Camera Use this for initialization private void Start() m Rigid GetComponent lt Rigidbody gt () Update is called once per frame public void Update() m MovX Input.GetAxis("Horizontal") m MovY Input.GetAxis("Vertical") m moveHorizontal transform.right m MovX m movVertical transform.forward m MovY m velocity (m moveHorizontal m movVertical).normalized speed mouse movement m yRot Input.GetAxisRaw("Mouse X") m rotation new Vector3(0, m yRot, 0) m lookSensitivity m xRot Input.GetAxisRaw("Mouse Y") m cameraRotation new Vector3(m xRot, 0, 0) m lookSensitivity apply camera rotation move the actual player here if (m velocity ! Vector3.zero) m Rigid.MovePosition(m Rigid.position m velocity Time.fixedDeltaTime) if (m rotation ! Vector3.zero) rotate the camera of the player m Rigid.MoveRotation(m Rigid.rotation Quaternion.Euler(m rotation)) if (m Camera ! null) negate this value so it rotates like a FPS not like a plane m Camera.transform.Rotate( m cameraRotation) InternalLockUpdate() controls the locking and unlocking of the mouse private void InternalLockUpdate() if (Input.GetKeyUp(KeyCode.Escape)) m cursorIsLocked false else if (Input.GetMouseButtonUp(0)) m cursorIsLocked true if (m cursorIsLocked) UnlockCursor() else if (!m cursorIsLocked) LockCursor() private void UnlockCursor() Cursor.lockState CursorLockMode.Locked Cursor.visible false private void LockCursor() Cursor.lockState CursorLockMode.None Cursor.visible true |
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 to make Unity Layout switch while in Play mode I'm looking for a way to auto switch the Unity layout when I go to play mode. I want to Unity Editor layout automatically changes to my preset layout when I click on Play button and When I stop the game, It goes back to the default layout. |
0 | Attach movement to each list object How would i move every sphere that gets spawned every 2 seconds ? Basically i want every sphere to follow the previous spawned sphere or even all N 1 spheres should follow the first spawned sphere along a predefined path and they should keep rolling as a train of spheres. I am lost when i try to imprint movement to each sphere. using System.Collections using System.Collections.Generic using UnityEngine public class Spawner MonoBehaviour public GameObject prefabs public List lt GameObject gt listBalls new List lt GameObject gt () private GameObject x public int timer 0 private float movementSpeed 5f void Start() createBall() void Update() if (Time.time timer gt 0.8f) createBall() timer 2 listBalls listBalls.Count 1 .transform.position new Vector3(0, 0, movementSpeed Time.deltaTime) void createBall() x prefabs Random.Range(0, prefabs.Length) Instantiate(x, x.transform.position, Quaternion.identity) listBalls.Add(x) void moveBall(GameObject x, GameObject y) x.transform.position y.transform.position new Vector3(0,0, 1) Loop added but movement staggered void Update() if (Time.time timer gt 0.8f) createBall() timer 2 foreach (GameObject item in listBalls) item.transform.position new Vector3(0, 0, movementSpeed Time.deltaTime) |
0 | Where do components get added in Unity? In unity's GameObject class, there are a few default data members. When we add a component to the game object, light for example, where exactly does it get added? Does it become a part of the GameObject class? |
0 | animationClip.SampleAnimation() does not result in visible changes Here is the relevant code snippet public class AnimatedGameObject MonoBehaviour private float extentPlayed public AnimationClip Clip public GameObject AnimationTarget private void Update() if (this.extentPlayed gt 1f) return Debug.Log(this.extentPlayed) this.Clip.SampleAnimation(this.AnimationTarget, extentPlayed this.Clip.length) this.extentPlayed 0.005f In the Unity Editor, the game object assigned to AnimationTarget contains the animator component controlled by the controller that uses Clip. However, when I start the game, even though I can see that this.extentPlayed is being incremented every frame, no animation is taking place that I can see. I am aware that what I am currently trying to do in the Update() method can be achieved by calling SetBool(string name, bool value) on the animator, but the purpose of writing the Update() method this way is to gain familiarity with how the SampleAnimation() method works, so that I can perform more complicated manipulations when necessary. What changes should I make for the animation to take place? |
0 | Why can't I put a source image in my Image component? I can't put an image here as source image, and I have trouble figuring out why. What did I miss? |
0 | How do I move many "static relative to each other" objects around? I'm currently building an Elevator Bank simulator in Unity3d and I'm stuck on how to reduce the amount of objects it's going to generate when it's done. The simulator will consist of one player (for now) walking into a building, calling an elevator, picking a floor, going up down and getting out of the elevator again. To illustrate the problem, I'll sketch 2 scenario's. One where there's no problem whatsoever. One where I simply scale upwards and create a mess. But first, a list of what's inside the simulator (excluding the player). One hull of elevator shafts (3D .obj model). One elevator car per shaft (3D .obj model). One group of hall buttons per shaft per floor (one button for the top amp bottom floor, two for the rest). One group of control buttons per elevator car (door open, door closed, etc.). At least 3 buttons. One floor call button per elevator car per floor. Two doors per elevator car. Two doors per shaft per floor. A simple set up of 3 shafts and 4 floors will already create 75 objects of which 30 are moving. Take 20 floors, 2 rows of elevators, 3 cars per row and I'm over 600 objects already. Now. The Empire State building has 102 floors and 73 elevators. Which means multiple banks, a whole lot of floors, a whole lot of buttons and a whole lot of cars. Scaling my current set up to support that will create a mess at best and simply won't work at worst. Since this is an elevator simulator, the whole point of it is to make sure every elevator is active from starting the scene to ending the scene. So no tricks like only spawning what's in range of a camera, hibernating objects, object pooling and what not are out. Now, objects in the same elevator car are static relative to each other. If the car moves up, everything moves up the same amount. So I hope I can move them as a group. Except I have no clue how to do such a thing in Unity. Prefabs may be part of the solution, but that still won't link their movements together. I've considered linking them together like a Snake game, but the amount of objects involved is orders of magnitude more. Luckily, all moving objects (except for the player) will only move on one axis. Doors only slide open closed, elevator cars and their buttons go up and down. All rotations are fixed. How do I move so many objects around in a single scene without creating a mess of variables in a performance wise good way? |
0 | Adding a profile to a dialogue box I am trying to create dialogue boxes that contain the profile picture of the speaking character in them. As such, I want the profile pic to be attached to the object itself. If I understand this right, the following creates a variable space for profilePic that I then populate within the GUI. using UnityEngine.UI public class NPC Character SerializeField private Image profilePic Then over in my dialogue script I have the following using UnityEngine.UI This currently only allows for one sided conversations this can be later modified to add profile picture as well as several iterated conversations public class Dialogue MonoBehaviour SerializeField private UnityEngine.UI.Text dialogueText SerializeField private GameObject dialoguePanel SerializeField private UnityEngine.UI.Image profilePic private string dialogue private int dialogueIndex public void StartDialogue(string dialogue) dialogueIndex 0 this.dialogue dialogue dialoguePanel.SetActive(true) This is what actually affects the GUI dialogueText.text dialogue dialogueIndex this.profilePic profilePic The dialogue functions work. It should be taking the contents of this.profilePic and putting them into the UI.image profilePic component, right? The text works. The panel pops up. Just no picture. Anyone have any thoughts? |
0 | Artifacts on top of platform sprite only when moving I made a floating platform in Unity which has a propeller movement animation. I attached a script I wrote to the game object that adds slight vertical and horizontal movement using the game object transform.position. This is creating some weird artifacts at the top of the sprite, but only when the movement code is active. When I don't move the platform and just leave it still to animate there are no artifacts. Gameplay Sprite Import Settings Sprite Renderer Camera Settings Resolution |
0 | Can I run old projects after updating Unity? Today I decided to upgrade unity from 5.0.0 to 5.5.0. But before updating it, I wanted to know Can I run build my projects made in Unity 5.0.0 in Unity 5.5.0? |
0 | How do I set the opacity of a Button to 0? (Unity) I'm trying to hide a button when you click that button (I meant setting the opacity to 0, not disabling the game object of the button). What the button does is it loads a scene async. If I disable the game object I won't be able to load the scene async. Any way to set the opacity of the button? Sorry if the question is already asked as I wasn't able to find any questions related to this. |
0 | Does Unity own my game? I made my first game in unity, and I was wondering if I can sell it without owing anything to unity? |
0 | Custom Unity launcher localization I would like to localize Unity launcher using own texts. At the very least I would like to change "play!", "quit", "Graphics" and "Input" to own arbitrary labels. How can I achieve that? |
0 | What is Unity Quaternion range? I've read somewhere that a Quaternion in Unity ranges between 1,1 values. I mean the individual XYZW values. Ex new Quaternion(.1f,.2f, .3f, .4f) Is this true? More clearly I know they take float values therefore the theoretical limit is floating point value limitations, I'm asking the real rotation results. For instance when I look up Quaternion values while rotating a GameObject it is usually in the 1,1 limits. But I'm not sure if that's my case or not. |
0 | Is normal mapping cpu overhead or gpu overhead? In Unity3D Engine, I usually apply normal mapping using fragment shader. In this case, this normal mapping is cpu overhead or gpu overhead? |
0 | Not able to change Rigidbody 2d gravity scale I have been trying to change the gravity scale of my Rigidbody2d when I click on it. By default it is by 0 and when I click on it, it should change to 1, so that it falls down. I have a square with a boxcollider2d and a Rigidbody2d and a square with just a box collider. public bool gravity false public bool m isRunning false public SpriteRenderer m spriteRenderer private Rigidbody2D rb private void Update() if (gravity) rb.gravityScale 1 private void Start() m spriteRenderer this.GetComponent lt SpriteRenderer gt () rb GetComponent lt Rigidbody2D gt () private IEnumerator Changecolor() yield return new WaitForSeconds(1) int random Random.Range(1, 4) if (random 1) m spriteRenderer.color Color.blue else if (random 2) m spriteRenderer.color Color.red else if (random 3) m spriteRenderer.color Color.green else m spriteRenderer.color Color.yellow this.StartCoroutine("Changecolor", 3f) private void OnMouseDown() gravity true m isRunning !m isRunning if (m isRunning) StartCoroutine("Changecolor", 3f) else StopCoroutine("Changecolor") |
0 | Why does my Unity Android game get a small amount of lag when not being touched for some time? I have made a 3d version of space invaders. I made all the assets myself in Blender. I feel that it's a very basic game and my Galaxy Note 3 test device should handle it no problem. (Although it's a few years old now so perhaps some kind of shader issue or something that my phone not updated enough for ?) There are 55 enemies all with one mesh each. There's the flying saucer model and the player model. Then there's a plane for a background, and 4 defensive meshes (although I've tested without these and the result is the same). Basically, it all runs superbly (I have turned down much of the lighting and graphics quality etc, but have left basic shadows in). However I notice that if the player just lets the phone sit there in game without touching it, there is very slight (but noticeable) frame lag. All the enemies have a very short animation which moves its arms a small amount. I could post the code but its massively unorganized and really quite an embarrassment (HAHA!). Also I'm not sure what parts are relevant so it would be a huge post. Is there any known issues that can cause the lag only when not being touched? As I feel like some of my old projects might have had this happening too but they've been deleted now unfortunately so I can't really dabble with it. It works smooth as silk in the Unity Editor Android 'emulator' and as I say, if I actually play the game on my phone it's smooth too. |
0 | Disabled script works anyway I have a simple code that will be enabled when I kick, so I disable it right away but even though it is disabled, it works somehow. can it be because of his parent or something else I dont know of? this is the script Kick Test, i dont reach it from anywhere else private GameObject ball private Rigidbody2D rg2d public int power 30 void Start() ball GameObject.FindGameObjectWithTag("Ball") rg2d ball.GetComponent lt Rigidbody2D gt () this.enabled false private void OnTriggerEnter2D(Collider2D col) if(col.tag "Ball") Debug.Log("K CK") Vector2 pos (transform.position col.gameObject.transform.position).normalized rg2d.AddForce( pos power, ForceMode2D.Impulse) |
0 | Convert the animation inside FBX into Unity Recently i bought a package with an fbx and lots of animations. Since I want full control and change a couple of details, I want to convert them into the regular Unities Animation System. I cant convert them into the normal Unity Animations though. They are "read only". I can load them, copy paste them into my own "not read only" animation file. But somehow i cant change the file anymore after I pasted something inside. What am I doing wrong? Is that something "impossible"? Can you guys help? |
0 | How to ease toward a rotation limit, instead of stopping abruptly? I rotate my camera using a framerate independent exponential ease out blend like so x Input.GetAxis("Mouse X") xSpeed float target 0f I want to blend towards 0 float sharpness 0.05f the smaller this value, the longer it takes to settle down to the target value float referenceFramerate 90f the approximate framerate on my developer machine float blend 1f Mathf.Pow(1f sharpness, Time.deltaTime referenceFramerate) x Mathf.Lerp( x, target, blend) This works fine. Now my camera should be clipped at a certain rotation yaw. The new camera rotation yaw is calculated like this CurrentYaw x Mathf.Abs( CameraDefaultPos.z) if ( CurrentYaw gt 160f) CurrentYaw 160f else if ( CurrentYaw lt 120f) CurrentYaw 120f This clipping part of my code makes the camera stop abruptly at the maximum. How could the above Mathf.Lerp function be adopted to make it so that the x value would be damped more quickly when going towards the rotation limit? |
0 | Microphone channel not detected in Unity This is very specific to Unity. A few testers are reporting that their microphone output isn't being detected. The code below works for the vast majority of users, but certain microphones seem to be outputting on the wrong channel (R maybe)? AudioClip current microphone recording clip Microphone.Start(microphone name, true, 30, 16000) How can I capture and analyze output from several channels? I don't see any channels parameter for Microphone.Start |
0 | How to render the sprites for a 2D soft body physics system This is not a question as to how to achieve soft body physics, but rather if I have a mass spring system how to modify a sprite with that information. I am using unity so I dont have access to vector based graphics. |
0 | Unity, depth behind a transparent object Is there a way to know how far away is any object behind a transparent object in shader? Like making water fully transparent when close to shore. |
0 | Unity FPS Offline Multiplayer (MultiLan) Player Animation I am creating an FPS game in local multiplayer. One player creates the hot spot game, and the other one connects through WiFi network and plays the game. And i am doing this using unity MultiLan Package available in Unity Assets Store. when the player connect to the Game i play the player animation like walk , jump etc. But the problem is animation can play only which player who host the Game, not play to other player who join the Game in host network. That is Player Script. private MNetwork networkSrc public Btn Jump jumpScript public Btn DPad Btn DpadScript void Awake() if (GetComponent lt NetworkView gt ().isMine) trans transform contr trans.GetComponent lt CharacterController gt () if (jumpScript null) jumpScript GameObject.Find ("3 Jump").GetComponent lt Btn Jump gt () if (Btn DpadScript null) Btn DpadScript GameObject.Find ("6 D Pad").GetComponent lt Btn DPad gt () void Start() if (GetComponent lt NetworkView gt ().isMine) If it's my player search the networkManager component networkSrc GameObject.Find("MNetwork").GetComponent lt MNetwork gt () PlayerAnimatorComponent GameObject.Find ("Swat").GetComponent lt Animator gt () FPS Events.ChangeCharacterMotor(motor) void Update() if (!networkSrc.isPlayerExitGame) if (currentMotor null) FPS Events.ChangeCharacterMotor (motor) try currentMotor.Update () catch if (jumpScript.Player jump) if (Btn DpadScript.Player Run) RunAnimation () void RunAnimation() GetComponent lt NetworkView gt ().RPC ("SyncAnimation", RPCMode.All) RPC void SyncAnimation() if (Btn DpadScript.Player Run) PlayerAnimatorComponent.SetFloat ("Walk",2f,0.1f,Time.deltaTime) In this Script there is "Btn DpadScript" object of Virtual joystick Script name is "Btn DPad" for Player Movement. When player move then "Player Run" Boolean variable is true and play the Walk animation of player in SyncAnimation() method. But it is stuck to play animation in all player in same network. Any one can know how to play animation in all network player using MultiLan Package then tell me. I can't found in Google Search about player Animation in network using MultiLan Package. what should i do don't know any one can suggestion then i really appreciate thank you. |
0 | How To Deselect (Unfocus) All gameObjects in a Unity Scene View? When I'm done with moving and rotating gameObjects in a Unity scene, I want to deselect everything to not accidentally change it. How? In some applications ESC key does the trick, in others 'D' (deselect) comes to rescue. But I don't know any remedy in Unity. My workaround is that I click somewhere in the Project View (I don't like this approach because it brings up the inspector for that asset). |
0 | cant add script component So I'm just starting to try to learn unity development with C using this tutorial but I cant add the script to any game object and I get the following error Code of the script using System.Collections using System.Collections.Generic using UnityEngine public class NewBehaviourScript MonoBehaviour Start is called before the first frame update public Light myLight void Update() if (Input.GetKey("space")) myLight.enabled true else myLight.enabled false I know it's been answered before but I've done everything I read, I did my homework and I still cant get around this issue. I allready checked the name of the class and its the same as the file's name. I think it may be something regarding installation (?) I installed unity hub and it installed Unity and Microsoft Visual Studio by itself. Unity version 2019.3.3f1 MS Visual Studio version 16.4.5 MS Net Framework version 4.7.03062 I honestly dont know what else to do people! Please help! |
0 | How do I use UsePass in a shader in Unity when the pass does not have a name? I'm trying to use passes from a given built in shader in Unity. The docs say that the syntax is UsePass "Name". The problem is that built in shaders don't have names on their passes. How could I do that in this case? To be more specific, at the moment I need to use the Skybox shader passes. Here is one of the Subshaders in the internal Skybox.shader file SubShader Tags "Queue" "Background" "RenderType" "Background" Cull Off ZWrite Off Fog Mode Off Color Tint Pass SetTexture FrontTex combine texture primary, texture primary Pass SetTexture BackTex combine texture primary, texture primary Pass SetTexture LeftTex combine texture primary, texture primary Pass SetTexture RightTex combine texture primary, texture primary Pass SetTexture UpTex combine texture primary, texture primary Pass SetTexture DownTex combine texture primary, texture primary As can be seen there's no name in the passes. My shader is the following Shader "Custom Outline" Properties Color ("Main Color", Color) (.5,.5,.5,1) OutlineColor ("Outline Color", Color) (1,0,0,1) Outline ("Outline width", Range (0.0, 0.1)) .05 SpecColor ("Specular Color", Color) (0.5, 0.5, 0.5, 1) Shininess ("Shininess", Range (0.03, 1)) 0.078125 MainTex ("Base (RGB) Gloss (A)", 2D) "white" SubShader Tags "RenderType" "Opaque" Tags "RenderType" "Background" Pass Name "OUTLINE" Tags "LightMode" "Always" Outline pass logic (not important for the problem)... UsePass "RenderFX Skybox ..." WHAT SHOULD I DO HERE? UsePass "Bumped Specular FORWARD" The problematic line is at the end, as can be seen. The shader works for the Opaque case, using the "Bumped Specular FORWARD" pass (see the commented lines). The built in Bumped Specular shader is the following Shader "Bumped Specular" Properties Color ("Main Color", Color) (1,1,1,1) SpecColor ("Specular Color", Color) (0.5, 0.5, 0.5, 1) Shininess ("Shininess", Range (0.03, 1)) 0.078125 MainTex ("Base (RGB) Gloss (A)", 2D) "white" BumpMap ("Normalmap", 2D) "bump" SubShader Tags "RenderType" "Opaque" LOD 400 CGPROGRAM pragma surface surf BlinnPhong sampler2D MainTex sampler2D BumpMap fixed4 Color half Shininess struct Input float2 uv MainTex float2 uv BumpMap void surf (Input IN, inout SurfaceOutput o) fixed4 tex tex2D( MainTex, IN.uv MainTex) o.Albedo tex.rgb Color.rgb o.Gloss tex.a o.Alpha tex.a Color.a o.Specular Shininess o.Normal UnpackNormal(tex2D( BumpMap, IN.uv BumpMap)) ENDCG FallBack "Specular" Even when using the Bumped Specular I had to find the pass name by trial and error, seeing code snippets from older versions, etc. That's why I like to have code for everything... I could just read the code of the shader management system and figure it out. Anyway... any ideas? |
0 | How to move empty colliders? I have 2D background in unity on which I would like to add multiple circle, box colliders. Assets are not separated. I have drawn assets on background. How to move circle colliders with mouse or keyboard shortcut on the background? It's not very pleasant to define x,y position wherever needs to go for every collider. |
0 | Unity resizing particles dont mantain collisions properly I am trying to make particles for blood on death. This is what I got so far Which looks fine and all. But now I also wanted to make the blood particles turn smaller over their lifetime, so I checked "Size over lifetime" and this is what happens now See the problem? As they shrink, they seem to float a little, giving some space between the floor they are laying on. This behaviour is not really desired. How could I solve this? |
0 | Prevent feet from moving for a Unity character from a Mixamo animation So my question isn't about root motion, but rather just keeping the feet in place on the ground for a Mixamo animation... I tried to just delete the feet and toes in avatar configure, but nope... I am wondering if there is some sort of simple way to have an animation affect all but the feet? |
0 | How to make a static Material reference? I have a class Edge which may change to multiple colors materials in this case. I need to switch a Material on MeshRenderer. In order to do this, I'd need to make multiple prefabs public variables like class Edge Mono public Material red, blue, green public void SwitchColor(SomeColorEnum param) switch(param) change this.renderer.mat something This is a bad solution for this, cause I'd need at least 3 material references in each Edge object. Is there any way to make a material static, assign it from a prefab and then access it statically? |
0 | How to receive broadcast message in Unity? I am trying to get the broadcasted message in overridden method of NetworkDiscovery.OnReceivedBroadcast(). For that what I had done is below I create class which implements NetworkDiscovery where I override the method OnReceivedBroadcast() to capture the broadcast messages. In Unity Editor, I created an empty GameObject where I add the class in step 1 as component. Now in code, I started the custom NetworkDiscovery class as below Discovery.Initialize() Discovery.StartAsClient() Now, when I start the broadcast in server, I am not receiving any broadcast message in OnReceivedBroadcast(). Below is my custom NetworkDiscovery class. public class CustomNetworkDiscovery NetworkDiscovery Use this for initialization void Start() Update is called once per frame void Update() public override void OnReceivedBroadcast(string fromAddress, string data) base.OnReceivedBroadcast(fromAddress, data) One thing I noted is, If I use the NetworkDiscovery component directly in step 2 instead of using custom NetworkDiscovery class. I am able to see broadcast messages in it's default GUI. How can I receive the broadcast message in the inherited class? Any help will be appreciated. Thanks. |
0 | using an int to control events Let me explain I'm just looking for a way that I can link a number to a set of methods. I want to randomly generate a "difficulty" int, and pick out an event based on the number I get. IE, if I get an int of 3 I want that to point to a specific event. What's the best way to accomplish this? I was thinking of story the events in lists, but methods can't be in lists. I thought about making the methods into delegates and putting those in lists but that seems unnecessarily complicated. Also, in the future I think I'd want to put multiple events at each level which would sort of make putting them into array or lists difficult. |
0 | WebGL Open URL in new tab? How to open URL in new tab for WebGL? Tried Application.OpenURL("url"). But it's opens a tab in same window Thanks |
0 | Gradient fill color on circular sprite I have a white circle sprite. I know how to change its color to a solid fill color. using GetComponent lt Renderer gt ().material.color. But how would I give it a gradient fill color. I've been trying to do this with a shader. But so far the shader I've created doesn't take the circle sprite into account, simply its bounding box. It also looks a bit weird. here's my shader code Shader "Custom SpriteGradient" Properties PerRendererData MainTex ("Sprite Texture", 2D) "white" Color ("Left Color", Color) (1,1,1,1) Color2 ("Right Color", Color) (1,1,1,1) Scale ("Scale", Float) 1 SubShader Tags "Queue" "Background" "IgnoreProjector" "True" LOD 100 ZWrite On Pass CGPROGRAM pragma vertex vert pragma fragment frag include "UnityCG.cginc" fixed4 Color fixed4 Color2 fixed Scale struct v2f float4 pos SV POSITION fixed4 col COLOR v2f vert (appdata full v) v2f o o.pos mul (UNITY MATRIX MVP, v.vertex) o.col lerp( Color, Color2, v.texcoord.x ) return o float4 frag (v2f i) COLOR float4 c i.col c.a 1 return c ENDCG |
0 | How to stop Players and Enemies from pushing each other I am developing 2D Top Down RPG game. I have script that makes my enemy follow the player, and when they touch the player, the player will start to lose HP. Everything works well, but when they touch each other, the enemy starts pushing the player and also I can push the enemy too. I use a Rigidbody2D and BoxCollider2d for each of them. Here is my enemy controller code using System.Collections using System.Collections.Generic using UnityEngine public class EnemyController MonoBehaviour private Animator myAnim private Transform target public Transform homePos private Rigidbody2D myRB SerializeField private float speed SerializeField private float maxRange SerializeField private float minRange Start is called before the first frame update void Start() myAnim GetComponent lt Animator gt () target FindObjectOfType lt PlayerController gt ().transform myRB GetComponent lt Rigidbody2D gt () Update is called once per frame void Update() if (Vector3.Distance(target.position, transform.position) lt maxRange amp amp Vector3.Distance(target.position, transform.position) gt minRange) FollowPlayer() else if(Vector3.Distance(target.position, transform.position) gt maxRange) GoHome() public void FollowPlayer() myAnim.SetBool( quot isMoving quot , true) myAnim.SetFloat( quot moveX quot , (target.position.x transform.position.x)) myAnim.SetFloat( quot moveY quot , (target.position.y transform.position.y)) transform.position Vector3.MoveTowards(transform.position, target.position, speed Time.deltaTime) public void GoHome() myAnim.SetFloat( quot moveX quot , (homePos.position.x transform.position.x)) myAnim.SetFloat( quot moveY quot , (homePos.position.y transform.position.y)) transform.position Vector3.MoveTowards(transform.position, homePos.position, speed Time.deltaTime) if (Vector3.Distance(transform.position, homePos.position) 0) myAnim.SetBool( quot isMoving quot , false) |
0 | How to duplicate Blender glow and reflection effects in Unity? I am trying to make my game more interesting by making a background with this NEON tunnel made of glowing lines. Since I am not a good 3D artist, I choose to hire some freelancers, and they made a model that looks great in Blender. I have all that I need...but when I import my object into Unity, it does not have any effects, any colors, any glow or any "mirror" reflection. The biggest problem is that I cannot find any other freelancer who actually knows how to fix this problem. This is how it shows up in Blender when my freelancers made it, and it looks perfect I want to have the same effects, same look, same colors, same glow in my Unity project, but I don't know how to actually import this object and reproduce that same look. This is all zip folder which contain pictures, object in blender file, same object in .fbx,.obj.mtl and in many more formats.. but seems like any of those models doesn't work in Unity because I bet Unity needs more modifications... I hope someone will help me step by step to achieve my goal. |
0 | Game engine like Unity 3D that allow me to use .NET code I've been looking at Unity 3D for developing a 3D PC game and I really like the scene editor and how it simplifies the process of constructing 3D scenes, managing assets, animations, transitions etc. However, I don't want to restrict myself to using the Unity 3D scripts for handling every bit of game logic in the game. E.g. If I want to construct a RPG dialogue system I don't want to do it with unity 3d scripts I'd like to use C .net. Also, I might want to use e.g. windows azure and sql azure as backend, and use 3rd party .net libraries such as reactive extensions etc. Is there a .net engine out there that helps me with asset loading, animations, physics, transitions, etc. with a scene editor, but allow me to plug it into a visual studio .net project? Thanks |
0 | Limit the boundary of Touch a game that I currently working on is in a way that player should actually draw a rainbow on the screen by tap and drag gesture in order to make a hills for the car. but the issue that i currently facing on is if the player wants to pause the game by touching the right most button on the screen above, the game will stop but the hill that he was drawn will remove. I actually not have any idea how can i put exception for that button on the screen because everytime i calculate the whole pixels on the screen for drawing hills. do you have any idea how can i solve this issue ? btw, this is my code if it's required http pastebin.com VnLAQbzW |
0 | Unity built in Network Lobby How to move GUI? I'm using built in network manager HUD and I'm fine with it for now. But I can't move lobby GUI, only Network Manager HUD. Is there a way to move it down to make space for Title Art? |
0 | Understanding pixel art in Unity 2d I am struggling to understand the basics behind pixel art in Unity. I understand what a unit is, and that if I draw my sprite with 16x16 pixels, I should set PPU to 16. Take stardew valley for example, in the image below you can clearly see that the player is not square. The creator of the game said he made everything in 16x16, but then how is there so much detail in the characters? Surely you do not patch several 16x16 squares together to make a character (as you would with a tilemap)? What is the "common" way of dealing with things that are not square, like the characters in the image. Do you just make 16x32 sprite and set PPU to 16? Wont that make it look a bit weird next to 16x16 sprites? Do you generally pick one size (i.e 16, 32, 64) And then stick to that for everything in the game? The visual Issue I've seen is this, where a 32x32 sprite looks very out of place (too sharp) next to a 16x16 sprite. So I am wondering, how do you mix sizes wihout getting this effect where one image looks much sharper than the other. If I for example wanted a character to be 16x32, or any non square value, when my tiles are 16x16 |
0 | How can I place prefabs into a world and what's the best way to get them? Hi all ) I'm making a 2D roguelike platformer and I want to make a load of hand crafted rooms and like spelunky place them around. When the player enters a room a script will go off. The script will know what exits the current room has and what entrance was used (Don't need to place anything where the player came from). I then have 2 options for choosing what rooms will work I can either have all the prefabs contain a script with a list of all the exits they have, then check that list for if the right one is there. I.E Entered room from the left. Room has left, right and top exits. I can ignore the left as that's where I came from, I can ignore the bottom as there isn't an exit there but I need to check the arrays on the prefabs to see if they have right and top in them. After that I'd place the top one x units above and the bottom one x units below (I'd also check something wasn't there before placing over it). The other option is to have 4 lists of prefabs. A list for top exits, bottom exits, left exits and right exits. Then look through those for what I need. Then I would place the blocks where they needed to be from there. So, as the title says, what of those options would you use for picking and how can I then get the prefab I need and place it into the world. I'll use a "Centre" item for it and then place the centre of the prefab a certain amount to the side of the current rooms centre. Thanks in advance for any help you can give ) |
0 | How to prevent "reverse" displacement from a collision? In my game I can throw a hammer. The hammer moves based on physics in Unity. The hammer destroys the first object it touches. I want it to continue moving as though it didn't touch anything when this happens. To try and achieve this, I made it destroy objects using a separate, larger trigger collider, intending to destroy the object before the physical collision occurs. However, when moving at very high speeds (as in the GIF), both colliders hit at once, so the hammer moves and the object deletes. How can I prevent the hammer from moving when before the trigger occurs, or (I suppose more realistically) "reverse" the movement such that there's no perceptible collision? I tried using the impulses from each of the contacts in the collision to apply forces in reverse, but didn't really understand what I was doing and ultimately failed. NOTE I cannot simply disable the physics collider, because it doesn't destroy everything. |
0 | How to fold a view from 2 3D cameras in Unity? I need to combine view from 2 or more 3D static cameras. Let's say I have 3 humans standing in line side by side. The first camera is viewing the left person and the left half of the middle person. The second camera is viewing the person on the right and the right half of the middle person. Now I need to see the whole middle person. Any ideas how I can do this? I don't need to see code or some finished implementation, I just need some ideas, because I can not find anything on this. |
0 | Download Progress bar from Firebase Storage Im trying to make a progress bar based on downloaded images from Firebase storage, now firebase does provide a snipper which works per image Create local filesystem URL string localUrl quot file local images island.jpg quot Start downloading a file Task task reference.GetFileAsync(localFile, new StorageProgress lt DownloadState gt (state gt called periodically during the download Debug.Log(String.Format( quot Progress 0 of 1 bytes transferred. quot , state.BytesTransferred, state.TotalByteCount )) ), CancellationToken.None) task.ContinueWithOnMainThread(resultTask gt if (!resultTask.IsFaulted amp amp !resultTask.IsCanceled) Debug.Log( quot Download finished. quot ) ) but i would like to make that appear on a UI text based on the percentage of the Bytes downloaded like starting from 0 to 100 .Now i have come to this function so far which does work in the sense of downloading from storage and i do get the percentage in the console but im not sure how to convert that to a percentage to show on UI. if (CheckConnectivity) if the device is connected to the internet, initiate download. Debug.Log( quot Initiating download of quot platform file) if (!File.Exists(localPath)) Task task storageRef.GetFileAsync(localPath, new StorageProgress lt DownloadState gt (state gt called periodically during the download Debug.Log(String.Format( quot Progress 0 of 1 bytes transferred. quot , state.BytesTransferred, state.TotalByteCount )) ), CancellationToken.None) await storageRef.Child( child).Child( file).GetFileAsync(localPath).ContinueWithOnMainThread(files gt if (!files.IsFaulted amp amp !files.IsCanceled) if download is successful. Debug.Log( quot file saved as quot localPath) else otherwise report error. Debug.Log(files.Exception.ToString()) ) else Debug.Log( quot files Exist quot ) else otherwise don't bother. Debug.Log( quot Cannot Download file due to lack of connectivity! quot ) in which case my debug is this Progress 1731 of 52804 bytes transferred. Which i would like to say 0 and counting up to 100! Thanks! |
0 | Is it possible to interpolate different sprites? I can interpolate different animations based on position, rotation, and scale. I want to do the same for different sprites, automatically. For example, lets say I have a soda can being crushed. I have 2 sprites One is the soda can uncrushed, and one is the soda can fully crushed. I want to only use those 2 sprites, and have Unity automatically transition from the normal can to the crushes can. How can I do this without making a bunch of key frames in between? |
0 | Why are my animated objects (from Blender) always playing at the global origin in Unity? I created and animated a sledgehammer in Blender 2.67b using an armature. The sledgehammer has one animation (created using the Action Editor) called "Idle". I parented the imported sledgehammer to an empty GameObject and set the sledgehammer's position to (0, 0, 0). I then moved the parent GameObject to where I want it in the scene. When I launch the game, the animation plays but the sledgehammer child always re positions itself to be at the global origin, no matter where I place the parent GameObject. See the image below Notice how the sledgehammer's position goes from (0, 0, 0) to ( 1087, 3, 1149). The armature has a single bone and has the sledgehammer object as a child. I've spent about 4 hours looking this up on the Internet, but it seems like parenting the animated mesh to an empty GameObject worked for everyone else except me. Anyone else experience this? I've tried both .fbx and .blend files. |
0 | I can't find a way to make my projectile gameobject collide with my ofscreen collider so my code on my collider is as followed public class Collide MonoBehaviour private void OnCollisionEnter2D(Collision2D collision) Debug.Log("Collision") the projectile has a rigidbody2D and a capsule Collider 2D. collider has a box collider 2D. the projectile spawns from my player and moves upwards in the direction of the collider (the collider is large enough that the projectile cant miss it). the projectile however goes straight through the collider and no message appears and I have no idea why. what I've tried and made sure of both are on the same layer and plane(z axis) gave the collider a rigidbody but changed nothing made the collider on trigger and not on trigger made the projectile dynamic and kinematic changed collider script to onCollisionEnter and onCollisionEnter2D |
0 | How do I calculate the duration between 2 frames in an animation file I want to find out the duration between 2 frames in animation file. Is the following correct? fDurationBetween2Frames AnimationClip.length AnimationClip.frameRate Thank you. |
0 | How to load values into a script from a file? I have a prefab of a "generic unit " each one has a script with some public variables name, health, and attack. Currently, I am manually making copies of that prefab and editing their names, health and damage values in the inspector. This seems unwise to me. I would rather be able to make a simple file for each unit type, containing its important information, like this name "Archer" health 3 attack 1 And so on. Then, I would like to be able to turn that into actual GameObjects in Unity, presumably by instantiating the prefab and filling in its values with values from the file. I could then make a script that runs when the game begins and iterates through, making all the objects I need. However, I do not know the proper way to go about doing this. Is there some way to read files and slot values into variables of a script? To be clear, I would like to be able to tell Unity to make an Archer, then have it read the Archer file, look up its values for health and attack, then instantiate a copy of the Generic Unit prefab and slot the values that it read into the public variables of a script component of the newly created game object. |
0 | Do I need to build my scripts every time I go back into Unity from my script editor? I saw a few Unity YouTubers who do not build their scripts when they are working. But I always do it. Do I have to? |
0 | Check if all gameobjects are destroyed I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero. How do I do that? |
0 | Events vs direct reference in Unity3D? I'm developing a simple NPC controller that the player can talk with. At the moment a NPCController script on the NPC gameobject manages several "high level" feature of the NPC such as intelligence. Every time the player talks with the NPC, the latter will respond with "Bzz", "Hello" or "Heya" depending on his intelligence level. The talking part is implemented in a TalkController script. I did this way in order to have multiple behaviours depending on the player npc interaction without creating a giant NPCController class. Plus some NPC may not speak at all (in this case I'd simply remove the TalkController). I have a small dilemma on how to change the NPC response in TalkController based on the intelligence level in NPCController. I could use Events NPCController.cs public delegate void OnIntelligenceLevelHandler(int level) public static event OnIntelligenceLevelHandler OnIntelligenceLevelChanged When intelligence increases OnIntelligenceLevelChanged(2) and TalkController.cs Store intelligence 1 Subscribe to OnIntelligenceLevelChanged Upgrade intelligence when the event fires Switch word on intelligence when talking I could use a direct reference TalkController.cs Store npccontroller GetComponent lt NPCController gt () Switch word on npccontroller.Intelligence when talking What would be the best approach? |
0 | Art style for a character that has frequent visual changes during gameplay I'm creating a game with a bodybuilding fitness theme. The camera will almost always be focused on an inclined front view of a character who will be evolving very frequently during the game as the player 'levels up' the musculature of each part of the character such as arms, legs, chest, etc. I've been doing some research trying to figure out the most economical yet effective way to incorporate this visual mechanic of letting individual parts of a character independently increase in size and detail and have come up somewhat short, most likely due to my complete lack of experience when it comes to art (my experience is mostly in programming). I was thinking 2D would be best for this game, however maybe this one character should be in 3D? Would a low poly style fit these requirements, or should I look towards something akin to sprites or hand drawings? The games interactivity will be purely through menus so that doesn't need to be taken into account when dealing with the problem of this character. I would like this character to have some animations, of course, however I'm not sure if that fits the scope of this single question. |
0 | Removing FMOD from a Unity WebGL project causes an error about not being able to copy fmod register static plugins.cpp When I imported the FMOD plugin into a Unity WebGL project, then removed it afterwards, I wasn't able to build it due to errors about trying to copy an FMOD file fmod register static plugins.cpp Restarting the editor, reimporting everything, deleting Library Temp folders did not help. Neither did deleting the FMod folder. |
0 | How can I create a GraphQL query with nested I am using GraphQL plugin from https github.com Gazuntype graphQL client unity. I have a long query from which I am parsing it to JSON to get individual values. It all works fine. Unfortunately the problem appears when using SetArgs() in a nested . For example, here is my query System(ID quot 1 quot ) model type SystemModel CreationModel(isModelCreated true) name And here is my Unity code public async void GetSystemID () GraphApi.Query query Graph.GetQueryByName ( quot System quot , GraphApi.Query.Type.Query) query.SetArgs (new ID quot 1 quot , isModelCreated true ) How do I provide isModelCreated here UnityWebRequest request await NestedQuery.Post (query) JSONNode itemsData JSON.Parse (request.downloadHandler.text) var parseJSON JSON.Parse (request.downloadHandler.text) So in SetArgs, I have to provide a list of arguments, for example ID quot 1 quot and isModelCreated true. I am able to provide the first argument, but unfortunately the nested query's argument isModelCreated is not getting recognized as it treats it as System(ID quot 1 quot , isModelCreated true) Do I have to add multiple so that it comes in right order or is there a cleaner way to achieve this? |
0 | .png file to Sprite(2D and UI) still not visible under source image I am trying to use an image as a UI Image but even after changing its texture type to Sprite(2D and UI), it isn't visible in the source image menu. The file was created in MS Paint and I'm accessing the source image menu via the "circle selector" next to Source Image in the Inspector. I'm pretty sure I've never had this issue before. I wish I could share more details but there's nothing much to say. What could be causing this issue? |
0 | How can I create a dice toss that results in a specific value? I am trying to create a 3D dice for a game. Normal dice has been created by setting cube for dice with Rigidbody and apply force to throw a dice. Now the problem is, the user wants to give a value 1 6 in the text box then they will press the roll button. The dice have to rotate and need to show the dice value as the user enters in the text field once it stops rolling. For example In the Input box the value entered as 5, Now the dice want to roll on the table and show the value as 5. Anyone, please help me to solve this Thanks in Advance |
0 | Unity are particles rendered and calculated when off screen? I have a scene where I have a lot of instances of the same particle system. As the game will go for mobile, I fear the particles are calculated even when they are not shown. So to cut it short, I would like to know if the particle system is being calculated and rendered even if off screen. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.