Is a 3D renderer with 1000 FPS possible? Okay, for my phD Thesis, I need to make a simple 3D game, like towers of hanoi or whatever but there is a condition I need it to have high FPS, as in, the highest FPS achievable, atleast a 1000FPS. I need to have a high FPS to measure reaction times. We achieve this with 1ms monitors BUT on the programming front, here is the problem, I'm confused if I should code an entire specially made engine with only the features I need (using Vulkan), and if I did would it be faster than already available engines like Unity or Unreal? Would it be worth the time and effort or can these engines be customised themselves and is that easier than doing it from scratch? Or is it only achievable with specialized hardware? So I'd be better of using an available engine and going hard on the hardware?


How do I find all game objects with particular name? I'm trying to mimic FindGameObjectsWithTag with FindGameObjectsWithName. I know using tags is faster, but I'm trying create a way to search for objects I spawn with a child object I name on instantiation through the inspector. My goal is create multiple enemy spawners. My current spawner has a drag and drop variable for enemy prefabs. It looks for enemies tagged "ReSpawn", then checks if that length is below a value, to start spawning more. I would like to upgrade my current single spawner to still check for enemies named "ReSpawn", but then check if those respawns have a child object a name specified in the editor. This way, I can set the enemy spawners anywhere (e.g. near water, tall grass, forests, etc), and when I defeat one, the specific spawner will instantiate one of its opponents for that area. Here is my code, so far var ThisSpot String var Oppos GameObject var OppoCount GameObject var HowMany 3 var spawnSizeArea 25 function Start() StartCoroutine ("Spawn") function Update () OppoCount GameObject.FindGameObjectsWithTag("Respawn") OppoCount GameObject.FindWithName(ThisSpot) This is what I am trying to achieve if(OppoCount.length lt HowMany) StartCoroutine ("Spawn") function Spawn() var length Oppos.length 1 var index Mathf.Round(length UnityEngine.Random.value) curSpawn Oppos index var xz Random.insideUnitCircle spawnSizeArea var newPosition Vector3(xz.x,0,xz.x) transform.position yield WaitForSeconds(Random.Range(70,120)) Instantiate(curSpawn, newPosition, transform.rotation) Then I could use these 2 lines of code below to use multiple spawners var newOp GameObject Instantiate(curSpawn, newPosition, transform.rotation) newOp.transform.Find("fighter").gameObject.name ThisSpot StopCoroutine("Spawn")


submeshes and dynamic batching doesnt work as expected I'm duplicating one object with submeshes frequently, and assigning a random material from five materials to each submesh. There is batching happening, but it's not quite as efficient as I would have expected (details here). Note objects are all less 900 vertices no light maps and ... All are dynamic batching ready So if dynamic batching works there must be only 5 draw calls right but there isn't there is really much more than 5


How do I programmatically change the areaSize variable of an Area Light object in Unity? I'm trying to change the areaSize property of an Area Light object, but it looks like it isn't exposed in the class, itself. this.light.areaSize new Vector2(this.areaLightWidthSlider.Value, this.areaLightHeightSlider.Value) This code results in the error error CS1061 'UnityEngine.Light' does not contain a definition for 'areaSize' and no extension method 'areaSize' accepting a first argument of type 'UnityEngine.Light' could be found (are you missing a using directive or an assembly reference?) The documentation says it exists, as an "editor only" property. Is there any way to programmatically access and change this property, possibly using reflection or serialized properties? I am using Unity 4.6, if at all relevant.


Unity virtual joystick jarring movement I'm creating an infinite flyer game in which you control the plane using a mobile joystick. There are two controls one to rotate the plane and the other to move the plane. While rotating the plane there is a lot of jarring if I use Time.deltatime. There is no jarring when I don't use Time.deltatime. This is the line of code that use Time.deltatime transform.rotation initialRotation Quaternion.Euler( pitchTime.deltaTime, yawTime.deltaTime, 0). Here is the code in the Move script public class Move MonoBehaviour public Joystick joystick public Joystick joystick1 float rotateVertical float rotateHorizontal public float sensitivity Quaternion initialRotation float pitch, yaw float moveHorizontal float moveVertical void Start() initialRotation transform.rotation void Update() pitch pitch joystick.Vertical sensitivity yaw yaw joystick.Horizontal sensitivity transform.rotation initialRotation Quaternion.Euler( pitch Time.deltaTime, yaw Time.deltaTime, 0) transform.Translate(moveHorizontal Time.deltaTime, moveVertical Time.deltaTime, 0) There is also a camerafollow script attached. SerializeField Transform target public Vector3 defaultDist new Vector3(0f, 0, 7.5f) SerializeField float distDamp .1f public Vector3 velocity Vector3.one Transform myT void Awake() myT transform void LateUpdate() SmoothFollow() void SmoothFollow() Vector3 toPos target.position (target.rotation defaultDist) Vector3 curPos Vector3.SmoothDamp(myT.position, toPos,ref velocity ,distDamp) myT.position curPos myT.LookAt(target, target.up)


Closest node in A pathfinding For my 2D Unity game, I've implemented A pathfinding based on waypoints. System already handles building graph from waypoints on scene (which are manually placed objects), as well as finding and caching closest routes. So, general idea is to select closest waypoint to character, closest waypoint to target position, and use pathfinding algorithm to find closest route (which is pre cached already). Yet, I've stumbled into issue I don't know how to actually get closest waypoint. Well, there are several ways I think of, in the worst case I can just brute force closest non blocked waypoint from the collection, but that would be bad performance wise. So, are there any proper ways to get start or end points?


Unity Trail Renderer artifacts flickering disappearing I have a projectile prefab that have 2 trail renderers attached to it. Whenever I instantiate another projectile, every trail renderer seems to flicker. This is similar to the question Changes to one Unity trail renderer causes all of them to flicker In addition to that, I have other rendering artifacts as well. Having too many trail renderers seems to cause some of them to not draw. Also, sometimes, they just seem to randomly choose not to draw. As you can see, the left most projectile doesnt want to draw its trail. Similarly, adding more projectiles, the front projectiles seems to lose all of its trails. So thus, the 2 issues I am having is Flicking trail renderers when another is instantiated. Trails not rendering randomly. Unity Version 5.3.2f1


What is the best way to increase slowly object movement speed and slow down the object near the end? There a Lerp but also SmoothDamp. In this script I'm using SmoothDamp but why not using Lerp ? And how should I use this script with the SmoothDamp tp make slowly increasing speed at the start ? Now it's only slow down at the end but I want it also to increase slowly at the start and then slowly down near the end. using System.Collections using System.Collections.Generic using UnityEngine public class MovementSpeedController MonoBehaviour public Transform target private Vector3 velocity Vector3.zero public float smoothTime 0.3F void Update() transform.position Vector3.SmoothDamp(transform.position, target.position, ref velocity, smoothTime)


Screen Capture rendered on a RenderTexture in Unity I have a pretty wild idea for a unity application that would work on a multi display setup. The app would be running in full screen mode on one of my displays, and the contents of the remaining two displays should be rendered in game on a texture. I've seen RTMP clients for unity and I've tried streaming my desktop with OBS to a local RTMP server but the delay was too big (more than 5 seconds). I would prefer an instant (or very low delay) solution for mirroring my displays on textures in Unity. If anyone can help me solve this, i would appreciate it!


Unity protect MonoBehaviour derived classes from instantiating via new in C When the class hierarchy grows and you deal with a lot of custom types in your project, it sometimes becomes hard to remember which types are allowed to be created via new and which types are derived from MonoBehaviour and therefore can't be created via new but must instead be attached to the GameObject as a Component. Is it possible to have some safety mechanism for this? The goal would be to have two base classes to control the ability to use new on a certain type. Ideally resulting in a compile time error instead of an easy to miss warning in the console ("You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. Blah blah."). My attempt to make the constructor protected, like this public class UnCreatableBase MonoBehaviour protected UnCreatableBase() using new should be not allowed public static T Create lt T gt () instead this method allows object creation return GameObject.Instantiate (Resources.Load ("Prefabs " typeof(T).Name) as GameObject).GetComponent lt T gt () public class CreatableBase public CreatableBase() new is ok here still allows me to write var whyDoesThisWork new UnCreatableBase() I can access the protected constructor even from an outside scope. Now, the obvious solution would be to make constructors of MonoBehaviour derived classes private. Manually. All of them. Manually. I was wondering if there's a way of achieving the same in a more generic way.


Get all the gameobjects for a SceneManager scene in Unity I'm using the new SceneManager to load multiple scenes in the same structure adopting the Additive method. I find it extremely useful but I wonder if there is a way to get all the GameObjects for a specific scene. When multiple scenes are loaded I see the GameObjects clearly separated by scene in the hierarchy but I cannot find a way to access the specific hierarchy of a single scene via script. Is that possible? The findGameObject method I think returns the GameObjects for all the scenes..


Unity mouse input not working in webplayer build I have a button script with the following code void OnMouseDown() animation.Play("button squish") enlarged true audio.PlayOneShot(buttonSound) void OnMouseUpAsButton() if (enlarged) SelectThisButton() enlarged false animation.Play("button return") void OnMouseExit() if (enlarged) enlarged false animation.Play("button return") It works great in the editor, but when I made a build and tested it in Chrome none of the buttons had any response. Further testing revealed that it did work in Firefox. Rather than telling people to change their browser if they want to play, I want to make the button code work. How else can I get the buttons to know when they're being pressed if the built in stuff isn't working?


How can I make a character crouch? I tried to make a crouch system. In my script I changed .height and .center properties of collider in CharacterController component. But there are some problems. First, once I press "crouch button" collider is changing its height and center position but when I release the key the collider isn't returning to its previous state. Secondly, if I change its height and position by hand when collider is under a block, it's just stuck. How can I fix this problem? Here's my script using System.Collections using System.Collections.Generic using UnityEngine RequireComponent(typeof(CharacterController)) public class PlayerController MonoBehaviour public float moveSpeed public float jumpForce public CharacterController controller public GameObject myCamera private Vector3 moveDirection Vector3.zero public float gravityScale public Animator anim Use this for initialization void Start () transform.tag "Player" controller GetComponent lt CharacterController gt () Update is called once per frame void Update () Vector3 forwardDirection new Vector3 (myCamera.transform.forward.x, 0, myCamera.transform.forward.z) Vector3 sideDirection new Vector3(myCamera.transform.right.x, 0, myCamera.transform.right.z) forwardDirection.Normalize () sideDirection.Normalize () forwardDirection forwardDirection Input.GetAxis("Vertical") sideDirection sideDirection Input.GetAxis("Horizontal") Vector3 directFinal forwardDirection sideDirection if (directFinal.sqrMagnitude gt 1) directFinal.Normalize () if (controller.isGrounded) moveDirection new Vector3(directFinal.x, 0, directFinal.z) moveDirection moveSpeed if (Input.GetButtonDown("Jump")) moveDirection.y jumpForce if(Input.GetButtonDown("Crouch")) controller.height 1f controller.center new Vector3(0f, 0.5f, 0f) moveSpeed 3f moveDirection.y moveDirection.y (Physics.gravity.y gravityScale Time.deltaTime) controller.Move(moveDirection Time.deltaTime) anim.SetBool("isGrounded", controller.isGrounded) anim.SetFloat("Speed", (Mathf.Abs(Input.GetAxis("Vertical")) Mathf.Abs(Input.GetAxis("Horizontal")))) Thanks for any help!


Why am I getting errors like these when trying to build my app I am currently trying to build and publish my app to the universal windows platform halfway through the process of doing so, during the validation process I got stopped with these errors. The 1st one I am clueless to what I can even do and the second one I don't know why is happening. Please help. First error Supported API test FAILED Supported APIs Error Found The supported APIs test detected the following errors API D3D12GetDebugInterface in d3d12.dll is not supported for this application type. UnityPlayer.dll calls this API. Impact if not fixed Using an API that is not part of the Windows SDK for Windows Store apps violates the Windows Store certification requirements. How to fix Review the error messages to identify the API that is not part of the Windows SDK for Windows Store apps. Please note, apps that are built in a debug configuration or without .NET Native enabled (where applicable) can fail this test as these environments may pull in unsupported APIs. Retest your app in a release configuration, and with .NET Native enabled if applicable. See the link below for more information Alternatives to Windows APIs in Windows Store apps. Second error App resources FAILED Branding Error Found The branding validation test encountered the following errors Image file SplashScreen.scale 200.png is a default image. Impact if not fixed Windows Store apps are expected to be complete and fully functional. Apps using the default images e.g. from templates or SDK samples present a poor user experience and cannot be easily identified in the store catalog. How to fix Replace default images with something more distinct and representative of your app. Here is the full output for further details 1.1.1.0 App Architecture x64 Kit Version 10.0.16299.15 OS Version Microsoft Windows 10 Pro (10.0.16299.0) OS Architecture x64 Deployment and launch tests PASSED Bytecode generation PASSED Background tasks cancelation handler PASSED Platform version launch PASSED App launch PASSED Crashes and hangs Package compliance test PASSED Application count PASSED App manifest PASSED Bundle manifest PASSED Package size PASSED Restricted namespace Windows security features test PASSED Binary analyzer PASSED Banned file analyzer PASSED Private code signing ... (error 1 above) App manifest resources tests PASSED ... (error 2 above) Debug configuration test PASSED Debug configuration File encoding test PASSED UTF 8 file encoding App Capabilities test PASSED Special use capabilities Windows Runtime metadata validation PASSED ExclusiveTo attribute PASSED Type location PASSED Type name case sensitivity PASSED Type name correctness PASSED General metadata correctness PASSED Properties Package sanity test PASSED Platform appropriate files PASSED Supported directory structure check Resource Usage Test PASSED WinJS background task


Optimizing data structure for my text adventure? In my text adventure I'm making, I store the story data in a hashtable (I'm using unity's javascript unity script since I'm more comfortable with the syntax than C ). The problem is, the way I structure the hashtable means that it gets incredibly bloated very quickly (I've used the same structure in all of my text adventures across multiple languages. It quickly grows to nearly 1k lines long) which makes it hard to edit in the future (especially if I need to go back to edit certain parts later on) Here's the hashtable as it's currently structured public static var story "0" "text" "", "choices" "response1" "text" "", "nextPart" "1" , "response2" "text" "", "nextPart" "2" , "response3" "text" "", "nextPart" "3" , "1" "text" "", "lastPart" "0" , "2" "text" "", "lastPart" "0" If anyone could help me optimize the structure of the hashtable that'll make it so it's more easier for me to edit it in the future, that would be great Quick information for parts that may not be self explanatory "lastPart" indicates to the hashtable parser that the player has died and the number refers to the part where they chose the response choice. "nextPart" refers to the part of the story the response leads to.


Running a scene in the background I've made 2 scenes where a room is another scene and the other is the outside of it. But whenever I do something in either scenes, and enter the other, it resets everything I did in the first one. I'm thinking of making the scene running in the background the whole time but how can I do that?


How do I reference one game object in a script attached to another? This is all in Unity, with C . I have attached a script to my player that should destroy a TreeGroup (as in a forest) whenever I press 'Q' and instantiate one when I press 'E'. Here is the code using UnityEngine using System.Collections public class DisableTrees MonoBehaviour Use this for initialization void Start () Update is called once per frame void Update () if (Input.GetKeyDown (KeyCode.A)) Disable Trees on A Keypress Debug.Log("Trees Disabled!") if (Input.GetKeyDown (KeyCode.E)) Enable Trees on E Keypress Debug.Log("Trees Enabled!") How do I access and find my 'TreeGroup' object group while script not being attached to 'TreeGroup' but my character instead and then Destroy on Q Keypress? And how do I Instantiate it?


How to Subscribe to Events from Unity's VRInput Script I am new to Unity and trying to modify the Unity tutorial Interactive 360 Sample. I want to be able to call a function when a user swipes using an Oculus Go Controller. I noticed that the VRInput script is included in the project, which seems to be able to detect swipe gestures. But where do I attach that script, and how do I subscribe to the OnSwipe event. I am currently trying by making an empty game object, and attaching the InputVR script as well as my own script called "GestureHandler" (I'm not sure whether InputVR is already attached to something else in the sample project, or whether I need to attach it at all). In my GestureHandler script I currently have the following using System.Collections using System.Collections.Generic using Interactive360.Utils using UnityEngine public class GestureHandler MonoBehaviour void onEnable() VRInput.OnSwipe HandleSwipe void onDisable() VRInput.OnSwipe HandleSwipe void HandleSwipe() Debug.Log("swipe") and currently have the following errors An object reference is required for the non static field, method, or property 'VRInput.OnSwipe' Assembly CSharp No overload for 'HandleSwipe' matches delegate 'Action lt VRInput.SwipeDirection gt ' Assembly CSharp An object reference is required for the non static field, method, or property 'VRInput.OnSwipe' Assembly CSharp No overload for 'HandleSwipe' matches delegate 'Action lt VRInput.SwipeDirection gt ' Assembly CSharp


translation and rotating at the same time and waiting before animation? I am having difficulties here. I want to move my character with the buttons and I want the character to rotate wherever he is going. Also I want to play an animation when there is no keys pressed. I am able to do that but I want the animation to play after 10 seconds of no key being pressed, and only once. Than after a movement that resets and again after 10 seconds of no key the animation plays. (The animation works but it happens right after I stop pressing a key and continuously.) IEnumerator Test() yield return new WaitForSeconds(10.0f) void Update() if (Input.GetKey(KeyCode.W)) counter Time.deltaTime transform.Translate((Vector3.forward) moveSpeed Time.deltaTime) Debug.Log("Pressing W key") if (Input.GetKey(KeyCode.S)) counter Time.deltaTime transform.Translate((Vector3.back) moveSpeed Time.deltaTime) Debug.Log("Pressing s key") if (Input.GetKey(KeyCode.A)) counter Time.deltaTime transform.Rotate(Vector3.down rotateSpeed) Debug.Log("Pressing a key") if (Input.GetKey(KeyCode.D)) counter Time.deltaTime transform.Rotate(Vector3.up rotateSpeed) Debug.Log("pressed D") if (!Input.GetMouseButton(1)) moveSpeed 20 if (!Input.anyKey) if (counter gt 2) StartCoroutine(Test()) anim.Play("Animation") counter 0 Debug.Log("A key or mouse click has been detected")


Mapping polar coordinates to cube I am trying map polar coordinates to points on a cube. I was able to map the front, back, left and right faces of the cube, but I am struggling with the top and bottom. Here is what I have lt summary gt Converts polar coordinates to uv coordinates on a cube. lt summary gt lt param name "p" gt The polar coordinate p.x longitude, p.y latitude. lt param gt lt param name "face" gt The face of the cube that p maps to. lt param gt lt returns gt The xy coordinate on the cube face. lt returns gt private Vector2 PolarToCubeFace(Vector2 p, out CubemapFace face) face CubemapFace.Unknown Vector2 result Vector2.zero float lng p.x East to West. float lat p.y North to South. if (lat gt 45 amp amp lat lt 135) Front, back, left, or right face. face (lng gt 0 amp amp lng lt 90) ? CubemapFace.PositiveZ (lng gt 90 amp amp lng lt 180) ? CubemapFace.PositiveX (lng lt 90 amp amp lng gt 180) ? CubemapFace.NegativeZ CubemapFace.NegativeX result.y (lat 45) 90f result.x mod(lng, 90) 90f else Top or bottom face. Need help here. return result


Unity get screenshots from various resolutions To upload my app to Google Play I need to provide various screenshots. Thing is, I have only one tablet, no phone and I don't feel like virtualizing a bunch of devices. Is there a way to create screenshots of different sizes? Like what would a 7" 1280X720 tablet see?


To Unity Rigidbody move like Character Controller on collision I want to a blue ball moving like a figure. in CharacterController, it was possible. but in Rigidbody, object was stucked. help me.


Unity Physics.Raycast give false positive while using layer mask I'm very new to Unity so please excuse my question if this sounds very basic to you. I'm following various tutorials and I have a small question regarding Physics.Raycast if (Input.GetButton("Fire1")) check ground hit first RaycastHit hit if (Physics.Raycast(ray, out hit, LayerMask.GetMask("Ground"))) Debug.Log(" PlayerMotion Hit" hit.collider.name " " hit.point) agent.SetDestination(hit.point) Here, even tough I expressively set the layer mask to "Ground", I still get a hit with the Player game object itself (the ground hit is working fine). I thought ok maybe I put the "Ground" layer as well on the player by mistake but I checked several times and it's not the case. I'm attaching a gif so you can see what's the issue exactly There's an easy by checking the collider.name but I still find it odd that the Raycast gives me a false positive with the player hit. Any idea what's going on ?


How to apply code of certain script to another? I have a code in my "OnCollider" script to respawn whenever the player dies and has taken an object containing tag 'Respawn'. 1st script OnCollider using System.Collections using System.Collections.Generic using UnityEngine public class OnColllider MonoBehaviour public GameObject Doorfinder public GameObject Door2 public Transform Camera public Transform target public GameObject Coin public bool collided public GameObject Playee public GameObject currentRespawn void Start() Door2 GameObject.Find ("Door0.2") Playee GameObject.Find ("Player") public void OnCollisionEnter2D(Collision2D collision) if (collision.gameObject.name "scroll") Destroy (collision.gameObject) Destroy (Doorfinder) if (collision.gameObject.tag "Fire" ) Playee.SetActive (false) if (collision.gameObject.name "PathFinder") Destroy (collision.gameObject) Destroy (Door2) if (collision.gameObject.tag "Coin") Destroy (collision.gameObject) if (collision.gameObject.tag "subVillains") Playee.SetActive (false) if (collision.gameObject.tag "Bramble") Playee.SetActive (false) Respawnable (collision) public void Respawnable (Collision2D collision) if (collision.gameObject.tag "Respawn") collided true collision.gameObject.SetActive (false) if (collided true amp amp Playee.activeInHierarchy false) transform.position currentRespawn.transform.position Playee.SetActive (true) collided false if (currentRespawn.activeInHierarchy false amp amp collision.gameObject.tag "Respawn") currentRespawn collision.gameObject 2nd Script Enemy using System.Collections using System.Collections.Generic using UnityEngine public class MaxyMory MonoBehaviour public Vector2 origin public float distance public int layerMask public float sider public Vector2 secondorigin public float bringer public float lesngther public GameObject destroy public Vector2 origination public float middle public float lengther Use this for initialization void Start () origin new Vector2 (transform.position.x bringer, transform.position.y sider) origination new Vector2 (transform.position.x bringer, transform.position.y middle) secondorigin new Vector2 (transform.position.x bringer, transform.position.y lengther) Update is called once per frame public void Update(GameObject Playee) Debug.DrawRay (origin, Vector2.right distance, Color.red) Debug.DrawRay (secondorigin, Vector2.right distance, Color.cyan) Debug.DrawRay (origination, Vector2.right (distance 30f), Color.gray) RaycastHit2D hit Physics2D.Raycast (origin, Vector2.right, distance) RaycastHit2D anotherhit Physics2D.Raycast (secondorigin, Vector2.right, distance) RaycastHit2D checker Physics2D.Raycast (origination, Vector2.right, distance 2f) if (hit.collider.tag "Player" anotherhit.collider.tag "Player") Playee.SetActive (false) OnCollider is attached to the player while the enemy script is attached to the enemy itself.


Unity3D AI follow player script for prefab enemy? So I am having an issue, I have an enemy prefab that is created when the new wave happens(think of Nazi Zombies from Call of Duty, same system) but every script I have found that deals with ai following player always involves a public transform variable. The issue is that the object I put in that variable in the inspector does not save with the prefab, rendering the script useless. Is there anyway I can get the enemy prefab when the enemy spawns to follow the player? He is a script I tried and failed due to the issue The target player public Transform player In what time will the enemy complete the journey between its position and the players position public float smoothTime 10.0f Vector3 used to store the velocity of the enemy private Vector3 smoothVelocity Vector3.zero private void Start() Call every frame void Update() Look at the player transform.LookAt(player) Move the enemy towards the player with smoothdamp transform.position Vector3.SmoothDamp(transform.position, player.position, ref smoothVelocity, smoothTime) Time.deltaTime


How to model walkable houses for Unity I created a house in blender which is a big cube with the upper face intended and pulled down back to the ground. The floors are other boxes and windows and doors are cut out using a boolean modifier. The problem is that the character controller from the Unity standard assets seems to get stuck between the floors and the walls. I have seen that counter strike maps are mostly not made out of cubes but a lot of planes put together. Is that the proper way to model walkable buildings?


Finding if 2 polygons intersect using clipper library After realising my code was pretty inefficient at checking for polygon overlaps, I've turned to a mentioned library Clipper but finding it difficult to know hot to use it for this operation. I am using unity Vector2 for my shape descriptions Square Vector2 square new Vector2 new Vector2(0,0), new Vector2(1,0), new Vector2(1,1), new Vector2(0,1) I want to be able to do the above boolean comparison of 2 shapes. If anyone knows Clipper well, what methods can I use to do this check? I've recently tried the following but the result is always true even when the test shapes are completely separate from each other public bool CheckForOverLaps(Vector2 shape1, Vector2 shape2) List lt IntPoint gt shape1IntPoints Vector2ArrayToListIntPoint (shape1) List lt IntPoint gt shape2IntPoints Vector2ArrayToListIntPoint (shape2) List lt List lt IntPoint gt gt solution new List lt List lt IntPoint gt gt () c.AddPath (shape1IntPoints, PolyType.ptSubject, true) c.AddPath (shape2IntPoints, PolyType.ptClip, true) c.Execute (ClipType.ctIntersection, solution, PolyFillType.pftNonZero, PolyFillType.pftNonZero) return solution.Count ! 0 private List lt IntPoint gt Vector2ArrayToListIntPoint (Vector2 shape) List lt IntPoint gt list new List lt IntPoint gt () foreach (Vector2 v in shape) list.Add (new IntPoint (v.x, v.y)) return list And the tests Square Vector2 square new Vector2 new Vector2(0,0), new Vector2(2,0), new Vector2(2,2), new Vector2(0,2) Square Vector2 square2 new Vector2 new Vector2 (1, 1), new Vector2 (3, 1), new Vector2 (3, 3), new Vector2 (1, 3) Square Vector2 square3 new Vector2 new Vector2 (2, 0), new Vector2 (4, 0), new Vector2 (4, 2), new Vector2 (2, 2) Square Vector2 square4 new Vector2 new Vector2 (4, 0), new Vector2 (6, 0), new Vector2 (6, 2), new Vector2 (4, 2) Assert.IsTrue(tc.CheckForOverLaps(square,square2)) Assert.IsFalse(tc.CheckForOverLaps(square,square3)) Assert.IsFalse(tc.CheckForOverLaps(square,square4)) Many thanks.


Execute a function for ten seconds and disable it for two seconds I have a particular function which I am calling in Update function. For the first ten seconds, the function should get called in Update function, then it should get disabled for next two seconds, then again enable it for next ten seconds. This cycle should keep repeating? How can I execute it?


Why does the object spawns only on client? In my game I have an object, let say food, that whoever consumes it, that player will spawn one more element. I am checking collision in Update. The following code is working fine on server side, but the object is not spawning. Although, it is spawning on local client but it is not updating on server. Here is my code This function is called on Update private void CheckForFood(Vector3 snakePartPosToBeInitialize,Vector3 headPos) if( food ! null) if ( food.transform.position headPos) UiControllerCS.UI.showScore() GameObject obj Instantiate(snakePart, snakePartPosToBeInitialize, Quaternion.identity) as GameObject currPartOfSnake 1 obj.name quot quot currPartOfSnake obj.transform.parent gameObject.transform tail.Add(obj) NetworkServer.SpawnWithClientAuthority(obj , connectionToClient) I am getting the following error SpawnObject for 1 (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server.


Apply a special effect to a scene area My 2D game has a second camera on the scene that renders an upside down image of the scene and distorts it, giving the effect of water reflection. I render this camera first, and on top of it I render the main camera. This is working correctly as expected, however, I want to improve it's performance by performing this process in small sections of the scene instead of the whole screen. I created a trigger to detect which items should be turned upside down and rendered. How can I turn these items and distort them as I did with the whole scene, but only to the GameObjects detected inside the trigger? Note I can't assign them to a layer since the layer is already in use.


Unity remote not recognising my phone? I made a new project with the Android module installed, which works fine as I can build and run it on my phone when connected to my computer via USB, and yet can't get Unity Remote to work. Edit Project Settings Editor Device won't display my phone's name. I tried several internet solutions I found (such as closing and opening again both Unity and Unity Remote or enabling PTP transfer) and none worked. Any ideas on what could be going on?


Creating outline from a collection of points following the concavity I am trying to create an outline from a collection of points. I found this solution for Convex Hull. I specifically picked this implementation https en.wikibooks.org wiki Algorithm Implementation Geometry Convex hull Monotone chain Edit I can't find an algorithm that will find the concavity of the region specified in green. The yellow line is the Hull from the algorithm amove I have the point is defined as Serializable public struct Point IComparable lt Point gt , IEquatable lt Point gt public int X public int Y public static int Cross(Point o, Point a, Point b) return (a.X o.X) (b.Y o.Y) (a.Y o.Y) (b.X o.X) Here is the implementation of the algorithm public static List lt Point gt ConvexHull(List lt Point gt points) if (points null points.Count lt 3) return points var size points.Count var k 0 var hull new Point 2 size points.Sort() build lower hull for (int i 0 i lt size i) while (k gt 2 amp amp Point.Cross(hull k 2 , hull k 1 , points i ) lt 0) k hull k points i build upper hull for (int i size 1, t k 1 i gt 0 i) while (k gt t amp amp Point.Cross(hull k 2 , hull k 1 , points i 1 ) lt 0) k hull k points i 1 var result new List lt Point gt (hull) if (k gt 1) result.Resize(k 1) remove non hull vertices after k remove k 1 which is a duplicate return result


How can I convert a string to quaternion? private GameObject GetObjectFromFile(string path) GameObject newobj new GameObject() string text new string 3 if (File.Exists(path)) text File.ReadAllLines(path) foreach (string s in text) text s.Split(' ') break var parent text 0 var localPosition StringToVector3(text 1 ) var localRotation StringToVector3(text 2 ) var localScale StringToVector3(text 3 ) newobj.transform.localPosition localPosition newobj.transform.localRotation localRotation newobj.transform.localScale localScale return newobj public static Vector3 StringToVector3(string sVector) Remove the parentheses if (sVector.StartsWith("(") amp amp sVector.EndsWith(")")) sVector sVector.Substring(1, sVector.Length 2) split the items string sArray sVector.Split(',') store as a Vector3 Vector3 result new Vector3( float.Parse(sArray 0 ), float.Parse(sArray 1 ), float.Parse(sArray 2 )) return result It's converting fine the localPosition and localScale but the localRotation is a quaternion and not vector3. This is the text file format I'm reading from Main Camera (UnityEngine.Transform) (297.7, 5.1, 228.5) (0.0, 0.0, 0.0, 1.0) (1.0, 1.0, 1.0) The part (0.0, 0.0, 0.0, 1.0) is the rotation.


Projecting texture from an arbitrary position I'm trying to write a surface shader (not a projector) to project a texture to a surface in a very similar way of what projectors do. Currently I can easily obtain a shader that uses screenspace as UV float2 screenUV IN.screenPos.xy IN.screenPos.w What I'm trying to achieve is to have an arbitrary plane to project the texture over the mesh that uses the shader. I'm checking some resource online like https en.wikibooks.org wiki Cg Programming Unity Cookies but this is strongly related to light space. My main doubt is how can I generate the UV coordinates from another plane? should I define somehow plane sizes or is it enough to define its position?


My money will only save for one game run I am trying to make a money system my problem is that the money value only saves for 1 game run then the value returns to 0. Here is my code. What should I do. using System.Collections using System.Collections.Generic using UnityEngine using UnityEngine.UI public class Money variables public Text cash Use this for initialization void Start () if (counter lt 9 amp amp counter gt 1) money money 2 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 10 amp amp counter lt 20) money money 5 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 21 amp amp counter lt 30) money money 15 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 31 amp amp counter lt 40) money money 25 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 41 amp amp counter lt 70) money money 50 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 71 amp amp counter lt 100) money money 75 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 101 amp amp counter lt 200) money money 100 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) else if (counter gt 201) money money 150 PlayerPrefs.GetInt("money", money) PlayerPrefs.SetInt("money", money) cash.text "Credits " PlayerPrefs.GetInt("money", money)


How to calculate FPS and what factors affect FPS? In this case, FPS means Frames Per Second and that means the number of frames that graphic hardware render in one second. I'm wondering what kind of stuffs could affect FPS? So, for some tests I created a simple scene in Unity with some cubes and capsules and then create a empty game object and then add this c code to it public class FPSReport MonoBehaviour public double Fps void Update () Fps 1.0 Time.deltaTime I think it can tell me the FPS. When I played it it worked but it wasn't more than 30. I was saw a lot of games that their fps was normally on 150. Is this fps rate ok? If I add more objects, textures, animations , etc ... to my scene. What happen to my fps? Could it attain zero? and If it attain zero, what is the meaning of a zero FPS (the hardware stopped working?!)?


How to disable collider2D when another gameobject is on top of it Each black colored square has a BoxCollider2D. How can I disable the collider after I put another game object on top of it? Here is the sample output


Alternative solutions to applying an overly large and detailed texture to a mesh I have a very large spherical mesh in my Unity scene (the earth), to which one very large texture is applied (a map of the earth). Now it just so happens that Unity's max texture size (8192 pixels I believe) is not enough to capture the details I need on this huge mesh. What's the proper way to deal with this situation in Unity? That is, not only overriding the 8192 pixels limitations (although that would be nice as a temporary solution), but also making sure the overhead won't become unbearable... Is there a way to dynamically stream higher quality sections of textures as the camera gets closer to that specific part of the mesh? Additionally, I see the Granite add on (http graphinesoftware.com products granite for unity) seems to do just this (if I understood it well), but it's only for Windows, and I'm developing on a Mac. Is there any other adding out there?


How to know which child collider triggered in parent? I have parent object with 3 children. Each children has one collider (BoxColliders actually) marked as triggers each one. I want to know in a OnTriggerEnter on the parent side which collider was hit. Similar to this question How can I determine which Trigger is hit? But for 3D Colliders (not 2d). As you can see in the accepted answer they used Collider2D.IsTouching but it doesn't seem to exist any analogue method for a 3D Collider If is not possible, what other solutions are there? What would be the recommended way? I would like to avoid the overhead from methods like CompareTag and SendMessage if possible. http answers.unity.com answers 1206114 view.html


How can I detect a Gameobject touching another gameObject without using collider2D's? I have fish gameObjects that have colliders2D so that I can click and move them. I added fish food with Collider2D's but it was hard for me to click on the fish. After I disabled the fish food collider2D it was easier to click on the fish. Is there an alternative when detecting two gameObjeccts without colliders?


added a pipeline and now my terrain is pink...how do I fix it? I needed to add a pipeline to my world because an asset required it. I was following the directions here. Since adding the pipeline, my terrain is pink. I found a references that stated the pipelines do not support terrain, there are problems with more than 4 textures (I have 1) etc...but this was a year ago. Is this fixable or am I at choice between no pipeline or buying pipeline enabled terrain (and hence redoing all of my scenes)? What is the solution? Thnx Matt


Unity using WWW to download image from web. Not working from my own website, but does from other urls I have this script attached to a RawImage file in my games UI public class DownloadImage MonoBehaviour string url "http megabrogames.rf.gd pic.jpg" string url "https i.imgur.com xBSyvRx.jpg" IEnumerator Start () WWW www new WWW(url) yield return www GetComponent lt RawImage gt ().texture www.texture Both jpg files are the same. One I uploaded to Imgur, this works. The other is on my own website. The url to my website works fine, I have checked in on two computers and several browsers. All I get is the red question mark. But if I uncomment the other one instead it all works perfectly. My problem is that I have hard coded the url into the game, and I want to change the image each week. It has to be the same URL for that to work, but i think with Imgur it will auto assign whatever url it feels like. thanks for any help


What is the logic behind the 'Loading' scenes in games? I'm making my first game, it's a tower defense type of game, using Unity game engine and taking Fieldrunners as a reference. I would like to know more about the functionality behind 'Loading' scenes in games. Until now I am instantiating creating objects at run time and I'm not facing any delay or similar issues doing so. So what are 'Loading' scenes in other games used for? Is there some functionality or instantiation of specific objects for the next round or stage? If yes why do I need them if I'm not getting any delays?


Raycasting from an object to the center of the screen (crosshair) without clipping through objects Am trying to learn about Raycasting, and I thought I would start with something simple, and that was a laser that would come out of an object (think laser pointer in your hand) and always go to the crosshair. Using ViewportToWorldPoint I found it easy to cast a ray from the center of the camera, but this had an issue as you can see in this GIF below. The line would clip through because the ray was coming from the center, not off to the side where the laser pointer would be. Am not sure how to solve this. void Update() Vector3 ray Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f)) line.SetPosition(0, transform.position) RaycastHit hit if(Physics.Raycast(ray, Camera.main.transform.forward, out hit, raylength)) if(hit.collider ! null) line.SetPosition(1, hit.point) else Vector3 pos line.GetPosition(0) line.SetPosition(1, ray (Camera.main.transform.forward raylength)) The closest thing I could find that I am trying to replicate for this exercise is the No Man's Sky mining tool


Lower WebCamTexture dimension without requesting Handling image with high resolution dimension can cause heavy lag in low spec computer . So i need to lower the dimension of the image to make it less lag for processing . I know i can do it with WebCamTexture.request(width height) , but if the camera does not support low dimension image , the result image dimension will be still big . I've tried to convert it to Texture2D using WebCamTexture.GetPixels() and uses lower width and height for the Texture2D , but it breaks the image and the result was unexpected . I also have tried to set the WebCamTexture to an object , and get that object captured by in game camera , and resize the image that was captured by the camera , but then it means the high dimension image is doubled (WebCamTexture and image from the in game Camera) and doubled the lag than just using WebCamTexture . Can anyone here help me please ? i will upvote for any attempt to help .


Unity using "as" vs "GetComponent()" Hello im new to unity and im learning raycast right now , after checking the documentation here https docs.unity3d.com ScriptReference RaycastHit triangleIndex.html , i got something that's confusing me , what is the difference between MeshCollider themeshhit thehit.collider as MeshCollider if (themeshhit null) Debug.Log (" themeshhit null ! ") and MeshCollider themeshhittwo thehit.collider.gameObject.GetComponent lt MeshCollider gt () if (themeshhittwo null) Debug.Log (" themeshhittwo null ! ") Both method is working correctly , but i want to know what is the difference between them , and i also want to know which one is better if comparing against speed , compatibility , and ability . Edit variable thehit is look similar to this RaycastHit thehit


What does " get set " in Unity mean? I am coming back again into hobby game development after about 6 months away. I'm just trying to learn some kind of basic things again. I'm at the very start of making a very simple boxing management simulator. Later, I will be trying to re learn using databases and might ask for more help. But for now, I'm making a Boxer class which will hold all the data on each boxer (eg. Name, height, number of wins, punch power etc etc). I've used private variables for those and then have made my own methods for each variable called Getxyz(). I have seen people doing things like 'public int xyz Get() ' but i dont understand how that would work. Is the way I'm doing ok (it does seem long winded to me) or should I investigate these Getter Setters some more? Here's what I am doing right now public class Boxer MonoBehaviour generic boxer details int id string nameA, nameB int weight int height float age float reach career info int wins, loses, draws, winsByKO boxing attributes stats float power, speed, agility, koPunch, stamina, toughness public int GetId() return id public string GetNameA() return nameA public string GetNameB() return nameB


How to rotate object not from it's center point but from it's another point? I am new in unity and I am developing a game where I want to rotate my object I try this code for it. if(Input.GetMouseButton(0)) if(Input.GetMouseButtonDown(0)) LastMousePosition Input.mousePosition else if(LastMousePosition.y gt 112) Bow.Rotate(Vector3.up (Input.mousePosition.y LastMousePosition.y)) else if(LastMousePosition.y lt 112) Bow.Rotate(Vector3.down (Input.mousePosition.y LastMousePosition.y)) LastMousePosition Input.mousePosition It works fine for me but my object is rotate from It's center point and I want to rotate it from another point can any one help me with this?


Unity, OnMouseOver blocked by another gameobject with a collider in front of it I have two gameobjects, both with 2D colliders. One of them can be behind the other, and because of this its OnMouseOver can be blocked from firing as the GameObject in front blocks it from triggering. What is a way around this? I really like the ease of using OnMouseOver, and would rather not use raycastAll. Asked this question on SO, maybe it should be asked here.


Imposters in Unity How to set which color is used as 'transparent' in the RenderTexture? I'm still working at making imposters for my Unity scenes. Here I am attempting to make a large block of stadium seating, using the one seat mesh as shown. I'll try to explain in full what Ive done so far Imported 3d mesh of seat Created RenderTexture 'seat' (default format R8G8B8A8 UNORM) Added new Orthographic camera in front of seat. (settings Clear Flags Solid Color TargetTexture 'seat' Created some quads and aligned them so I can see the textured side. Gave the quads a new material 'seat'. I've gone through many of the settings in the Material and other places changed many things here and there such as 'transparent' or 'cutout' and lots of the other settings but cannot get rid of the magenta color in the seating textures I created. Also tried making that color alpha 0 but it had no effect. And tried various colors as transparent (magenta, white, black). Am I doing this completely wrong? Hopefully I am just missing some small setting. Ideally somewhere I can just set the magenta color to mean transparent pixels. Really do need help here honestly have been trying very hard to achieve this alone but not getting anywhere fast.


Every Item is colliding but 1 In my game I have a BULLET, MOONS, STARS, and A SHIP. I shoot bullets from the ship and hit stars or moons and collisions occur. Yet when a moon runs into my ship there is no detection even though I set the a Collider for 2D on both of them. void OnCollisionEnter2D (Collision2D col) Debug.Log (this.transform.tag) moon hit ship not printing Debug.Log (col.transform.tag) only bullet hit moons and stars Heres a quick snippet https i.gyazo.com acc0bbf5d2aab994db3a6598bfd206aa.mp4


Google play services error DEBUG Application is pausing, which disconnects the RTMP client I am having this issue from past day with Google Play Services amp Unity. What happens is, when I install app directly ot device via Unity, the Google Play Services work fine but when I upload it as beta to play store console and install it via that then it starts to give " DEBUG Application is pausing, which disconnects the RTMP client" error. I have a proper SHA1 key.


NullReferenceException when importing model This error most certainly is not caused by an error in my Script. I don't know where it came from, I don't know why it's here and I don't understand what problems it causes because everything seems to work just fine. But I've been getting this error for quite a while now every single time I run the Game Engine


How to limit my scoreboard to 100 top Score then adding the number list? so I want to make 100 top scorers on my leaderboard but I don't know how to make a number list, what I mean is when the user is top 1 so number list 1 and so on so here the leaderboard script public IEnumerator LoadScoreboardData() var DBTask DBreference.Child( quot users quot ).OrderByChild( quot highscore quot ).LimitToLast(100).GetValueAsync() yield return new WaitUntil(predicate () gt DBTask.IsCompleted) if (DBTask.Exception ! null) Debug.LogWarning(message quot Failed to register task with DBTask.Exception quot ) else Data has been retrieved DataSnapshot snapshot DBTask.Result Destroy any existing scoreboard elements foreach (Transform child in MainMenuUI.instance.scoreboardContent.transform) Destroy(child.gameObject) Loop through every users UID foreach (DataSnapshot childSnapshot in snapshot.Children.Reverse lt DataSnapshot gt ()) string username childSnapshot.Child( quot username quot ).Value.ToString() int highscore int.Parse(childSnapshot.Child( quot highscore quot ).Value.ToString()) Instantiate new scoreboard elements GameObject scoreboardElement Instantiate( MainMenuUI.instance.scoreElement, MainMenuUI.instance.scoreboardContent) scoreboardElement.GetComponent lt ScoreElementContent gt ().NewScoreElement(username, highscore) Go to scoreboard screen MainMenuUI.instance.leaderboardPanel.SetActive(true) as you can see there is no number list just order by highest score.


Everything is set to Bounciness 0 Why am I still bouncing? I am creating a platformer where rather than manipulating the character to get them from the beginning of the level to the end, you manipulate the world. Thus, when you want to make the character 'jump' over a gap, you actually use the land like a slingshot and 'fling' them. This is all working well and good save for one thing whenever I pull my land down and my player falls into it again, it begins to bounce aggressively so! I have made EVERYTHING out of a new physics material with 0 bounce, and I set my default physics to 0 bounce. My player is a rigidbody2D that is moving itself along on top of other rigid bodies. What gives? Why, even though EVERYTHING is set to 'no bouncing allowed' does my game turn into a bouncy house whenever i start to play? EDIT Here is a video of the behavior FlingyJump Bouncing Issues EDIT I have noticed a correlation to the bounce occurring and the spring being active. It have noticed that two things are happening 1) The spring is for some reason transferring force through to the ground piece while being stretched out. 2) The player is bouncing before even ever hitting the ground. I don't know quite how that is possible but it seems like as soon as it is enters the original position of the rigidbody2D for the ground piece it bounces.


How to destroy object after animation I've made an object and when the player has pick it up, rise it up and stop it out of screen. But because you can see the shadow of that object, I will destroy it after the animation has played. But how can I do this whit Unity and C ? Just destroy is just like this Destroy(gameobject) and start an animation like this private Animator anim global variable anim GetComponent lt Animator gt () in start() methode anim.SetTrigger("Picked") in other methode


Can't interact with anything in UI canvas, although it was working previously I'm working on a menu with several buttons and input fields. For a while everything was working fine, but suddenly every button and input field is not reacting to being clicked on, as if everything's been disabled. This problem is only occurring in one of my scenes. My canvas has a graphic raycaster and my buttons have methods attached to them.


How do I calculate a line segment that is a certain number of degrees from another line segment? I have a line segment that is at an arbitrary angle in 3D space. I want to (in code) draw another line that shares an end point with the first line and has an angle of arbitrary degrees between them. The second line will partially overlap the first in the XZ plane.


Animated lighting in amusement parks What is the best way to handle animated lights on rides in a night time amusement park scene? Is there a better way that doing lots of emission lights? At the moment I have been using emission lights, but there could be a lot of them in a park (some are just static lights) and I would also like to animate some of them on some rides. Best example I could find was from GTA 5 Video https youtu.be zVj8D0lqgl4?t 146


Does Animator.SetBool take precedence over Animator.SetTrigger in Unity's Animator? I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In my code, when the shift key is pressed I call anim.SetTrigger("Dash"), if a Walk key is pressed, I set anim.SetBool("Idle") to false and begin increasing MoveX. The problem I'm noticing is that when I play, and hit the dash button, it first starts walking and then after playing that animation it will then perform the dash animation. Looking in the animator as this is happening, it's clear that the walk animation plays in full before moving to the dash animation. What can I do to give priority to the Dash animation when that button is pressed?


How to apply a script to multiple Objects in Unity? In Unity, I've almost 200 or more objects. I wish to apply single script to all those objects. I'm a beginner amp learning scripts in Unity. Edit At the time of editing the scene itself.


Deleting fewest Navmesh Obstacles when no valid path is found So I'm building a Tower Defence, with mazing (i.e. the player can place towers to make the mobs take a longer route to there destination.) I'm using Unity's Navmesh system. Each Enemy unit has a Navmesh Agent component. And each Tower has a Navmesh Obstacle component. The Path finding is working Perfectly. However (as expected) when the play completely blocks off all routes to the Agent's Destination, the agent simply moves to the spot closest to the destination that it can get to and sits there. What i need, is to detect when that happens... Some kindof NoValidRoute() or something, I haven't been able to dig anything up in the Unity documentation or from google Searches. Once i have that, I need to determin which Navmesh Obstacles need to be destroyed to open the shortest route possible with the fewest number of Obstacles destroyed. (i.e. if a path can be opened with only 1 tower destroyed which tower would give me the shortest route.) I'm finding a serious lack of any information on this subject.. as far as i can tell no one has even tried to do this, or asked for help doing something like this. (at least not with Unity's Nevmesh.) I think A is a little(and by little i Mean LOTS) outside of my skill to implement at present. Thanks In advance


Why does Unity heavily blur edges of a single cube despite 8x antialisaing I was messing around a random project and everything was working perfectly, when all of a sudden jagged edges appeared on all objects. I've been trying to resolve this issue for the past two dails, only to no avail. I have tried changing various settings, when at last I've uninstalled unity and removed all projects. After re installing it, however, the problem still persists What I've tried changing settings in Nvidia Control Panel (for example, settingantialisaing mode to application controlled) changing the Quality settings inside Unity removing any normal texture maps changing metallic and smooothness of the material and removing specular highlights reinstalling Unity These pictures depict current settings object properties Properties of material added to the cube Camera properties Quality settings Graphics settings


How to create a high score in Unity from a Time.deltatime float? When I play my game, it sets my score to 0 and does not change, no matter how high my float gets. using System.Collections using System.Collections.Generic using UnityEngine using UnityEngine.UI public class highscore MonoBehaviour public Text Highscore void Start () Highscore.text PlayerPrefs.GetFloat ("Highscore", 0).ToString() This is where the next page starts using UnityEngine using UnityEngine.UI public class Score MonoBehaviour public Text ScoreText public float playerScore 0 void Update () playerScore Time.deltaTime 10 ScoreText.text playerScore.ToString("0") private void OnCollisionEnter (Collision collisionInfo) if (collisionInfo.collider.tag "Obstacle") PlayerPrefs.SetFloat ("Highscore", playerScore)


How to handle data for a competitive multiplayer games I am kinda new to Multiplayer Games and I am really wondering how I should handle my data Should each player send and update their data to the database (server) everytime one of their essential variables changes (like health or ingame currencies), or should they save the data as long as the game is running and then update the data all at once at the end of, lets say, each round? I was thinking about using Firebase and Unity and here's a scenario Let's say 2 players connect to a game. Then one of them gets damage and the other one gets gold. Does the data change get sent to the FireBase Database immediatly or should I just update everything when the round ends they disconnect?


Rendering Problems(Artifacts, Flickering) with the Mirage Solo VR Headset Im getting some strange flickering artifacts when testing on device (Mirage solo), this problem occurs on Unity 2018.3.2 and Unity 2019.1.2. Its not happening on other devices such as the OculusGo, Google Pixel, Samsung s7,s9. It seems to be only occuring on devices that use Qualcomm Adreno 540 GPU. Has anyone else encountered anything like this if so, did you fix it and how? The Environment is using a custom shader, the robot character is simply using a unity standard shader and there is a hologram at the side(right) which is using a custom shader. Hardware Snapdragon 835 SoC Qualcomm Adreno 540 GPU Video https streamable.com Screenshots Bad Good


Bright lights produce strange artifacts on Android I'm testing lighting on Android and I'm getting strange artifacts when the light is increased. I'm not sure if this is normal with Unity or a setting somewhere is unchecked. The only light in my scene is a spot light. I have to increase the brightness of it so that it illuminates everything in the scene properly. On Windows 10 (in the editor), it displays just fine. You can turn the brightness up all day long and everything will just appear whiter. On Android, however, once you reach a certain threshold (a really low threshold), the colors turn to an abrupt magenta, then dark cyan, and eventually black. Because I'm using a spot light, these colors appear as a radial gradient. Here's what I've tried so far Turning the brightness down. Unfortunately, I have to decrease it a lot to avoid the artifacts meaning my scene doesn't get illuminated in the way that I need it to be. Changing Lightmapper from Enlighten to Progressive in the Lighting window. But what I think this actually indicates is compression and so is unrelated. Not specifying a Skybox material and using Custom environment reflections. Tweaking Graphic settings for each tier (I have double checked HDR is enabled both here and on the camera present in each scene). Switching to Linear color space (I was originally using Gamma). The idea was maybe the color space was too small so really, really bright colors couldn't be represented however, it is my understanding that Gamma is much larger than Linear so I'm admittedly confused. I have Googled this issue quite a bit and all I get are issues with emissive materials not emitting light and other unrelated light issues. Here is what my scene looks like when a spot light faces a rectangular mesh. When the threshold is exceed initially, it looks like this If you continue to increase the Intensity, it eventually looks like this Of course, the exact colors you see vary based on the actual color of the mesh being illuminated. In the pictures above, the mesh is supposed to be a medium dark green. Could this be a color space issue? Perhaps a device limitation? My device isn't exactly a super computer, but it isn't bottom grade either.


How to create an Editor class for a generic class For all my MonoBehaviour scripts, instead of them inheriting from MonoBehaviour they inherit from a generic class like so public abstract class MonoBase lt T gt MonoBehaviour where T MonoBase lt T gt public class Example MonoBase lt Example gt Now, I would like to make an editor script for all those MonoBase classes, and the closest I have gotten to a solution that will compile is CustomEditor(typeof(MonoBase lt gt )) public class MonoBaseEditor lt T gt Editor where T MonoBase lt T gt public override void OnInspectorGUI() this.DrawDefaultInspector() MonoBase lt T gt myScript (MonoBase lt T gt )this.target if (GUILayout.Button("Build Object")) But of course it doesn't really work. Am I missing something or is there really no way to make a generic editor class like it's mentioned in an answer here.


Implementing a lexicon for a word based game with C or C In my game project I have a lot of word existance checks based on some word bank. As usual arrays or map set are not realy appropriate for this due to their speed memory usage, I want to use Ternary Search Tree. After some googling I've realised that there's not so much info or code ready to use there. So I want to implement it myself. Question is can I write it in C and then export to Unity with cross platform support? To be more precise will I be able to use this cpp library on Android and iOS? Or maybe I should just write it in C which, I believe, will be slightly less efficient?


UI Text Won't Change Color in Unity 5 In Unity 5 on Windows 10, I try to change the text color from the Inspector and in scripts, but the color won't change. Here are some screenshots of my Text objects open in the inspector, with there colors set to red and white, but staying the default black in the Scene and Game windows Here are the lines of code I am using to change the color var textColor beatBestTime ? " FF0" "FFF" scoreText.text "Time " FormatTime (timeElapsed) " n lt color " textColor " gt Best " FormatTime (bestTime) " lt color gt " which I can verify are being run, but the color remains the same!


Unity LWRP alternatives for camera stacking I am working on upgrading a project in unity from a 2018 version to the latest 2019. One of the mechanics of the game is an AR (augmented reality) system. Some of the UI elements appear in the 3D world, but clearly as part of the hud. They need to be transformed as the camera moves, but should always be drawn on top of the 3d scene. The old project achieved this via camera stacking. All the AR elements were drawn on a different camera which rendered on top of the 3D camera. The clear flags were set to "depth only" and it removed all other elements from that camera. In the 2019 version of Unity with the Lightweight Render Pipeline (LWRP), the clear flags feature on the camera is missing. To the best of my research, camera stacking has been removed from LWRP. What are my alternatives? How can I now achieve this effect? I would like to stick to LWRP as I am using Shader Graph for many of the effects in the game.


New Unity version copies the settings of previous version I use Ubuntu 20.04. When I download a new version of Unity 3D through Unity Hub, this new version automatically takes the settings of the previous version. I have installed Unity 2020.1, and I am facing the same problem. I created a new project, but it written in 2020.1 that I used preview package. I didn't even installed any package in Unity 2020.1. I did install preview package in 2019.4. But I didn't even open the project with 2020.1. I only have one project with 2020.1. The new project I just created. I asking help because I faced this issue when I first installed 2019.1, 2019.2, etc. How can I flx it? Thanks


In Unity3D, how can I improve image clarity? The same images that appear clearly in Adobe Flash appear blurry in Unity. My game uses quads, cubes and sprites. I've tried the game on Android, iPhone, Mac and PC, but the image appears poor quality on all of them. A sample screenshot What can I do about this?


How do I ensure my Android build is not darker than in Editor? My scene on the Android Build looks much darker. Based on my research about the topic, and from the texture of the light on the spheres, I assume it is because the light uses per vertex render mode on Andriod. I am trying to force per pixel render on Android, these are the things I have tried set the Rendering to Important of the Light on the scene (There is only 1 directional) check the values of my RenderPipeline asset (the one came with the LWRP Template project), the Main light is Per Pixel, Additional Light (which doesn't seem to matter) is also Per Pixel set the Preset Light's Render type to Important in the Preset Manager I will have infinite levels, the map changes dynamically, so Baking the light is not an option. Can I achieve this somehow? Or at least force my editor to use per pixel so I can light up my scene more intuitively.


How can I access a script variable from another script in Unity? I'm creating a space shooter (think Space Invaders or Galaga) where the GameManager persists between scenes but the player and enemies don't. I need to access a boolean value from the player and enemies to define when and how the game should end. The PlayerController script contains a playerDead variable (attached to the Player GameObject) to tell the GameManager if the player has died and a enemiesDead variable to tell if all enemies have died. Because the GameManager persists but the others don't, it loses the references when a new level is loaded. I tried to have the GameManager find the script references dynamically, to no avail. It always errors with Object reference not set to an instance of an object when a new level is loaded. I've tried to get them with GameObject.FindGameObjectWithTag() and then using GetComponent lt ScriptName gt () to get the script and the variable in it. It compiles nicely and everything seems dandy, but then there's still no object reference. Am I just doing it wrong? So how can I reference a script and get a value from it without even touching the Inspector? EDIT Below is some code (everything else except the essential is scrapped) from the GameManager script, I tried to use Object.FindObjectsOfType() like this GameObject player GameObject enemies void Awake() DontDestroyOnLoad (gameObject) void Start () Reinitialize () void Update () if (enemies.GetComponent lt EnemyGrid gt ().enemiesDead true) gameEnd true if (player.GetComponent lt PlayerController gt ().playerDead true) gameEnd true void Reinitialize() player Object.FindObjectOfType(typeof(PlayerController)) as GameObject enemies Object.FindObjectOfType (typeof(EnemyGrid)) as GameObject But there's still no object reference. My intention was to run the Reinitialize() funtion each time a new scene was loaded, so that way the GameManager would grab the new objects each time.


OnMouseUpAsButton not always called I'm working on a 2D implementation of Free Cell in Unity 4.6.1, and I'm having trouble getting my click detection code working consistently. The code below should be called every time a card is clicked (they all have BoxCollider2D components) but it doesn't always happen. Handle Clicks on Card void OnMouseUpAsButton() print ("test") int cardLayerMask LayerMask.GetMask("Cards") RaycastHit2D hit Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, cardLayerMask) print ("Hit length " hit.Length.ToString()) if (hit.Length gt 0) print ("Hit") Even the "Test" print statement doesn't get called consistently, so it's not a problem with the raycast. If it manages to print the test, the raycast always works. Each time the game runs, the cards get dealt onto the playing field randomly into stacks. On each run, some subset of the cards don't call the above code. The number of cards that work correctly varies, as does their position on the field. It's not consistent with any particular card. I'm wondering if maybe there's an issue with the BoxCollider2D instances overlapping. The other colliders in the scene, like the one on the "table", always trigger OnMouseUpAsButton() successfully. I need to be able to register clicks on every card, so I need to find a way to make this work. Have any of you run into a similar issue before? If not, is there a way for me to work around this? Maybe a different way to detect the clicks on the cards? Here's a screenshot of an example card from the inspector. Aside from transform position amp script property values, all of them are identical (from a prefab) Update w Solution from Accepted Answer Using Byte56's solution, I was able to take care of this pretty easily. I've included sample code below. Note that to get the sample to work, the "top" object has to have the highest transform.position.z out of all the objects the raycast hits. I also put all the possible hit objects into their own layers so I can trigger different behavior based on what type of object is clicked. Handle clicks if (Input.GetMouseButtonDown(0)) Cast a ray, get everything it hits RaycastHit2D hit Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity) if (hit.Length gt 0) Grab the top hit GameObject GameObject lastHitObject hit hit.Length 1 .collider.gameObject Determine layer of last hit object, take next steps as appropriate switch (LayerMask.LayerToName(lastHitObject.layer)) case "Cards" print ("Hit card!") break case "Table" print ("Hit Table!") break case "Cells" print ("Hit cell!") break


How can i do a "Crouch" with only a Character Controller with no rigidbody? I was following Bracky's fps tutorial but he didn't add crouching as an option. I took a stab at it but came up empty handed. Here is my script for player movement. public class PlayerMovment MonoBehaviour public CharacterController controller public float speed 12f public float gravity 9.81f public float jumpHeight 3f public Transform groundCheck public float groundDistance 0.4f public LayerMask groundMask Vector3 velocity bool isGrounded Update is called once per frame void Update() isGrounded Physics.CheckSphere(groundCheck.position, groundDistance, groundMask) if(isGrounded amp amp velocity.y lt 0) velocity.y 2f float x Input.GetAxis( quot Horizontal quot ) float z Input.GetAxis( quot Vertical quot ) Vector3 move transform.right x transform.forward z controller.Move(move speed Time.deltaTime) if(Input.GetButtonDown( quot Jump quot ) amp amp isGrounded) velocity.y Mathf.Sqrt(jumpHeight 2f gravity) velocity.y gravity Time.deltaTime controller.Move(velocity Time.deltaTime) And also have a separate script for mouselook, here that is aswell. public class Mouselook MonoBehaviour public float mouseSensitivity 100f public Transform playerBody float xRotation 0f Start is called before the first frame update void Start() Cursor.lockState CursorLockMode.Locked Update is called once per frame void Update() float mouseX Input.GetAxis( quot Mouse X quot ) mouseSensitivity Time.deltaTime float mouseY Input.GetAxis( quot Mouse Y quot ) mouseSensitivity Time.deltaTime xRotation mouseY xRotation Mathf.Clamp(xRotation, 90f, 90f) transform.localRotation Quaternion.Euler(xRotation, 0f, 0f) playerBody.Rotate(Vector3.up mouseX) How would I go about adding one without adding a rigidbody or changing my script fully to follow other tutorials? Thank you!


What are some ways to make a scene without walls and infinite terrain visually appealing? My Player Character is standing in the middle on flat infinite terrain. The player can see as far as the farplane of the camera. And there is nothing there which is... boring. I wanted to Plant a couple of trees which move with the player (but not rotate with them). But I would need tons of trees for that, and that would destroy performance. Next I've thought about a "foggy shadow", or a light or a cubemap with textures of things. But those things are visually totally ugly. Now I am in front of a hard decision and I dont know what to do. Here are examples of infinite terrain so you guys know what I mean.


How to create video from camera? I have a 3d scene and a camera I want to create video file from camera pre set movements. If it is possible, running application by command line (without needed to "show" at video, my camera) . Is it possible in Unity ? If yes what's the best approach ? Thanks


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?


FBX animation works in 3DSMax but not with Assimp I have an FBX file that represent a plane with an animation of the gear opening. In my editor 3DSMax or in the Unity editor, the file and animation seem good, but when I use Open 3D Model(the official viewer of Assimp) or when I call the FBX file simply in an application, to see what the file will look like with the use of Assimp, I got some issues. The object seems normal at the beginning, but when I try to launch the animation, all my animated elements are going crazy. Here's what it looks like Here's my FBX FILE Do you have experience something similar ? Does it come from my file or a parameter in Assimp ? I am beginning to think that there is a problem with how Assimp handles pivot points, looks like objects are rotating using a different pivot point in Unity open3mod.


How can the board fit the screen perfectly in Unity's 2D Roguelike tutorial? I follow the tutorial 2D Roguelike tutorial. I want to understand how happen that 10x10 board of 32x32 sprites covers screen perfectly? Like what does this depend on?


How do I fix the "Failed to recompile android resource files." build issue? I've tried similar solutions I found on this website, nothing worked. There are thee errors that pop up... been banging my head for quite a while now, please help! Also note I updated my JDK using the download link (next to the browse option in the external preferences). Then linked it to this file, which I am lead to believe is the correct file. C Program Files Java jdk 9 Failed to compile resources with the following parameters bootclasspath "C NVPACK android sdk windows platforms android 24 android.jar" d "C Users Dylan Desktop ContentCreater Repo DoodlePlanes DoodlePlanes DoodlePlanes Temp StagingArea bin classes" source 1.6 target 1.6 encoding UTF 8 "com android vending billing R.java" "com SoloDeveloperStudio DoodlePlane R.java" "com unity purchasing R.java" "com unity purchasing googleplay R.java" warning options source value 1.6 is obsolete and will be removed in a future release warning options target value 1.6 is obsolete and will be removed in a future release warning options To suppress warnings about obsolete options, use Xlint options. 3 warnings UnityEditor.HostView OnGUI() UnityException Resource compilation failed! Failed to recompile android resource files. See the Console for details. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message) UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuildPointToConsole (System.String title, System.String message) UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args) UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C buildslave unity build Editor Mono BuildPipeline PostprocessBuildPlayer.cs 263) UnityEditor.HostView OnGUI() UnityEditor.BuildPlayerWindow BuildMethodException Build failed with errors. at UnityEditor.BuildPlayerWindow DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) 0x001b9 in C buildslave unity build Editor Mono BuildPlayerWindowBuildMethods.cs 162 at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) 0x00050 in C buildslave unity build Editor Mono BuildPlayerWindowBuildMethods.cs 83 UnityEditor.HostView OnGUI()


Make non sprite render in front of sprite How do I make the non sprite (BasicSpellProjectile) render in front of the sprite (Tower 2)? Note The camera is located at z 10. The z positioning apparently doesn't do anything, and I am unable to set the sorting layer order of the non sprite as there isn't one such option.


GameObject remains null for some reason The idea is to access the function BlockWasDestroyed() from Combo class. Instead of var combo gameObject.GetComponent(Combo) I've also tried with var combo GetComponent(Combo) var combo Combo gameObject.GetComponent(Combo) var combo Combo GetComponent(Combo) But the console keeps telling it's null. However it could work when the function was static, but thing is now that function is calling another function, and so the errors happen once again. Here's my code so far Brick.js pragma strict public class Brick extends MonoBehaviour function OnCollisionEnter(col Collision) if(col.gameObject.name quot Ball quot ) var ballb gameObject.GetComponent(BouncingBall) var combo gameObject.GetComponent(Combo) combo.BlockWasDestroyed() ballb.velocityZ ballb.velocityZ 1 Score.score 20 Destroy(this.gameObject)


Rotating projectile in direction it is moving I am using a parabola curve to launch my arrows public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t) Func lt float, float gt f x gt 4 height x x 4 height x var mid Vector3.Lerp(start, end, t) return new Vector3(mid.x, f(t) Mathf.Lerp(start.y, end.y, t), mid.z) I have a projectile that is a simple capsule scaled down to be long and thin like an arrow. I've tried every way to rotate it I could find online, but there is always something off. In order to follow the curve I need the direction between the last position and the new position, so I have been trying things like void ParabolaMovement() Called in Update() parabolaAnim Time.deltaTime parabolaAnim parabolaAnim 5 Vector3 newPos MathParabola.Parabola(start, target, 5f, parabolaAnim 5) Vector3 dir newPos transform.position transform.LookAt(dir) transform.position newPos As for what is going wrong, it does not point AT the target, which I udnerstand it can't because nowhere do I specify target pos, which I should, but don't know where. I cannot simply tell it to lookat target, since I want it to lookat the direction it is currently going in the curve, but it also needs to face the target.


Does animation have internal "update" cycle where I can make calculations between steps? I am new to Unity and not game developer at all, so sorry if this question might be stupid. I have an animation in my project. Is there some points where Unity calculates recalculates the next position of animated character? Is there some function like for example quot OnAnimationSample() quot ? I want to make calculations between theese points. I didn't found anything in the documentation and hope that someone more experienced than me know some way to tackle, although the task is quite peculiar. I am programming a simulation environment for robots. There is a need to take screenshots at certain events happening by means of raycasting (gathering img data for CNN). The robot has various physical specification like for example speed. I don't want the environment depends on speed of the robot, so I am planning to make calculations and screenshots constatly for example in between two animation quot milestones quot . That will slow fps and overall game down, but I don't mind since I need only right data at right step. For example suppose there are exist such points in the Unity, when before taking any movement the Unity calculates the next state of the object being animated. I want to stuff my calculation and such, that next animation step won't start until all is done. I hope that explained not so tricky. Say if the explanation is obscure I will try my best again.


How can i scale a cube on one side on x only? I have in the Hierarchy a empty GameObject and a cube as child of it. The cube the child is at position 0,0,0 and scale 1,1,1 But when running the game the scaling is on both sides of the cube. I put the cube as child of the empty gameobject and scaling the empty gameobject but still it's scaling the cube on both sides. The script is attached to the empty GameObject using System.Collections using System.Collections.Generic using UnityEngine public class Walls MonoBehaviour Vector3 originalScale Vector3 destinationScale void Start() originalScale transform.localScale destinationScale new Vector3(100.0f, 0, 0) private void Update() if (transform.localScale.x ! 100.0f) transform.localScale new Vector3(1, 0, 0) This is a working solution using System.Collections using System.Collections.Generic using UnityEngine public class Walls MonoBehaviour public Transform objectstoScale private void Update() if (objectstoScale 0 .localScale.x ! 100.0f) objectstoScale 0 .localScale new Vector3(1, 0, 0) But i want to make that the same cube will also scale one side on the z. So the cube will be scaled on both x and z but without filling it one be like frames. So i tried this using System.Collections using System.Collections.Generic using UnityEngine public class Walls MonoBehaviour public Transform objectstoScale private void Update() if (objectstoScale 0 .localScale.x ! 100.0f) objectstoScale 0 .localScale new Vector3(1, 0, 0) objectstoScale 1 .localScale new Vector3(0, 0, 1) And i have now two cubes childs of the empty gameobject one cube position is 0.5,0,0 the second is 0,0,0.5 but what i'm getting is What i want to do is to create automatic a rectangle scaling a cube on 4 sides at the same time not filled rectangle. For example like this


Why am I getting a down arrow in my Unity scene when using Oculus Rift and how do I get rid of it? In Unity, I have set up a scene to try out in Oculus Rift. When I hit play in Unity, everything works fine until about 5 seconds later when I get an arrow (Assets OVR Textures out.png) that appears in the center of my screen and won't go away. What does this arrow mean and how can I get rid of it? It is obstructing my view of the level that I am trying to view.


Chess engine stock fish process for mobile I am making the chess interface I designed for a game. I am using the process to get answers from a stock fish binary stockfish new Process StartInfo new ProcessStartInfo FileName System.IO.Directory.GetCurrentDirectory () " Assets Scripts Stockfish stockfish.exe", Arguments "", UseShellExecute false, RedirectStandardOutput true, RedirectStandardInput true, RedirectStandardError true, CreateNoWindow true The problem I face is it worked for my Windows build but for mobile package build it won't work with the executable. Is there a way around it?


How to design context menus based on whatever the object is? I'm looking for a solution for a "Right Click Options" behaviour. Basically any and every item in a game, when right clicked, can display a set of options based on whatever the object is. Right click examples for different scenarios Inventory Helmet shows options (Equip, Use, Drop, Description) Bank Helmet shows options (Take 1, Take X, Take All, Description) Floor Helmet shows options (Take, Walk Here, Description) Obviously each option somehow points to a certain method that does what is says. This is part of the issue I'm trying to figure out. With so many potention options for a single item, how would I have my classes designed in such a way as to not be extremely messy? I've thought about inheritance but that could be really long winded and the chain could be huge. I've thought about using interfaces, but this would probably restrict me a little as I wouldn't be able to load item data from an Xml file and place it into a generic "Item" class. I'm basing my desired end result on a game called Runescape. Every object can be right clicked in the game and depending on what it is, and where it is (inventory, floor, bank etc.) displays a different set of options available to the player to interact with. How would I go about achieving this? What approach should I take to first of all, decide which options SHOULD be displayed and once clicked, how to call the corresponding method. I am using C and Unity3D, but any examples provided do not have to be related to either of them as I'm after a pattern as opposed to actual code. Any help is much appreciated and if I have not been clear in my question or desired results, please post a comment and I'll tend to it ASAP. Here is what I have tried so far I've actually managed to implement a generic "Item" class that holds all of the values for different types of items (extra attack, extra defence, cost etc...). These variables get populated by data from an Xml file. I have thought about placing every single possible interaction method inside of the Item class but I think this is unbelievably messy and poor form. I've probably taken the wrong approach for implementing this kind of system by only using the one class and not sub classing to different items, but its the only way I can load the data from an Xml and store it in the class. The reason I've chose to load all my items from an Xml file is due to this game having the possibility for 40,000 items. If my math is correct, a class for each item is a lot of classes.


Can I use flat shading on a generated mesh? I tried to generate a mesh from code in Unity. The problem is, that the edges are automatically smoothed. When I import a model into Unity, I can set the smoothing angle of the edges, but is something like this possible with a generated mesh? I would like to have no smoothing at all.


How to make one material on object with many parts inside? I have a weapon witch have many parts, it also have many materials. Do I really need to make it like that? It's like about 8 mats! (


Unity Ragdoll moves away from parent So this is a weird one. I've looked it up but can't find anyone with similar issues. Basically I have a simple combat system and after the enemy health is zero I go through each rigidbody component in the enemy object and add a force to make it go flying on death. For some reason, the parent object isn't affected and stays still while the Skeleton goes flying. Does anybody know how to make the parent object follow the skeleton, or make the skeleton follow the parent because as of now they act as separate entities? I've tried just adding force to the parent but that only moves the parent object and none of the children. Would appreciate any advice! Thanks.


Unity 5.5.1f1 new UI system Button in scrollview is not working on Android. Is this known issue? Is there a workaround? It works perfectly in the editor, but on Android it only sometimes registers an OnClick when I press it with my finger. I'm on Unity 5.5.1f1 Is this a known issue? I'll post some videos of it if no one has seen this before. The scrollview is based on the default one from the Create UI scrollview menu Ive added a vertical layout group to it, to which I add prefabs that contain buttons. These are the buttons that are not working. The canvas is in front of the camera in worldspace and is scaled down to 0.02 in X and Y VVVVVVVVVVV UPDATE VVVVVVVVVVVVV I wrote my own workaround using 2D colliders instead of buttons The colliders are registering hits just fine. But when I wrote a class to not register hits if the scrollview moves, I get similar behaviour! Heres the crude little workaround class I wrote.. public class ScrollButton MonoBehaviour public StoreItem Item bool FingerDownOnMe public void BeOnClicked() VisualDebuggerRef.SetTxt("a store button" " " Random.Range(0, 10000)) FingerDownOnMe true This is called on all these objects whenever the scrollview moves public void ScrollviewMoved() FingerDownOnMe false void Update() 'UppedthisFrame' will be true whenever any touchs phase TouchPhase.Ended if (Refs.man.Clickdetect.UppedthisFrame amp amp FingerDownOnMe) FingerDownOnMe false Item.ButtonHit() I'm guessing Unities UI classes work in a somewhat similar way to my workaround one. The problem is that the scrollview is registering as being moved when it should not be. This may be because of my test device which is an S7. Maybe the touch resolution is so high it is registering movement that is smaller than one pixel?? Also maybe the fact the the entire canvas has been scaled down could be affecting this? Say Unities classes have a distance threshold, if they are not taking into account scale then working on a scaled down canvas might make the distances they are using too big, so the threshold is reached too easily Im going to add a distance limit to my workaround... VVVVVVVVVVVVV UPDATE2 VVVVVVVVVVVVVVVV This workaround code using colliders works perfectly.. public class ScrollButton MonoBehaviour const float scrollThreshold 0.25f public StoreItem Item bool FingerDownOnMe Vector3 HitPos public void BeOnClicked() VisualDebuggerRef.SetTxt("a store button" " " Random.Range(0, 10000)) FingerDownOnMe true HitPos transform.position void Update() 'UppedthisFrame' will be true whenever any touchs phase TouchPhase.Ended if (Refs.man.Clickdetect.UppedthisFrame) if (FingerDownOnMe amp amp Mathf.Abs((transform.position HitPos).y) lt scrollThreshold) Item.ButtonHit() FingerDownOnMe false I'm going to report this issue as a bug to Unity


Editor throwing NullReferenceException I have the following exception being thrown at compile time NullReferenceException Object reference not set to an instance of an object UnityEditor.Graphs.Edge.WakeUp () (at C buildslave unity build Editor Graphs UnityEditor.Graphs Edge.cs 114) UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List 1 T inEdges, System.Collections.Generic.List 1 T ok, System.Collections.Generic.List 1 T error, System.Boolean inEdgesUsedToBeValid) (at C buildslave unity build Editor Graphs UnityEditor.Graphs Graph.cs 387) UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C buildslave unity build Editor Graphs UnityEditor.Graphs Graph.cs 286) UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C buildslave unity build Editor Graphs UnityEditor.Graphs Graph.cs 272) UnityEditor.Graphs.Graph.WakeUp () (at C buildslave unity build Editor Graphs UnityEditor.Graphs Graph.cs 250) UnityEditor.Graphs.Graph.OnEnable () (at C buildslave unity build Editor Graphs UnityEditor.Graphs Graph.cs 245) I know well enough what a NullReferenceException is and what causes one, but the stack trace above implies that it's being thrown by the editor or some other internal thing. Does anyone have any advice on how to debug this?


How to put labels at a specific point on any resolution I am working on a project in Unity 4.6.1 and I put the label at the top But when I put the Scene in full view this happened I made a Development Build and when I select my resolution (1366x768) the label goes behind the buttons. Is there any way to put the label at a specific point no matter what resolution?


Automated performance testing I'm wondering if there's anyway of automatically testing the performance of my game on multiple configurations because I know a game runs well on my computer but how do I know how well my game performs over a variety of hardware? Do I just simply have to rely on player feedback?


How to have random and different colors on multiple objects with one material? I want to have one material applied to multiple objects that has a random color on each object. How can I achieve this so that I don't need to use a different material for every object? This is in Unity 5 by the way.


Applying a torque to a different centre of mass In Unity I have an object with a circle collider attached to it and when I apply a torque to this object's rigidbody2D, it rotates as expected. However, I have now attached a sub object to this object with a polygon (trigger) collider which I am using to detect when something is in a cone in front of the ship. There is no rigid body (2D or 3D) attached to the child object. The only rigid body on the object is the one I am applying torque to. However, when I do this, the centre of mass of the ship is moved to the centre of this collider, which produces totally the wrong effect. This happens even if I move this collider to the root node (so both it and the circle collider are attached). I either need a way of getting the rigid body to ignore the child collider allow me to set the centre of gravity, or else some other way of detecting objects inside a region.


How to run Unity in "headless" mode? I need to run my game without graphics and user input (headless mode). I googled it but I actually couldn't find a solution, except something like this using UnityEngine using System.Collections using UnityEditor public class a MonoBehaviour public static void BeforeBuild() EditorUserBuildSettings.enableHeadlessMode true Unfortunately, this doesn't work for me as it seems to work only on Linux. Am I forced to run my instance on Linux? I would be really thankful if anyone could help me!