Unity how to mimic the lighting of a mesh as seen in the editor view I have a camera which shows a "bird's eye view" of a procedurally generated mesh like so Currently in the editor view (right), the terrain looks exactly as I would like it to. However, in game (left) I haven't been able to get it to appear as I would like I was using a directional light above, which was causing the effect where the centre of the mesh appears "shiny". So I looked around at some forum posts and questions on here and decided to try using ambient lighting instead by altering the settings in Window Rendering Light Settings, but this is the result This is the material I'm using (EDIT I'm using a particle shader as the colouration of my mesh is based on altering Mesh.colors. ) I have tried fiddling around with different material types but I couldn't get better results. My question is how do I set up my game to use the same lighting that's being used in the editor? Thanks in advance EDIT Camera settings at runtime as requested EDIT 2 Just to update I have still not managed to fully solve this problem. I ended up using some different colours for my heightmap and tweaking the Metallic and Smoothness properties of the material, and the shininess and non even lighting is somewhat diminished, but it does still exist. If you watch at about 20 seconds into this video, when the mesh is dully coloured, the "circular" lighting effect is still present, which shadows being cast from the centre outwards, and the middle appearing almost blurred and the edges sharp. Later in the video you can see a colourful version of the mesh, where these undesirable lighting effects are barely noticeable (note that I don't always want it to be be in bright colours, hence this is still an issue). I feel like there should be a very simple solution to this. Why can I not get the lighting conditions that I see in the editor in the game view? I am very happy to keep updating here with further progress clarifications, and would love to hear any suggestions anyone has.


Large amounts of strings to be used, but how to store them? This is a question I've been meaning to ask. I have thought about it for a little bit and have a few ideas, but I'm not sure which is most secure, and will give me the most functionality with the most efficiency. For my game (being a story game) I have a plethora of strings that I'm going to need to display. I decided to split up the story into chapters, each chapter being a new scene(This way I could organize the content for the chapter). What I was thinking was that I could write regular text files with the chapter's content, while efficient and practical, this seems highly insecure. Then I thought, why not put it into large string arrays on a separate C file. Well that's more secure, but it's not really practical and it has less efficiency. So I have found pretty much the two extremes here. What would be the best way to deal with large amounts of strings in a secure, efficient, and functional way? Think about a happy medium compared to my two extremes.


Using IPAD's as controllers for a Unity game We are making a Multiplayer game using Unity. The actual game would be run from a PC projected on a screen and the players would be using their respective Ipad as a controller to play the game. I am not sure how difficult this would be to achieve inside Unity but I am assuming that all the game data inside Unity would need to be fed and retrieved from some kind of a server. How would this be possible with Unity because each Ipad would have a separate Unity build and also a separate build for the PC from where the actual game would be running.


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).


How could I get composite rigid body into unity I am developing a game, in unity, that has accurate destruction physics and from my understanding unity uses plain old rigid body physics. I was wondering if there was a way to bring composite rigid body physics into unity through a plug in or library or some other way? Thanks, nova edit So composite rigid body physics is almost exact like normal rigid body physics. But the main difference is that in composite rigid body physics all of the assets will not be considered physics based objects until an outside force hits them. For example a building and all of that parts it is made out of will not be processed as physics based objects until say a rocket hits it. This method of composite rigid body physics uses much less memory because it is only processing what is being affect and not everything else.


Why the Vector3.Dot value is 12 when running the game? using System.Collections using System.Collections.Generic using UnityEngine using UnityEngine.UI using UnityEngine.Events using System public class InteractableItem MonoBehaviour public string currentMode private Transform player private InteractableMode currentInteractableMode private string currentDesription private float originDistance private void Awake() player GameObject.Find( quot Player quot ).transform originDistance transform.GetComponent lt InteractableItem gt ().distance public enum InteractableMode Description, Action, ActionWithoutThrow public enum ViewMode FrontView, AllView public ViewMode viewMode ViewMode.AllView public InteractableMode interactableMode InteractableMode.Description public float distance TextArea(1, 10) public string description quot quot public bool IsAnyAction() return interactableMode InteractableMode.ActionWithoutThrow interactableMode InteractableMode.Action public bool IsActionWithoutThrow() return interactableMode InteractableMode.ActionWithoutThrow private void Start() currentMode GetComponent lt InteractableItem gt ().interactableMode.ToString() currentInteractableMode GetComponent lt InteractableItem gt ().interactableMode currentDesription GetComponent lt InteractableItem gt ().description private void Update() var heading transform.position player.transform.position var dot Vector3.Dot(heading, transform.forward) if(viewMode ViewMode.FrontView amp amp dot lt 1) transform.GetComponent lt InteractableItem gt ().distance 0 if (viewMode ViewMode.FrontView amp amp dot gt 1) transform.GetComponent lt InteractableItem gt ().distance originDistance The script is attached to some objects and one of them the ViewMode is set to FrontView and then when running the game first time the dot value is 12 and then it's getting inside and going the line if(viewMode ViewMode.FrontView amp amp dot lt 1) transform.GetComponent lt InteractableItem gt ().distance 0 but it should not set the distance to 0. only if I'm getting close enough to the item then it should see the item from the front and then only if I'm moving the player behind the item the dot should be minus and set the distance to 0 but for some reason the dot is minus 12 when running the game so it's setting the distance to 0 right away.


Free camera navigation and pre defined locations I have an interactive scenery app written in Unity, where users can freely navigate the camera through the scene. What I want to do now, is to let user automatically fly to some quot hotspots quot with a single key stroke, while still allowing the users to navigate manually. I tried Animation, but with it, auto fly and manual navigation are mutually exclusive I have to disable one in order for the other to work. Right now, I'm attempting the fall back solution, where I create some empty game objects with special scripts attached, so that when public script functions are invoked, the game object animates the camera to a pre defined transformation. My question being is there a better solution than my fall back?


Unity Free Inverse Depth Mask? How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the camera render layer one depth down, usually by using ColorMask 0. What I want is for, instead, the mesh to determine what ISN'T cut out, without everything that is NOT seen through the mesh being cut out.


Player must places the object in the preset position I want to know how to do like this video https youtu.be 6gouxqSxeG8 At the minute 3 09, the player can put the street vendor in the predetermined location (with the green arrow show that place). Please tell me some keyword about this or video tutorial about how to implement it in unity 2d. Thanks.


Strange realtime shadows in Unity3D I'm trying to do realtime lighting, and my shadows are acting very strange. When I project a spotlight out from the camera (like a flashlight in a first person game) my shadows show up as 3D skews of the objects, and I can actually clip through them if I move the camera in the right way... if I detach lights from the camera and just have them sit in one position, I don't seem to have this issue (cylinder to the right is just the model Im using for the flashlight... its attached to the camera) All objects have Cast Shadows set to "On" All objects have Receive Shadows checked All objects have Light Probes and Reflection Probes set to "Blend Probes" All objects have Motion Vectors set to "Per Object Motion" All objects have Lightmap Static unchecked All objects have Dynamic Occluded checked All lights have Mode set to "Realtime" All lights have Shadow Type set to "Soft Shadows" All lights have Realtime Shadow Strength set to 1 All lights have Realtime Shadow Resolution set to "Very High Resolution" All lights have Realtime Shadow Bias set to 0 (changing this doesn't seem to effect the issue) All lights have Realtime Shadow Normal Bias set to 0 (changing this doesn't seem to effect the issue) All lights have Realtime Shadow Near Plane set to 0.1 (changing this doesn't seem to effect the issue) All lights have Draw Halo unchecked All lights have Render Mode set to "Auto" All lights have Culling Mask set to "Everything" Camera has Clear Flags set to "Solid Color" Camera has Background set to 000000 Camera has Culling Mask set to "Everything" Camera has Projection set to "Perspective" Camera has Field of View set to 60 Camera has Near Clipping Plane set to 0.3 Camera has Far Clipping Plane set to 1000 Camera has Viewport Rect set to 0, 0, 1, 1 Camera has Depth set to 0 Camera has Rendering Path set to Use Graphics Settings Camera has Occlusion Culling checked Camera has Allow HDR checked Camera has Allow MSAA checked Camera has Allow Dynamic Resolution unchecked Camera has Target Display set to "Display 1" In Player, Rendering Color Space set to "Linear" In Player, all Rendering Auto Graphics APIs checked (win, mac, lin) In Player, Rendering Static Batching checked In Player, Rendering Dynamic Batching checked In Player, Rendering GPU Skinning unchecked In Player, Rendering Graphics Job (Experimental) unchecked In Player, Rendering Lightmap Encoding set to "High Quality" In Graphics, all Built in Shader Settings are set to "Built in shader" In Graphics, Shader Stripping Lightmap Modes is set to "Automatic" In Graphics, Shader Stripping Fog Mode is set to "Automatic" In Graphics, Shader Stripping Instancing Variants is set to "Strip Unused" In Graphics, Preloaded Shaders Size is set to 0 In Lighting, Skybox Material is set to "Default Skybox" In Lighting, Sun Source is set to "None (Light)" In Lighting, Environment Lighting Source is set to "Color" In Lighting, Environment Lighting Ambient Color is set to 000000 In Lighting, Environment Lighting Ambient Mode is set to "Realtime" (and the dropdown box is greyed out, so I can't change it) In Lighting, Environment Reflections Source is set to "Custom" In Lighting, Environment Reflections Cubemap is set to "None (Cubemap)" In Lighting, Environment Reflections Compression is set to "Auto" In Lighting, Environment Reflections Intensity Multiplier is set to 0 In Lighting, Environment Reflections Bounces is set to 1 In Lighting, Realtime Global Illumination is checked In Lighting, Baked Global Illumination is unchecked In Lighting, Fog is unchecked


Unity Diablo style Multiplayer Good time of the day to everyone who is reading this topic. I've been enjoying playing Diablo 3 and decided to try myself in game development (to lure my friends into Diablo 3 and to, ofcourse, practice in game development). I'd like to split the question in to following sections Lobby System (using Unet) Game Server Scene Loading So, lets start with the first part As far as i know, when user decided to play the multiplayer part of the game, he is either creating new game for others to join, or joining an existing game. This process can be observed on the "Joining Creating Game" screen. What i'm actually can't figure out, is that if the game created on the users machine (lets name it local) or the Blizzard server (this will be remote). If it is created on the local machine, how then it is protects itself from cheating. If it is created on the remote machine, does that mean that for every 5 (just any number) players, i will have to start new copy of the game server (probably on the different port) Moving to the second question This requires to run a "headless" version of the game on the server. Is there a possibility to create many different rooms for many players by using only one server instance, or will it require to run separate instance for every 5 players. Also, if player is playing in single player mode, he seems to be also connected to the game server. Looks like the game server is performing all of the necessary calculations and player only sends in the commands for server to process (e.g, move me from 1,0 to 1,1) and after receiving the response, client interpolates the movement received from the server. And finally, the third question Server may have many different scenes, but many players may be situated across many different scenes. There could also be dungeons and other player oriented stuff. So the question is, is it possible to achieve this goal using default Unity functionality.


Is Godot's NavMesh viable for dynamic pathfinding (e.g. avoiding moving enemies)? I am a novice (read low budget) designer looking at moving from Pygame to a real engine, and between Unity and Godot it looks like the latter has a much better 2D engine 1, 2, 3 . I would be happy to support Godot's open source model except that, as far as I can tell, its built in navigation mesh is purely static i.e. it can't update its path to account for dynamic obstacles 4, 5 while Unity's pathfinding system can 6 . So my question is Am I "stuck" with Unity? Or is there functionality that I haven't yet been able to find? Or, alternatively, is GDScript significantly faster than Python such that basic algorithms like fixed grid A would do the job? Edit By "stuck" with Unity I don't mean that it's a bad option or that there aren't good options I mean, 'if I need good pathfinding, do I have to give up on Godot and use what would otherwise be a second choice engine?'


How to tell when animation is finished playing without events in Unity I'm using the newest version of Unity. I have a turn based RPG type of game so everything is very sequential. The actor jumps in front of another actor, plays his melee attack animation, then jumps back. Currently I use events on the animation to tell when the attack animation is complete. The 2 side effects of doing it this way are I have to go into each animation and make an event at the end of them. It would be ideal to NOT have to do this. It would seem I should be able to just check in code if a certain animation is finished playing. The control flow of my attack code becomes awkward. My attack method is a coroutine so I can read it very sequentially and it makes sense. Having this event to tell when the animation is complete ruins that flow. I have to basically make a bool variable and inside my finished event set it, and in my attack function do a while loop after I play the animation checking for that bool variable to change and yielding out until it does. Requiring this event ruins the logical flow of attacks. If I have many animations for whatever reason things get messier. I noticed the Animator component doesn't have an isPlaying() like some other answers suggested. I think those answers were for older version of unity and older just playing animation clips not using the new Animator component. There must be a better way to do this.


How to change player objects when switching scenes? I have a scene for lobby. When player connects to server he gets a lobbyCharacter, which is an empty gameobject with a script on it that create UI element with the players name. In lobby players can select character they want to use. Now when starting game, i would like to switch scene to the game scene when all players are ready. I have been reading the API, documentation, and different stack questions, but i cant seem to find any info on how this should work. On NetworkManager i can do scene schange which will be changed on all clients. But how do i persist data over multiple scenes? And if the lobby characters are destroyied how are the game characters instansiated according to the choises made in lobby? How does the client connection persist between multiple scenes? Do i just manage the character locally and use syncHooks to synchronize over the server? Do i need to create somesort of container gameobject that holds the player connection information and some extra stuff? EDIT Reading the soruce code of mirror i fouind that NetworkManager holds the connection of the client, sort of. So now the issue has come down to replacing the prefab for the connection. I have the following code public void switchScene() GameObject obj NetworkClient.connection.identity.gameObject NetworkServer.ReplacePlayerForConnection(NetworkClient.connection, Instantiate(shipPrefab)) NetworkServer.Destroy(obj) ServerChangeScene(gameScene) This should switch the prefab for connection and then switch scene, but i keep getting error InvalidCastException Specified cast is not valid. Mirror.NetworkIdentity.SetClientOwner (Mirror.NetworkConnection conn) (at Assets Mirror Runtime NetworkIdentity.cs 362) Mirror.NetworkServer.InternalReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets Mirror Runtime NetworkServer.cs 837) Mirror.NetworkServer.ReplacePlayerForConnection (Mirror.NetworkConnection conn, UnityEngine.GameObject player, System.Boolean keepAuthority) (at Assets Mirror Runtime NetworkServer.cs 697) LobbyManager.switchScene () (at Assets LobbyManager.cs 51) And i dont understand why this is happening. New prefab has networkIdentity and networkTransform. Old prefab only has network transform. Up until this point everything wors, but once i want to switch scenes, it breaks.


Is it possible to make a randomly rotating terrain texture painting brush in Unity? I wanted to make a terrain in unity with a dirt texture painted onto the original grass texture to make a path, but when I tried, the dirt (and grass) looked repetitive and full of patterns. My question is, is there any way I can make a texture's tiles randomly rotate when being applied or painted onto an object?


TextAsset thinks file is 6856 bytes when it is 120123 bytes So I've created a text asset in Unity of a binary file which i'm attempting to read in as a byte array. The result I'm getting is a byte array tht is almost half the size it's supposed to be. The file is a serialized mesh file from here http wiki.unity3d.com index.php?title MeshSerializer2 What I do then is find the file unity created, move it to the assets folder and drag it into a component as a TextAsset. For smaller files it works but larger ones appear to fail to load completely. If I load the same file separately from a C console application using filestream it loads correctly.


How to find a valid point if NavMeshObstacle is blocking path? Is there any way to find the closest valid point to my target if a NavMeshObstacle is blocking my agent's path? This point can be any point along the red line in the image above.


How to circle an uneven object with Camera at a fixed distance? Unity3d. I am trying to move an object with Camera around a fixed terrain (Mountain), while staying an set distance from its edge. I have the camera set to lookAt the mountain, and I want to circle the mountain. I was thinking about sine wave for circular motion but its not an exact circle as I need to move in or out to maintain the fixed distance from the mountains edges. It looks like I might need transform.RotateAround(..), but what about the adjusting to maintain a fixed distance from the edge of the uneven surface while maintaining the circular motion. transform.RotateAround (Vector3.zero, Vector3.up, 20 Time.deltaTime) Update Here is my current script for circling around mountain as first person object function Update () var mountain GameObject mountain GameObject.Find("QuantumCold B") transform.RotateAround(mountain.transform.position, Vector3.up,20 Time.deltaTime) Unfortunately there are two problems 1) The first person object appears to be falling or maybe its the main camera, but in any even there is a game screen looks like its falling below the mountain. 2) it is the mountain that seems to be rotating. Do I need to switch the main camera to be the first person camera. Why does the mountain appear to be rotating?


Switching between world and battle scene with no or minimum loading? I am making a strategy game where the player roams a grid map. When the player encounter enemy on the map he is transferred to a quot battle quot scene where two armies are fighting in turn based battle. Imagine Heroes 3 like game. My question is Should I load the battle scene in additive mode and temporary hide the quot world map quot and when the battle is finished to just show the quot world map quot and hide the quot battle quot scene? Or i should unload the world scene and load the battle scene, and when the battle is over gt unload the battle scene and load the world scene ? I think the 1st approach will give me less loading time between the two scenes, but will require more RAM ? Second approach is standard one, but i will have loading between the scenes ? My idea is to have no or minimal loading between battle and world scenes. What do you guys thing ? Did you know what is the best practice in this case ? By the way, i am using Unity as a engine.


How to create reel slider with mobile controls How can I create a reel slider with mobile game controls so that it looks something like this? The slider is normally non visible, and can be accessed if I slide my finger from the right side of the screen to the left. The slider allows me to switch my current weapon and use items in my inventory. This is my current setup in Unity. I can figure out the inventory portion of the slider, as there are many tutorials out there on an inventory system, and how to make the slider move based on touch, using something similar to a mobile joystick script, but I can't figure out how to make the slider so that it Can quot jump quot from icon to icon (not have the slider be completely fluid prevent it from stopping in between item icons) Detect what item slot the slider is currently on (in the case of the example, the item that will be used is the icon in the center of the screen. Make the icons more transparent the further away it is from the icon in use (I'm guessing that I would have to set the alpha channel value in the color settings of the item to a lower value, but I'm not sure how to detect the icon in use and count how many icons away the other icons are from the one in use.


Unity 2019 depth only camera now overwrites everything We have a pretty traditional camera stacking set up UI camera on top of a everything else camera. The UI camera is set to only clear depth, and only draws the UI layer. The everything else camera is set to clear via skybox and all layers but UI. Only the everything else camera contains a post processing layer component disabling it does seem to make everything work the way it used to. The UI camera has a higher depth than the everything else camera, in case someone suggests otherwise. In 2018 this exact arrangement worked as intended. In 2019, the UI camera's view is the only thing visible. I've found several forum posts on Unity by Unity Technologies about the light weight pipeline breaking this functionality, but we're not using any of the new pipelines. We simply upgraded, and I can't find any indication that we are using the new pipelines. Supposedly everything works normally as long as you don't use the new pipelines, but this is proving false so far. Since this camera arrangement is very common, I can't imagine I am alone!


Why does simply trying to add sound break literally everything So I have a script for an object that when shot explodes and it worked literally perfectly until I tried to add sound at which point it not only didn't play the sound but also stopped exploding, which was pretty rude of it. Here's my code since I have no idea what's wrong (Unity C ) using System using System.Collections using System.Collections.Generic using UnityEngine public class ShootyTarget MonoBehaviour public float health public GameObject destructionPrefab public GameObject explosion public GameObject shockwave public GameObject debris public AudioSource splodeSound void Start() splodeSound gameObject.GetComponent lt AudioSource gt () void FuckingDie() splodeSound.Play() Instantiate(explosion, transform.position, transform.rotation) Destroy(gameObject) Instantiate(shockwave, transform.position, Quaternion.Euler(new Vector3(90, 0, 0))) Instantiate(destructionPrefab, transform.position, transform.rotation) Instantiate(debris, transform.position, transform.rotation) public void takedamage(float amount) health amount if (health lt 0f) FuckingDie()


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.


How to programmatically change sprite sheet sub sprite name I am trying to change the name of the sub sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can't be done at this point in time. Let's say I have a sprite sheet that has already been split up into individual sprites inside of Unity. I am attempting to change the sub sprite names programmatically. I tried using AssetDatabase.RenameAsset (...) on the sprite sheet asset, which only changes the sprite sheet name and not sub sprites. I then thought to obtain a sub sprite and attempt to change its name using the below code. if (AssetDatabase.IsSubAsset (subSprite)) AssetDatabase.RenameAsset (AssetDatabase.GetAssetPath (subSprite), "newSprite" i.ToString ()) However, this too only changes the sprite sheet name. I'm not sure where else I can take this to achieve my desired outcome, apart from programmatically copying the original sprite sheet and using that to create a copy. But even then, I still am unable to alter the sub sprite names. I also tried changing subSprite.name, but this just changes the internal name and not the asset name. Any ideas?


Unity How to change editor play stop button positions for dual monitor layout Is it possible to change the play stop buttons positions in editor? I am trying to make a layout for Dual Screen, however the buttons are right in the middle of the two screen. So, it makes it hard to click the buttons.


How to debug fatal signal 11 code 2 in UnityMain? i have searched for the fatal signal caused by Render or GxDriver, FlashMuller in unity forum says it's google play the error 08 03 14 59 47.503 32020 32092 ? A libc Fatal signal 11 (SIGSEGV), code 2, fault addr 0xcbe8dffc in tid 32092 (UnityMain), pid 32020 (com.tuo3.alive) 08 03 14 59 47.533 32121 32121 ? A DEBUG Build fingerprint 'OnePlus OnePlus5T OnePlus5T 8.1.0 OPM1.171019.011 1807181208 user release keys' Revision '0' ABI 'arm' pid 32020, tid 32092, name UnityMain gt gt gt com.tuo3.alive lt lt lt 08 03 14 59 47.544 32121 32121 ? A DEBUG backtrace 00 pc 000575d0 system lib libc.so (je arena tcache fill small 71) 01 pc 00077919 system lib libc.so (je tcache alloc small hard 16) 02 pc 00058fc7 system lib libc.so (je arena palloc 1650) 03 pc 00069bd1 system lib libc.so (imemalign 1164) 04 pc 0006d373 system lib libc.so (je memalign 26) 05 pc 001d6f18 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (UnityDefaultAllocator lt LowLevelAllocator gt Allocate(unsigned int, int) 24) 06 pc 001da888 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (MemoryManager Allocate(unsigned int, unsigned int, MemLabelId const amp , AllocateOptions, char const , int) 852) 07 pc 001da254 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (malloc internal(unsigned int, unsigned int, MemLabelId const amp , AllocateOptions, char const , int) 128) 08 pc 00193bc8 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (core StringStorageDefault lt char gt assign(char const , unsigned int) 180) 09 pc 00a350bc data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so ( gnu cxx hashtable lt std pair lt core basic string lt char, core StringStorageDefault lt char gt gt const, ZipCentralDirectory PathDescriptor gt , core basic string lt char, core StringStorageDefault lt char gt gt , gnu cxx hash lt core basic string lt char, core StringStorageDefault lt char gt gt gt , std Select1st lt gnu cxx hash gt , std equal to lt core basic string lt char, core StringStorageDefault lt char gt gt gt , std allocator, lt ZipCentralDirectory 10 pc 00a34adc data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so ( ZZN19ZipCentralDirectory20readCentralDirectoryEvEN3 08 invokeERK15FileSystemEntryR12FileAccessorPKcRKN3zip4CDFDEPv 508) 11 pc 00a38160 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (zip CentralDirectory Enumerate(bool ( )(FileSystemEntry const amp , FileAccessor amp , char const , zip CDFD const amp , void ), void ) 804) 12 pc 00a348d0 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (ZipCentralDirectory readCentralDirectory() 20) 13 pc 00a26630 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (apkAddCentralDirectory 84) 14 pc 00a19074 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (Mount(char const ) 84) 15 pc 00a090dc data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (UnityInitApplication() 216) 16 pc 00a0a660 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (UnityPlayerLoop() 264) 17 pc 00a0cc68 data app com.tuo3.alive VZWALBY70nH dSDIQa rKA lib arm libunity.so (nativeRender( JNIEnv , jobject ) 228) 18 pc 000114cb data app com.tuo3.alive VZWALBY70nH dSDIQa rKA oat arm base.odex (offset 0x10000) More discussion 2


Unity rigidbody glitch throu corners No matter how thick the wall is, the player will glitch through. I've tried changing the settings on the rigidbody but nothing have worked. The walls fits together almost perfectly. Why is this happening? I already searched a lot and also found a lot of questions regarding the same problem at "Unity Answers" not a single one of them gets answered. I dont know why, it seems theyr community is almost dead.


Unity camera moving up and down for no reason I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script using System.Collections using System.Collections.Generic using UnityEngine public class CameraController MonoBehaviour public GameObject target public Vector3 translationOffset public Vector3 rotationOffset Use this for initialization void Start () Update is called once per frame void Update () transform.position target.transform.position translationOffset transform.LookAt(target.transform) transform.Rotate( rotationOffset) the result I have is this Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot.


In the Unity Editor, how to push a parent's transform down to its children? I've inherited a Unity scene with quite a deep object hierarchy. Some GameObjects in the hierarchy don't have any geometry of their own, and just exist to group their children and apply a MonoBehaviour to all of their children. Because of the way the scene was authored, some of these objects have arbitrary transforms, which makes it hard to edit the child transforms, to align the children with other objects outside the group. As a one off operation in the editor, I'd like to reset these objects' transforms, without changing the world space positions and orientations of the children. Put another way, I'd like to push the effect of the transform down to the children. What's the easiest way to achieve this in the editor? I've seen a lot of questions from people who want to achieve this in code, to have the effect of detaching the parent and child transforms while keeping the relationship, but that's not what I want. I'm just looking for a one off, manual operation to make my scene file easier to edit.


Unity 5 Animator controls What are their Unity 4 correspondent? I am following a tutorial that is made with Unity 5, but claims to be compatible with Unity 4.6 I am working with the Animator panel, and I was wondering where could I find certain controls on the Unity 4 version. I highlighted them in a red square. Basically stuff that has to do with duration of transitions and checking the transition as not having an exit time.


Rendering Mode transparent is not applying in webgl build I am using this method to convert opaque rendering mode to transparent. item.color new Color(1, 1, 1, value) item.SetFloat( quot Mode quot ,3) item.SetOverrideTag( quot RenderType quot , quot Transparent quot ) item.SetInt( quot SrcBlend quot , (int)UnityEngine.Rendering.BlendMode.One) item.SetInt( quot DstBlend quot , (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha) item.SetInt( quot ZWrite quot , 0) item.DisableKeyword( quot ALPHATEST ON quot ) item.DisableKeyword( quot ALPHABLEND ON quot ) item.EnableKeyword( quot ALPHAPREMULTIPLY ON quot ) item.renderQueue (int)UnityEngine.Rendering.RenderQueue.Transparent This is working fine but not working in my webgl build.


How do you create a grid using a wire frame shader? So I'm having trouble going about creating an 80s neon color grid wire frame, like the examples. How would you go about making the floor into an 80s styled grid floor? I'm just looking for square grids. Here is what I'm currently using Shader "Custom Grid" Properties GridThickness ("Grid Thickness", Float) 0.01 GridSpacingX ("Grid Spacing X", Float) 1.0 GridSpacingY ("Grid Spacing Y", Float) 1.0 GridOffsetX ("Grid Offset X", Float) 0 GridOffsetY ("Grid Offset Y", Float) 0 GridColour ("Grid Colour", Color) (0.5, 1.0, 1.0, 1.0) BaseColour ("Base Colour", Color) (0.0, 0.0, 0.0, 0.0) SubShader Tags "Queue" "Transparent" Pass ZWrite Off Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM Define the vertex and fragment shader functions pragma vertex vert pragma fragment frag Access Shaderlab properties uniform float GridThickness uniform float GridSpacingX uniform float GridSpacingY uniform float GridOffsetX uniform float GridOffsetY uniform float4 GridColour uniform float4 BaseColour Input into the vertex shader struct vertexInput float4 vertex POSITION Output from vertex shader into fragment shader struct vertexOutput float4 pos SV POSITION float4 worldPos TEXCOORD0 VERTEX SHADER vertexOutput vert(vertexInput input) vertexOutput output output.pos mul(UNITY MATRIX MVP, input.vertex) Calculate the world position coordinates to pass to the fragment shader output.worldPos mul(unity ObjectToWorld, input.vertex) return output FRAGMENT SHADER float4 frag(vertexOutput input) COLOR if ( frac((input.worldPos.x GridOffsetX) GridSpacingX) lt ( GridThickness GridSpacingX) frac((input.worldPos.z GridOffsetY) GridSpacingY) lt ( GridThickness GridSpacingY)) return GridColour else return BaseColour ENDCG


Blending between many materials I am storing one material ID per vertex in my meshes. In the shader for the mesh, I have a texture array full of textures that the material ID can refer to. The fragment color is chosen using triplanar texturing. Unlike vertex colors, these material IDs cannot be blended. For example, if a dirt texture had a material ID of 5, and a grass texture had a material ID of 1, fragments in between one vertex with material ID 5 and one with material ID 1 would potentially have a material ID between 2 and 4, which is not ideal. Another flaw with this method is the fact that there would be a hard transition in between materials, as the mix or lerp function in the shader is not used. Is there a way to blend the textures of two neighboring vertices in the fragment shader? I can add additional per vertex data if needed.


Animator from another gameobject keeps disappearing from script on play I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to the script keeps disappearing. using System.Collections using System.Collections.Generic using UnityEngine public class RifleShooting MonoBehaviour private float NextTimeToFire 0f private int CurrentAmmo private bool IsReloading false Space(10) Header("Floats") public float Damage 10.0f public float Range 100.0f public float ImpactForce 60f public float FireRate 15f public float ReloadTime 1.0f Space(10) Header("Others") Space(5) Space(10) Header("Others") Space(5) public int MaxAmmo 10 public Camera FPSCamera public Animator GunAnimations public ParticleSystem MuzzleFlash public GameObject impactEffect public bool AllowedToShoot true Start is called before the first frame update void Start() GunAnimations GetComponent lt Animator gt () if (CurrentAmmo 1) CurrentAmmo MaxAmmo private void OnEnable() IsReloading false GunAnimations.SetBool("Reloading", false) Update is called once per frame void Update() if (IsReloading) return if (CurrentAmmo lt 0) StartCoroutine(Reload()) return if (AllowedToShoot false) return if (Input.GetButton("Fire1") Input.GetButtonDown("Fire1") amp amp Time.time gt NextTimeToFire) NextTimeToFire Time.time 1f FireRate Shoot() IEnumerator Reload() IsReloading true Debug.Log("Reloading...") GunAnimations.SetBool("Reloading", true) GunAnimations.SetBool("IsShooting", false) yield return new WaitForSeconds(ReloadTime .25f) GunAnimations.SetBool("Reloading", false) yield return new WaitForSeconds(.25f) GunAnimations.SetBool("IsShooting", true) CurrentAmmo MaxAmmo IsReloading false void Shoot() shooting script here Also if it helps here is what I see in the console when I try to fire MissingComponentException There is no 'Animator' attached to the "M4A1" game object, but a script is trying to access it.


Take a screenshot from camera problem I use script below to take a screenshot from camera. It's working fine. However, when I take a screenshot again (pressing k multiple times), its old image is not clear from the memory and it keep drawing over same image over and over again. If object is moving while taking screenshot multiple times, image I will get all frame combine into one image with every frame in the same image. What should I do to fix this problem? using UnityEngine using System.Collections public class HiResScreenShots MonoBehaviour public int resWidth 2550 public int resHeight 3300 private bool takeHiResShot true public static string ScreenShotName(int width, int height) return string.Format(" 0 screenshots screen 1 x 2 3 .png", Application.dataPath, width, height, System.DateTime.Now.ToString("yyyy MM dd HH mm ss")) public void TakeHiResShot() takeHiResShot true void LateUpdate() takeHiResShot Input.GetKeyDown("k") if (takeHiResShot) RenderTexture rt new RenderTexture(resWidth, resHeight, 24) camera.targetTexture rt Texture2D screenShot new Texture2D(resWidth, resHeight, TextureFormat.ARGB32, false) camera.Render() RenderTexture.active rt screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0) camera.targetTexture null RenderTexture.active null JC added to avoid errors Destroy(rt) byte bytes screenShot.EncodeToPNG() string filename ScreenShotName(resWidth, resHeight) System.IO.File.WriteAllBytes(filename, bytes) Debug.Log(string.Format("Took screenshot to 0 ", filename)) takeHiResShot false Debug.Log("Capture!!")


TextField Add in Editor does not display when put under if statement I've been trying to make a custom editor window in Unity and I needed to make an quot add TextField quot button. When I add a TextField directly (without requiring a button), it works. When I put it under if(GUI.Button()) it does not show up. Here's my code private static List lt string gt s new List lt string gt () private void OnGUI() if (GUI.Button( quot quot ) ) s.Add(GUI.TextField(new Rect(0,50,Screen.width,20), quot field quot ))


Unity Depth texture is too pixelated I am trying to combine two cameras together Background camera, Foreground camera. I created 3 cameras in my project, 2 for the background and foreground and one for the foreground depth. I then created a simple shader that combine the first two cameras (they render to render texture as well as the foreground depth), the problem I am having is that because the depth buffer is too pixelated the result looks funny and you clearly see the lines around the foreground (players in my case). I created a depth camera with these properties Notice the Output Texture, I have set the Render texture to This is the result depth texture (zoomed so you can see the pixels) Any idea how I can create that effect maybe using something different then the depth buffer? or can I improve the depth quality? what can I do to reach a good final result?


Rain Effect generation in a Unity VR project I m developing a VR project in Unity Engine and I need to implement a Rain Effect. I have considered the following A VR game must run at least 90 frames per second. The Rain must be detailed. The Rain Drops interact with other objects. These are the approaches I have considered Particles Systems I think it is expensive since there are two cameras rendering the scene and checking collision per particle could be expensive. Image Effect on the canvas I think the result would be unreal, and there would not be interaction with other objects. I have seen examples of rain effect like in Resident Evil 4, Halo Reach, Crysis, FarCry, Project Cars 2 VR and Batman Arkham Knight. A last approach I haven t considered yet is by shading, maybe shading would work for the rain drops in the cameras lens. I would like to know optimal approaches to emulate rain effects without making too much computations. Thanks for your attention.


Unlit Node Shadow Shader Graph How to make unlit node cast shadows? Is is possible with the current state of Shader Graph in LWRP? In this great article Toon Shader OP grabs pass from VertexLit shader. Is something similar achievable with Shader Graph?


Unity Failed to create decoder for ScreenSelector.png My game works fine in the editor, but when I build and run the build the view is zoomed in, my tilemap is missing, and the camera follows a gameobject it should not. How it should look and how it looks I checked the logs and this is the error I am served Failed to create decoder for 'C Users Hamuel The First Documents Jetplatformer Builds Builds Data ScreenSelector.png' 0x80070002 Further Investigation shows that ScreenSelector.png is absent from the path stated in the error. I cannot find anything that says what ScreenSelector.png is, or does. I am using the post processing stack by unity. Any help would be much appreciated!


Animation after enemy spawns right now in my game, four enemies spawn in four spawn points with a delay, but what I want to do is that if you don't kill the enemy after a couple seconds, an animation (it's an animation of a scratch, basically to let the player know it has been attacked) appears. Right now I have a script that display an image (it's an image because I was testing the scripts), but now I want to change the image for the animation but after trying and failing a lot of times I decided to ask here, and hopefully someone can help me. This is the script of the "attack", and it's attached to the enemy prefab public Image TargetImage void Start () TargetImage.enabled false public void spawnAttack() StartCoroutine (playerIsAttacked (5, TargetImage)) public IEnumerator playerIsAttacked (float t, Image im) yield return new WaitForSeconds (t) TargetImage.enabled true and this is in the timed spawn script public class TimedSpawn MonoBehaviour public GameObject spawnee public bool stopSpawning public float spawnTime public float spawnDelay void Start () InvokeRepeating ("SpawnObject", spawnTime, spawnDelay) public void SpawnObject () GameObject newSpawn Instantiate (spawnee, transform.position, transform.rotation) as GameObject newSpawn.GetComponent lt enemyAttack gt ().spawnAttack () if (stopSpawning) CancelInvoke ("SpawnObject")


How to update Unity? I have clicked on check for updates but it says I have latest Unity. But latest is 5.6. How to update it to 5.6?


Character falls through the Platform Effector 2D in Unity. How can I fix it? Character falls through the Platform Effector 2D in Unity. How can I fix it? Here is the demonstration https imgur.com G5YkTxa. I tried changing the Edit Project Settings... Physics 2D Default Contact Offset from the current 0.01 value to the 0.1 value. The result is the same and here is the demonstration of it https imgur.com 3TAOsNY. Here are my settings for the platform Here are my settings for the character's RigidBody 2D Here is what character colliders look like when my character runs https imgur.com CTialU3. I basically run the recorded inside Unity animation of running and move my character with the help of the private void FixedUpdate() ... some code which computes the velocity vector depending on the input (the pressed buttons) characterRigidBody2D.velocity velocityVector I googled for a while now similar issues, but was not able to find a solution. I want to avoid the character falling down randomly during running.


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?


How to copy the value of a variable from one script to another in Unity? I would need some help with making two floats from two different classes, match their "data". What I want to do here is to make it so when Body.healthb hits a value of 0, Head.health will also hit 0. Any suggestions? I'm barely new to this. The class from which the float comes from public class Body MonoBehaviour public GameObject body public float healthb 50f public void TakeDamageb(float amountb) healthb amountb if (healthb lt 0f) Dieb () Update is called once per frame public void Dieb() Destroy (gameObject) The class it has to reach public class Head MonoBehaviour public static float health 10f public void TakeDamage(float amount) health amount if (health lt 0f) Die () Update is called once per frame public void Die() Destroy (gameObject)


Torque applies to one wheel, but inconsistently to the other wheel I have a GameScript class which is derived by another class WheelScript it is meant to apply torque to a rigidbody in different directions depending upon the key pressed. However the result to this is that one of the rigidbodies rotates fine but the other one doesn't (say the right wheel rotates but the left doesn't turn or even if it does, it doesn't move with the same angular velocity as the first one) Base class public class GameScript MonoBehaviour public static GameScript instance protected float Force protected virtual void Print(GameObject gameObject) print(gameObject.name) protected virtual void MoveForward(Rigidbody rigidBody, int identifier) if(identifier 1) rigidBody.AddRelativeTorque( Vector3.forward Force) else rigidBody.AddRelativeForce( Vector3.forward Force) protected virtual void MoveLeft(Rigidbody rigidBody, int identifier) if (identifier 1) rigidBody.AddRelativeTorque( Vector3.forward Force) else rigidBody.AddRelativeForce( Vector3.forward Force) protected virtual void MoveRight(Rigidbody rigidBody, int identifier) if (identifier 1) rigidBody.AddRelativeTorque(Vector3.forward Force) else rigidBody.AddRelativeForce( Vector3.forward Force) protected virtual void MoveBack(Rigidbody rigidBody, int identifier) if (identifier 1) rigidBody.AddRelativeTorque( Vector3.forward Force) else rigidBody.AddRelativeForce( Vector3.forward Force) Child class public class WheelScript GameScript SerializeField private int identifier Rigidbody body SerializeField float force private void Start() body GetComponent lt Rigidbody gt () Force force void Update() if (Input.GetKey(KeyCode.W)) MoveForward(body, identifier) else if (Input.GetKey(KeyCode.A)) MoveLeft(body, identifier) else if (Input.GetKey(KeyCode.D)) MoveRight(body, identifier) else if (Input.GetKey(KeyCode.S)) MoveBack(body, identifier) and similarly for the other wheel with only difference being that of axis as its axis is (0,0, 1) Hinge Joint for left wheel is visible in this picture Hinge Joint for right wheel is visible here in this picture This is how each wheel is aligned Hinges are attached to the pivot in the opposite direction as marked in the circle Also I think I forgot to mention but the WheelScript is attached to both the wheels (it is the script component for both wheels)


Unity Calculating a rotation based on game time I have a simple script to make an object spin Spin Speed is the speed to rotate the object on each axis (preferably in degrees per second). Local is whether the rotation should be done based on world axes or object axes. Starting Rotation is the initial rotation of the object. Normally I would use Transform.Rotate to do the rotation, but in this case I have to make the rotation a function of time, so you can pass in any time value and it will return what the rotation should be at that time. Here is an example (this doesn't work properly for either world or object axis rotation) private Quaternion getRotation(float time) return Quaternion.Euler(InitialRotation SpinSpeed time) I just need some help figuring out the math behind calculating rotations for both world and object axes. I think that matrices can be used but I honestly don't remember anything about how to use them. Here's an example of using world axes with a SpinSpeed of 180 on the y axis and an initial rotation of 45 on the x axis https i.gyazo.com d7f41b6a88425b5d8b8237cd7ac40878.gif An example of using local axes with the same parameters as above https i.gyazo.com d453b3dd239c9f77b86ce372c499d068.gif


Unity3d Pause RigidBody object, don't stop time Time.timeScale 0 obviously works to stop physics but it's also stoping my Invoke calls. How can I get around this to pause ONLY the game physics? EDIT Temporarily I'm using isKinematic true on all of my rigid body objects via event trigger.


Bug with OnColliderEnter Exit when colliding with multiple objects at almost the same time Unity Version 2017.4.1f1 I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, then you can jump. This works, however if you are in a position where you are falling and then in quick succession, hit one plane, fall off that plane (like when your centre of mass is hanging off the edge), then land on another plane, at the end of it all, it still thinks you are on the air. Note I don't think this is an error with the velocity of the player, at no point do you go through a collider. So my question is, is there an error in my code (shown below) which I can fix, or should I take another approach towards jumping, thanks. Relevant code below. private bool canJump private Rigidbody rb public float jumpStrength private void OnCollisionEnter(Collision collision) if (collision.collider.CompareTag("Jumpable")) canJump true private void OnCollisionExit(Collision collision) if (collision.collider.CompareTag("Jumpable")) canJump false private void Update() if (canJump amp amp Input.GetKey(Keyode.W)) rb.velocity new Vector3(0, jumpStrength, 0) canJump false Safety measure to ensure consistent jump height Thanks


Lighting changes when loading scene I have a script that changes the levels using Application.LoadLevel (sceneNameToChangeTo) Once a level is loaded using that code when testing with the editor, the lighting changes dramatically. I've checked if something changes in the light or lighting settings, but it doesn't. This is a screen of how the scene looks when I simply press RUN in the scene in the editor Notice the blue tints from the sky etc. This is clearly PBS lighting. Now after I use my code to change the scene to another one and then back to this one, the scene looks like this What am I doing wrong? I am using Unity 5.0.1. This effect does not happen on mobile devices.


My GUI stopped working? Okay I bought this asset online so I would like not to show the whole script. The problem is this asset stopped working when I updated from unity 5.0 to 5.1.2. The script is for a controller GUI interface but it seems to be giving me an error NullReferenceException Object reference not set to an instance of an object UnityEngine.UI.Selectable.Select () on this line of code selectedOject.GetComponent lt Button gt ().Select () so there is a null reference and its no longer recognizing the child objects as buttons is what I'm assuming if you want to have a better look at his set up he has a short video On youtube HERE I would like to continue to use this script and continue updating Unity.


Is it bad practice to store inventory and scores in PlayerPrefs? I'm building a mobile game for a client in Unity. To save time, we started with a template game from the Asset Store that had some of the features that the client wants. The game includes a progression system and shop, so we save the user's scores, progress, in game currency, inventory, etc. We currently have no plans to export the save data. The template game uses PlayerPrefs to store all save data. Is this bad practice? Assuming we don't include a button that calls PlayerPrefs.DeleteAll(), is there any extra risk associated with using PlayerPrefs instead of external files to store the player's data?


see inside but not light from outside I have a top down view of the interior of a house. I want to put a cover on the top so light from outside can't come in and I get more realistic lighting inside but transparent so I can still see inside. No clue how to achieve this in Unity. Any help would be appreciated. Ideally I'd just be able to use Unity's built in cube to make this.


Adding a feedback survey to a game So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would it be possible to do this directly on Unity? I would like for them to be able to log their entries much like an online journal. I have attached pictures from the daylio app. I would like to do something similar. At this point, I really do not know how to begin doing this on Unity. Any advice, or tutorial suggestions would be appreciated. This far I have managed to do the following (in the picture below) This is how the survey looks (its pretty rudimentary at this point) And this is where the information is getting displayed (in the inspector) So now, what I would like to know, is how would I go about sending this data to somewhere else i.e. as it is in the daylio app?


How can I avoid a stack overflow when recursively checking adjacent game objects? I am building a simple game on Unity to learn the system. I am using C . The game is a basic "blocks" game, whereby when the player clicks on a block, the block and its neighbours of the same colour all disappear (get destroyed). My process is this To keep a track of which blocks are neighbours of the same colour, on each refresh each block checks their details on the event OnCollisionEnter and adds these collision neighbours to a List of valid neighbouring gameobjects. When a block is clicked, this list is checked and each neighbour has its own neighbours list checked, after list checking each block is distroyed. Somehow, this process is causing a StackOverflowException StackOverflowException UnityEngine.GameObject.GetComponent setupscript () (at C buildslave unity build artifacts generated common runtime GameObjectBindings.gen.cs 35) setupscript.checkNeighbours () (at Assets scripts setupscript.cs 86) setupscript.checkNeighbours () (at Assets scripts setupscript.cs 87) setupscript.checkNeighbours () (at Assets scripts setupscript.cs 87) setupscript.checkNeighbours () (at Assets scripts setupscript.cs 87) .... Here is my script, first my List establishment private List lt GameObject gt neighbours new List lt GameObject gt () Next, here is how the neighbours list is populated void OnCollisionEnter (Collision other) Rigidbody other rb other.rigidbody if(rb.velocity.magnitude lt 1f amp amp other rb.velocity.magnitude lt 1f amp amp other.gameObject.tag tagName amp amp !neighbours.Contains(other.gameObject)) Same tag so add to list of valid neighbours neighbours.Add(other.gameObject) Now, there are four conditions above to check when adding to the list Is the current block stationary. Is the "other" colliding block stationary (so they're at rest next to each other). do these blocks have the same tag (so they're the same type colour) does this block not already exist in this list. So once all four conditions are met, the block GameObject is added to the List. ( On conditions of OnCollisionExit blocks are removed from the List in a similar fashion. ) Now, my CheckNeighbours() script public void checkNeighbours() if (neighbours.Count gt 0) foreach (GameObject othercube in neighbours) setupscript otherCubeScript othercube.GetComponent lt setupscript gt () otherCubeScript.checkNeighbours() Destroy (gameObject) This should, as far as I understand it, run once through each List element and check that element for any neighbours who match. As I write this question out I think I'm realising that the issue is that we're in a loop as block 1 references neighbour block 2, which references neighbour block 3, which references neighbour block 1, etc. etc. But my StackOverflow exception occurs when there are only two blocks, so one refers to the other, refers to the first, etc. But as they should destroy after running the reference, this shouldn't (ideally) be an issue? Do I need to make the checkNeighbour() a Corountine to allow it to not hold up destroying the GameObject? If this repetition cycling is indeed what's going on, what would be the best way of getting each neighbour to be checked only once? Or checking that the GameObject referenced in the List still exists in the game itself? I have a quick edit here foreach (GameObject othercube in neighbours) if (othercube ! null) setupscript otherCubeScript othercube.GetComponent lt setupscript gt () otherCubeScript.checkNeighbours() But I'm not sure this will work as I feel this List will purely be a reference rather than the actual GameObject in the level?


Not able to upload to Oculus Store I am building for Quest and signing the package with V2. I am also creating store based Android Manifest file. Unfortunately the upload stops at 2nd step where I receive the error quot The APK was signed with the V1 signature system, previously marked with V2 and signed again with V1. Such APKs are considered corrupted and cannot be installed. quot Here is my Android Manifest file lt manifest xmlns android quot http schemas.android.com apk res android quot package quot com.VR.VRCube quot android versionCode quot 1 quot android versionName quot 1.0 quot android installLocation quot auto quot gt lt application gt lt meta data android name quot com.samsung.android.vr.application.mode quot android value quot vr only quot gt lt meta data android name quot com.oculus.supportedDevices quot android value quot quest quest2 quot gt lt activity android screenOrientation quot landscape quot android theme quot android style Theme.Black.NoTitleBar.Fullscreen quot android configChanges quot density keyboard keyboardHidden navigation orientation screenLayout screenSize uiMode quot android launchMode quot singleTask quot android resizeableActivity quot false quot gt lt activity gt lt application gt lt uses sdk android minSdkVersion quot 21 quot gt lt uses feature android glEsVersion quot 0x00030001 quot gt lt uses feature android name quot android.hardware.vr.headtracking quot android required quot true quot android version quot 1 quot gt lt manifest gt


How to enable Unity related syntax highlighting with VSCode? I'm using VSCode, not VisualStudio for Unity scripting. VSCode has syntax highlighting for C , which works fine, but all the Unity related stuff like Vector3 doesn't get any highlights. I know, that you can change somehow the files, but I can't even find the C folder in my extensions folder (There is everything else like cpp, css etc. just no c ). Would be great if someone could lead me to the folder location and how to add keywords for the highlighting. Here is a screenshot, where you can see that float is highlighted, but Transform not.


How to align edge vertices of modular props snapped on a 2D grid? For a project I am working on I create some 3D props in Blender that can be put together in a modular way on a 2D grid in Unity. In Unity I generate the grid contents using these props. Now given these two simple shapes (imagine a pipe or railing in top view) If they are put next to eachother on the grid like so (left) I want to make a smooth transition between the two so that their edge vertices align nicely (snap together, see right image above). Note that the angle between the shapes is always the same. However there are variations like straight, left, right for each intersection and also numerous shapes. How can I achieve this? I have thought of the following possibilities Just model each possible variation in blender and use the matching prop when generating the grid (I hope I can avoid this since its a lot of effort, also it's not reusable) Rig the shapes in Blender. In Unity move the bone transforms accordingly so that they align (I like this idea, but is it practical?) (Somehow) mark the vertices on the edge of the shapes and move them to where they belong i.e. modify the mesh in Unity. Are there other better ways to achieve this? I appreciate any hints and tips. I also know I am not the first one to try this so any guidance on where to look for resources and what terms to search for is also appreciated.


How do I successfully implement Google Mobile Ads and Google Play Services into my Unity arcade game? I have been trying for like a month now to properly implement Google Play Services and Google Mobile Ads into my Unity Android Game. I have had success in getting Google Play Services to work but when I added Google Mobile Ads at first it didn't work. I just didn't see any ads pop up. Now when I build my app it won't open it just crashes. Not exactly sure what I did. I have configured all the services correctly according to my knowledge and I'm am just using code from the documentation for the ads. Heres that code public static AdManager Instance set get public string bannerId public string videoId public string deviceId BannerView bannerView InterstitialAd interstitial private void Start () Instance this DontDestroyOnLoad(gameObject) interstitial new InterstitialAd(videoId) AdRequest request new AdRequest.Builder().AddTestDevice(deviceId).Build() Load the banner with the request. interstitial.LoadAd(request) public void ShowInterstitial() if (interstitial.IsLoaded()) interstitial.Show() I am using the correct ad Ids, I double checked that. I don't know what else to do. I can provide any other information you may need upon request. Anyone with experience with this would be super helpful! Thanks!


Enemy clones don't target player In a small game that I'm making enemies multiply when you kill them, however when clones are instantiated they don't chase the player like the original prefabs do (example http gfycat.com VastActualElver) Here is relevant part of my code pragma strict var moveSpeed int 3 var player Transform var MaxDist 10 var MinDist 1 function Update () if(curhealth lt 0) Dead() transform.LookAt(player) if(Vector3.Distance(transform.position, player.position) gt MinDist) transform.position transform.forward moveSpeed Time.deltaTime function Dead () Destroy(gameObject) var posx Random.Range( 10, 10) var posz Random.Range( 10, 10) Instantiate(enemys, Vector3(posx, 0.5, posz), transform.rotation) What am I missing?


Proper way to supply different textures and multiply matrices for thousand of terrain meshes What I have Terrain chunks of size 64x64 meters in a custom format PVR textures OpenGLES2 renderer GLSL shader None of the above can be changed in any way, i.e. I can't modify the existing code of shader or change the renderer. Terrain Each terrain chunk consists of 64 tiles of size 8x8 meters and are placed in a grid. Each tile has 3 layers of textures so theoretically there can be 192 different textures per chunk. The way I currently load terrain is via script. I create a mesh for every tile in a chunk, so that's 64 meshes per chunk. Shader The shader input consist of 3 textures and their texture mask 3 matrices minor stuff The matrices needed are calculated in every frame in the following way var M object.transform.localToWorldMatrix var V Camera.main.worldToCameraMatrix var P Camera.main.projectionMatrix material.SetMatrix("WorldViewProjectionMatrix", P V M) material.SetMatrix("WorldViewT", (V M).transpose) material.SetMatrix("World", M) What I need Loading the entire terrain would take a lot of time and resources, so I only load the nearest chunks depending on player position and its a 5x5 chunks area. And still on average I have 25 chunks 25 64 1600 tile meshes 25 64 1600 materials up to 25 192 4800 different textures (only theoretically! Currently there is no more than 20 30 per chunk and the average across loaded chunk is about 300 textures) about 6400 matrix operations The amount of materials does not seem to have a huge impact on performance, but the matrix calculates make the fps drop from 80FPS to 12. I could've reduced the matrix operations down to 100 if I could render single chunk as a single mesh instead of 64 submeshes, but I don't see a way to properly pass the textures to shader. So basically what I need is an approach that would allow me to render terrain chunk as a single mesh and a way to pass different textures for different tile parts of a mesh. Do I even look in the right direction?


Interpolating between positions unfeasible at 30 frames per second? I am working on a 3D platformer in Unity and I am targeting Android devices. The game consists of a lot of objects smoothly interpolating from the bottom of the screen to the top. This whole time I've been testing my game at 60 fps and the performance was quite good. However, when I tested the game at 30 fps, the interpolation of the objects was no longer smooth. I initially thought that I have way too many objects in my scene and this might be affecting the interpolating performance. So I created a new project which only has the interpolation stuff and object pooling (you can download it here). But even then, the interpolation wasn't smooth at 30 fps. Here's the code I'm using for interpolating the object void FixedUpdate() rb.MovePosition(transform.position transform.up Time.fixedDeltaTime speed) I'm using the object's Rigidbody to interpolate it. I've already set the rigidbody to "Interpolate" and I turned on "isKinematic". I first thought that the interpolation isn't smooth since I'm using Rigidbody. So I ditched the rigidbody and used transform.Translate instead. But even then the interpolation wasn't smooth. Next I tried Vector3.Lerp. Nope. That didn't work either. The stutter was still there. I even tried Vector3.MoveTowards. That didn't work. The interpolating was still laggy. I even tried turning on GPU instancing for the objects being interpolated (since they all use the same material). That didn't do it either. Next I started playing around with the fixed timestep (in the Time settings). I thought that maybe if I set the timestep to 0.033, then the objects will interpolate smoothly at 30 fps. But that didn't work either. I think it's really bizarre that a simple interpolation performs so poorly at 30 fps on an Android device. If the interpolation is only for a short distance, then you don't always notice the stutter. But like I said, in my game the objects have to interpolate from the bottom of the screen all the way to the top. In this case, you can clearly see the laggy movement during interpolation. Is it possible that long distance interpolation is simply unfeasible for Android devices at 30 fps? How do so many Android game developers manage to achieve good performance at 30 fps? Feel free to download the new project I mentioned which only has the interpolation stuff and the object pooling. It is available here. It's a very simple projects. It only has the prefab that should be interpolated, the material for the prefab, the script for interpolating the prefab, the spawning and object pooling system (for spawning the prefab), and the script for setting frame rate to 30. That's it. Below a gif of the objects' interpolation. It's not as shaky in reality (since I had to use a bad screen recorder and compress the gif) but it's still pretty close to how the objects move at 30 fps.


ScollRect Jumps while Filling I have a UI panel with a scollrect inside, which I fill dynamically. It can only be moved vertically. When filling this scollrect, the content jumps up and down for one frame, creating a weird look. When I check for the VerticalNormalizedPosition of the scrollrect after each added GameObject, it always tells me, the position is 1. When I check for the position in an Update method, it sometimes gives me a small rounding error. Instead of 1 it's somewhere between 0.9999995 and 0.9999998. The height of the content holder is less trhan 2000 units, whereas the jumps seems to be more than 2000 0.9999998. I tried to set the VerticalNormalizedPosition of the scrollrect to 1 every frame which didn't help. It also didn't help setting it after every newly added GameObject. Locking vertical scrolling also didn' help. Is this soley a rounding error and I can't do anything about it, or is there a way to stop this jump from happening? Here you can see the jump happening in 0.05 speed


Unity Button still interactable even when interactable is set to false my button can still be pressed in game even if I set it to button.interactable false What I'm trying to achieve is when the Panel CropsPanel is opened, or active in Unity, I want the EquipmentButton to be disabled and to be not usable by the user. Here is the code I've written public void Start () GetComponent lt Button gt ().interactable false if (CropsPanel.activeInHierarchy true) EquipmentButton.interactable false I have also set all buttons in the inspector, placed a Debug.Log("msg here") to see if the particular code is working. But I can't seem to get it working. Am I missing something? Thanks guys!


Which files of addressable assets should be committed to Git? I would like to keep my Git repository as small as possible and exclude any automatically generated files. The developers can re build their Unity Addressable Assets themselves. Any developer should be able to build the final project and the final result should contain the same assets packed in the same way. I noticed that Unity generates the following files and folders Which of these files are important settings that should be included and which files are safe to exclude from a Git repository?


Adding biome support to procedural landmass generation tutorials I've spent the past week studying the procedural landmass generation tutorial series and have been toying around with the source code. The following is an example of the core Noise module he wrote. Essentially, it accepts some noise settings (seed, octaves, lacunarity, etc) for every "chunk". I've been trying to figure out on my own how best to implement "biomes" but this is too different than noise systems I've used in the past (they handled octaves etc internally didn't build those with chunk coordinates, etc). I know I need different noise settings based on the biome, but I just can't figure out the best way to implement here. My biggest dilemma is that this logic calculates the octaves frequency etc for the entire chunk but those values would be different for different biomes. Since I need biomes to blend a bit (aka I don't want biomes limited to entire chunks), I need to either Use different noise settings for every "coordinate" (which won't work since this code uses one noise settings for the entire chunk) Calculate the entire chunk once for each biome in it and then somehow "sum" biomes Ditch this noise entirely with something I'm more familiar with (FastNoise, LibNoise.Unity). I've tried this, but absolutely will not work with the mesh generation he built, so I'd need to rewrite that too. public static CoordinateProfile , GenerateCoordinateProfiles(int mapWidth, int mapHeight, NoiseSettings settings, Vector2 sampleCentre) var profiles new CoordinateProfile mapWidth, mapHeight System.Random prng new System.Random(settings.seed) Vector2 octaveOffsets new Vector2 settings.octaves float maxPossibleHeight 0 float amplitude 1 float frequency 1 for (int i 0 i lt settings.octaves i ) float offsetX prng.Next( 100000, 100000) sampleCentre.x float offsetY prng.Next( 100000, 100000) sampleCentre.y octaveOffsets i new Vector2(offsetX, offsetY) maxPossibleHeight amplitude amplitude settings.persistance float maxLocalNoiseHeight float.MinValue float minLocalNoiseHeight float.MaxValue float halfWidth mapWidth 2f float halfHeight mapHeight 2f for (int y 0 y lt mapHeight y ) for (int x 0 x lt mapWidth x ) amplitude 1 frequency 1 float noiseHeight 0 for (int i 0 i lt settings.octaves i ) float sampleX (x halfWidth octaveOffsets i .x) settings.scale frequency float sampleY (y halfHeight octaveOffsets i .y) settings.scale frequency float perlinValue Mathf.PerlinNoise(sampleX, sampleY) 2 1 noiseHeight perlinValue amplitude amplitude settings.persistance frequency settings.lacunarity if (noiseHeight gt maxLocalNoiseHeight) maxLocalNoiseHeight noiseHeight if (noiseHeight lt minLocalNoiseHeight) minLocalNoiseHeight noiseHeight float normalizedHeight (noiseHeight 1) (maxPossibleHeight 0.9f) noiseHeight Mathf.Clamp(normalizedHeight, 0, int.MaxValue) profiles x, y new CoordinateProfile(noiseHeight) return profiles


How to create custom 3D "areas" at runtime I've been puzzled for a few days trying to solve this problem, so far with no results. On a map, currently a Terrain, I'd need to have some "areas" which can be controlled by a specific players. The shape of those areas can arbitrarily change during the course of the game, such as you add a marker in any point, and the area evolves (like a spline, say) to pass through that point too. The problem isn't drawing the boundary itself, of course, but having the GameObjects detecting the area they are in. Currently I have absolutely zero idea on how to make this exactly. I've thought about a nice approximation, which is splitting the terrain in fixed chunks, and having the player control them "chunk by chunk" every chunk can have its own collider, and that should be easy if not trivial. So the question is how to do it "properly", since I already have this workaround.


How to detect RayHit on part of model and not entire model I'm building a low poly role playing Hack and Slash game. When I click it renders a sprite amp character moves to that location(with RayCast). But in this case. I don't want the click to occur on side of the bridge. Clicks should only occur in green coloured part amp not in the red part. How should I fix this problem?


Two game object efficient and fast on off switch I have two game object, on GUI button click i am toggle between them but the problem is one game object which is small contains less vertx etc., is loading fast while the other which heavy taking time. How do i efficiently and quickly load it ? I don't want to show loading window i want to load that game object quickly?


Using Unity as a front end GUI for a non unity application? I'm working on a game right now that is 2D, and grid based, and for a variety of reasons have decided making it in Unity wouldn't be worth the hassle I'd have fighting the engine. That said, I want to possibly add in VR support at some point, and Unity seems the easiest way to make that happen. Right now, the game is structured so that part of the code takes in a grid from the game core, and that grid tells it what sprite(s) to stick in each spot on said grid. My thought was that it might be possible to replace the "take grid array, render sprite grid" portion of my game with a Unity front end. For example, perhaps this would be like a board game sitting on a table, and rather than a 2D grid, the "sprites" would be simple models on the grid board, with the user looking down at it in VR. Is this a thing that is possible? Essentially, all I would need is for my Unity program to take inputs, and send trigger signals to the game core, then receive an updated grid array and respond accordingly. I've not been able to find any information on this kind of thing, interfacing Unity with an external program in this way. The game is turn based, so 2 3 updates per second would be the absolute max I'd need, performance wise, and the game core could run on a potato. In specific can Unity send triggers to and receive a data array from an external binary (written in c ), and how would I do this? I really hope this is possible.


How can I reference the frontmost part of a mesh in my Unity code? (and help making FPS projectiles seem more real) I have started making a PC game using Unity. It's just a test project, where I'm making as basic as possible FPS shooter. I'm using the FPS Controller prefab, and I have also a rifle model attached to it. The result is pretty much what I wanted. Now I'm considering how I want to create projectiles for the gunfire. I think it will be best for me to create each bullet as just being a ray from the gun barrel heading forwards, OR I might create rigidbodies from the gun barrel I'm not sure yet. My question is What is the proper way to reference the point in space in which the gun barrel current ends? At the moment, I am thinking just attach ANOTHER gameObject to the gun model, and just manually position it where the barrel finishes. But this seems 'cheaty' and I think perhaps there is a better way (something like mesh.position.z mesh.length, but I can't seem to find anything like mesh.length). I haven't posted code at all, because I haven't really written any on this project yet. I would also be very interested to hear the pro tip version of how best to simulate this gunfire (ie. is it best to use rigidbodies? or somehow use raycast or something? or some better way that I haven't even dreamt of)


UnityEngine.PlayerPrefs corrupts string? I need to use PlayerPrefs to store arrays of bytes for my game. For some reason, the string I save with PlayerPrefs doesn't come out with the same length. I.e. byte TestArray new byte 256 for (byte i 0 i lt 256 i ) TestArray i i char charBuffer new char TestArray.Length for (int i 0 i lt TestArray.Length i ) charBuffer i (char)TestArray i PlayerPrefs.SetString ("Storage", new string(charBuffer)) PlayerPrefs.Save () Debug.Log (new String(charBuffer).Length) Debug.Log (PlayerPrefs.GetString ("Storage").Length) Log 256 5 Is this possibly an issue with encoding? How do I fix it?


Generate static 2D Tilemap from array How do I generate a 2D tile map from an array like in this tutorial for XNA ? I basicly want to generate a static map based on my tile prefabs.


How to make player stay on a moving object I've made an obstacle course with various moving parts to test out movement of a player. In the obstacle course there is a section where there are multiple cubes moves from side to side, and you have to jump from one to the other. But regardless of their speed, I can't seem to get the player to stay on top of any of the moving cubes. I have no clue how to fix this my only guess would be to use materials, but I can't apply any to the character controller. I appreciate any suggestion that you can give. Also the movement is done as an animation that I created in unity in the animation window. Thanks, Nova


How can I start a new row when instantiating UI elements in a grid? using System.Collections using System.Collections.Generic using System.IO using UnityEngine using UnityEngine.Networking using UnityEngine.UI public class SavedGamesSlots MonoBehaviour public GameObject saveSlotPrefab public float gap private Transform slots private string imagesToLoad Start is called before the first frame update void Start() int counter 0 imagesToLoad Directory.GetFiles(Application.dataPath quot screenshots quot , quot .png quot ) slots GameObject.Find( quot Slots quot ).transform slots GameObject.FindGameObjectWithTag( quot Slots Content quot ).transform for (int i 0 i lt imagesToLoad.Length i ) var go Instantiate(saveSlotPrefab) go.transform.SetParent(slots) Texture2D thisTexture new Texture2D(100, 100) NOW INSIDE THE FOR LOOP string fileName imagesToLoad i byte bytes File.ReadAllBytes(fileName) thisTexture.LoadImage(bytes) thisTexture.name fileName GameObject ChildGameObject go.transform.GetChild(1).gameObject ChildGameObject.GetComponent lt RawImage gt ().texture thisTexture var raw go.GetComponent lt RectTransform gt () if (counter 3) raw.anchoredPosition new Vector3(1 , 0.3f, 0) counter 0 else raw.anchoredPosition new Vector3(1 counter gap, 6, 0) counter Update is called once per frame void Update() Now it's creating a line of 3 objects but then when it's filled with 3 objects in a line I want it to move one step down and start a new line of 3 and so on. The problem is I can't make it automatic move one step down with the right gap on the Y and start a new line. I'm doing the new line with this raw.anchoredPosition new Vector3(1 , 0.3f, 0) but the result is that the fourth object is too much down And it should be like this


Unity Access animation clips motion of an animator So I have an animator on my GameObject. I need to change the animation clip motion of different states in my animator to the one I assign in my EditorGUILayout.ObjectField. Problem is, I have no idea how to access those clips. This is purely Editor Scripting.


How can I make that when the first animation end the next animation will start but from the same position? I have two animations. The first animation I downloaded from the Mixamo site. The game start when the player is on his back on the ground and then slowly stand up. When the animation end the player is standing Look at the player legs Then it's starting playing the next animation idle animation Look at the player legs now when the idle animation start There is no problems with the animations. It's just when the first animation end the player legs move close to each other because the legs position in the start of the second animation is not the same position when the first animation end. I need somehow to make if it's possible that the first animation legs will end at the position of the second animation start. Now the legs are moving to each other and it looks funny. If I was showing a gameplay you will see the legs moving to each other like the player is closing his legs. This screenshot is of the Animator controller where the left New State is the first animation and the Grounded is a blend tree with the idle animation inside And this is a screenshot of the blend tree and the first top state is the idle animation The transition between the two animations looks bad funny. The player is closing his legs. Instead I wish there was a way to make the first animation to end with the legs close like in the second animation start.


How to rotate a rigidbody with a Pid controller I would like someone to describe me how to use a PID controller to rotate a rigidbody with AddTorque to a specific position. (like a spacecraft that rotates the Y axis of rotation towards Camera.forward for example). Can anyone show it to me with a script? Actually I already use this script to rotate with AddTorque but the object almost never stops at the precise point. Vector3 camForward Camera.main.transform.forward Vector3 rbForward rb.transform.forward Vector3 torqueY Vector3.Project(torque, Vector3.up) Vector3 torque Vector3.Cross(camForward, rbForward) rb.AddTorque(torque) rb.AddTorque( rb.angularVelocity)


Counting triangles and vertices in Unity's cube I want to understand logic behind drawing triangles of primitives in Unity. When we spawn simple cube, variable mesh.vertexCount gives us value 24. Also when we list all vertices positions (from mesh.vertices) and triangles numbers (from mesh.triangles), we get 0. (1.0, 1.0, 1.0) 0 1. ( 1.0, 1.0, 1.0) 2 2. (1.0, 1.0, 1.0) 3 3. ( 1.0, 1.0, 1.0) 0 4. (1.0, 1.0, 1.0) 3 5. ( 1.0, 1.0, 1.0) 1 6. (1.0, 1.0, 1.0) 8 7. ( 1.0, 1.0, 1.0) 4 8. (1.0, 1.0, 1.0) 5 9. ( 1.0, 1.0, 1.0) 8 10. (1.0, 1.0, 1.0) 5 11. ( 1.0, 1.0, 1.0) 9 12. (1.0, 1.0, 1.0) 10 13. (1.0, 1.0, 1.0) 6 14. ( 1.0, 1.0, 1.0) 7 15. ( 1.0, 1.0, 1.0) 10 16. ( 1.0, 1.0, 1.0) 7 17. ( 1.0, 1.0, 1.0) 11 18. ( 1.0, 1.0, 1.0) 12 19. ( 1.0, 1.0, 1.0) 13 20. (1.0, 1.0, 1.0) 14 21. (1.0, 1.0, 1.0) 12 22. (1.0, 1.0, 1.0) 14 23. (1.0, 1.0, 1.0) 15 (i th element, vector from mesh.vertices i , number from mesh.triangles i ) Obviously we need only 8 vertices to create cube, but we need 6 2 12 triangles, three vertices every array of 36 vectors. So... what is the logic of Unity primitive?


Making animations not smooth while using Record button In my 2D sidescroller game, I want to separate the animations for the head and the body of my character. While idling, my charcter's body bounces slightly up and down (kind of a breathing motion). Thus, the head should keep up. However, when I press Record and make adjustments for the head, the head moves up and down smoothly instead of following the body frame by frame. How can I remove the smooth transitions from one position to the other? Here is a screenshot from Unity demonstrating the hierarchy and the animation keyframes.


UNITY Prevent 3D Text Render Trough All Object Without Shader im tired of those answer i found trough search engine that just keep saying " the trick is to modify the shader " without thinking because they want to gain reputation , in my case , i have 2 3D text , one of them using special font and the other one using default font , and the shader to prevent the text render trough all object from http wiki.unity3d.com index.php?title 3DText is not working and giving weird white square plus i don't want to change from default Arial font because i want to make them look different , i also cannot use sprite as background because i need to change their color trough script to give some effect , this is my picture showing my problem If the picture is not clear , go here https i.stack.imgur.com hLqC9.png The menu dropped is at Z 100 while the background is at Z 20 , as you see , the text is rendered while the other not ( such as the border , ect ). And this is the picture when my special font without using the shader If the picture is not clear , go here https i.stack.imgur.com vbrQ1.png Now the picture of my special font using the shader If the picture is not clear , go here https i.stack.imgur.com hMAR2.png Is there any possible way to prevent the text rendered without shader change the background to sprite ? Im sorry if this already asked somewhere , i just cannot find it at search engine ( neither here ) .


How can I implement simple distributed processing in a Unity game? I'm looking to set up a game which uses distributed processing. Just a simple brick shooter in unity with the distributed part being that the calculations for the falling blocks are handled by another PC and the transformations are sent back and applied to a clients machine. To use this in Unity I assume I'll be using Remote Procedure Calls? Will I also require socket programming? Any other networking elements I require?


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?


Visually updating the position of a game object controlled by an animator controller I have a game object that is controlled by an animator controller. In order to activate the next animator state, the user is supposed to grab this game object, and then move it from Point A to Point B. As a test, in said game object's Update() method, I added the following line this.transform.localPosition Vector3.up When running the game, I can see that the y coordinate of the game object's position increases every single frame, just as intended. However, visually, the game object's position is not changing at all it remains in the same place all the time. What should I do to ensure that game object's position is also visually updated? EDIT Here are the properties of the animator I am using EDIT If relevant, here is the skinned mesh renderer for said game object


How can I get a background image and game objects to fill black areas of letterbox or pillarbox? I have used the Aspect Ratio Enforcer to force my game's aspect ratio to remain as 9 16. I need to prevent some game objects and the backgrounds from being affected by the enforced aspect ratio to cover the black areas that result from other aspect ratios. How can I prevent some game objects and background images from getting affecting by the Aspect Ratio Enforcer?


Consistent normals at any angle in bezier curve Could not work out or find any solution for this. I have a spline which consists of bezier curves (in 3d space) in fact, any straight line will also have such problem. I take a point on the curve and need to get a normal to this point at any given angle 0 360 (say, to build a mesh around it or to calculate an offset for the movement). I understand that in 3d space we have to define a plane to build normal, normally by using Vector3.Cross(A, B) In general, one uses curve's tangent as A and, e.x., Vector3.up or right as B. But, if curve becomes vertical (it can go in any direction, imagine any track that is ground independent, like in space), it gets aligned with Vector3.up, and the direction of normals goes crazy, swaps direction and so on, which is quite logical. More, it does so not only in straight vertical position, but start to change gradually around it. So, the question is how can I get consistent (all in equally correct direction) normals, using any given curve point position and angle for normal rotation? Update The initial approach looked like this public Vector3 GetTangent(...) Vector3 q2 CalculateTangent (...) Quaternion lookAt Quaternion.LookRotation (q2) Vector3 normal lookAt Vector3.up normal Quaternion.AngleAxis (angle, q2) normal return point normal size Which generated the following normals (blue is up) Now, if I try to use the previous normal for the direction Quaternion lookAt Quaternion.LookRotation (q2, previousNormal) first of all, I don't understand what to place here Vector3 normal lookAt ? And any combination of tangent, normal and rotation gives me something like this Where it can be clearly seen that normals on the vertical are improved (though not correct), but on the horizontal all went wrong, as if I just changed Vector.up to Vector3.right. In addition, the code for generating the tube in its main part looks like this float vStep (angleTo angleFrom) pipeSegmentCount if (b 0 amp amp tP 0f) tP 0.01f if (b 0 amp amp t 0f) t 0.01f if (b spline.Nodes.Count 2 amp amp tP 1f) tP 0.9f if (b spline.Nodes.Count 2 amp amp t 1f) t 0.9f Vector3 vertexA spline.GetTangent ( pP, tP, bP, Vector3.up, pipeAngle, pipeRadius) Vector3 vertexB spline.GetTangent ( pointsTotal b s , t, b, Vector3.up, pipeAngle, pipeRadius) for (int v 1 v lt pipeSegmentCount v , i 4) vertices i vertexA vertices i 1 vertexA spline.GetTangent ( pP, tP, bP, Vector3.up, v vStep pipeAngle, pipeRadius) vertices i 2 vertexB vertices i 3 vertexB spline.GetTangent ( pointsTotal b s , t, b, Vector3.up, v vStep pipeAngle, pipeRadius) Where 0.01f and 0.99f are because ends of spline do not have control points and LookRotation produces an error about zero rotation. b and bP are node indexes, and P suffix is for "previous". This particular code is used to generate a round rail and move an object beneath it. Thus, it is important that the bottom normal is consistent and always at the bottom (when it is vertical, this bottom is not the world bottom of course, but it protrudes at the side of the tube, object will turn itself accordingly, looking forward the curve).


How can I stop showing camera image in my Scene? Unity How can I stop showing camera image in my Scene in Unity? As you can see on the screenshot there is an image of a camera inside a player in the Scene view. How can I disable the image?


Is it possible to prevent the collider 2D outline from hiding in Unity? Is it possible to prevent the collider 2D outline from hiding in Unity? I am creating some animations in Unity. To create animations I select different parts of a hero and move them frame by frame. Now I am working on the run animation and would like to see the bottom collider during parts movement for the animation creation. In my case the collider outline is red I don't want the red bottom line (which is the collider outline) to disappear while I am creating animations. Should I research the Unity extensions and maybe write my own which would prevent the collider from hiding or is it possible to achieve what I want out of the box somehow?


"The associated script cannot be loaded", how can I see what script is associated? I have a couple objects that are throwing errors in the warning log The referenced script on this Behaviour (Game Object 'myObject') is missing! Here is what they look like in the inspector How can I see what script is (or was) associated?


How to execute a code from many scripts I want to execute a function from many scripts attached on gameobjects which will be spawned. Since game objects are spawned, I can't assign the script in the inspector. What i want is that, there are three gameobjects, A,B,C. C is already in the scene. A and B are spawned with different scripts,the spawned gameobject's script should call the function on the gameobject C. I can make a delegate but there are different scripts that want to call the function. So should i have to create different delegates for each script on A and B and then assign them onto the gameobject C so that A and B can call their delegates and these delegates will trigger the function on C or there is something like a event that i can call from B. If it was possible, i can create a event on A and assign it on C. Now A can call the delegate and B can also call that event and trigger the function on C, but this is not possible as event can't be called from another script. I need something like a function that i can call from any script and it calls the function from C. Note that function should not be static. As i can call a static function from any script but it can call only static methods, which i don't want.


Box2d on authoritative server for Unity client I'm creating a multiplayer platform and shooting game in unity, using unity2d's own physics system (box2d). But the truth is that I am quite lost in the creation of an authoritative server in c . I have quite clear and experience in the use of socket for communication between client and server, I do not know how to approach the issue of simulating the physics of my game on the server so that it decides the positions movements of the clients. Can anyone guide me to use box2d on the server, as I simulate the game on the server? Is this a good option or would it be better to implement my own game physics than to use the non deterministic engine? Thank you very much and sorry for my level of English