Unity with VS Code: .sln generated is missing assemblies. Only .sln generated by Studio works (with Code as well)

After every Unity update I have a lot of problem with missing assemblies in Visual Studio Code.

The type or namespace name "UI" does not exist in the namespace "UnityEngine" 

But after some messing around, somehow it always becomes fixed. I updated Unity again and now after wasting hours I decided to do it the right way and find out the source of the problem.

As it turns out the problem is simply that the .sln generated when the external editor is VS Code is just simply missing a lot of assemblies: (and its icon is VS10 instead of VS15) enter image description here

Here’s the full difference: Link

If I switch the external editor to VS Studio and click Regenerate Project Files, the .sln is now full of assemblies. (if I would just switch to it, it wouldn’t touch the sln)

So now I switch back to VS Code, voilá it works because the assemblies are in the .sln.

BUT for some reason if I restart Unity the .sln is always regenarated because possibly it detects that it has been generated by VS Studio while the current editor is VS Code.

So it’s missing the assemblies every time I restart Unity.

Now at least I know that every time I launch Unity,

  1. I have to switch to VS Studio,
  2. click Regenerate Project Files,
  3. and then switch to VS Code.

But before the update it was fine. It’s always like this and then somehow it becomes fixed automatically at startups as well.

What’s causing this, how could I fix it? Thanks in advance!

Slight bug with Footprint Studio

When I add a new engine .ini file to the Engines directory it will not show up in the Footprint Studio ‘Engine’ dropdown list until SER is restarted, whereas with all other functions (eg identify platform and sort in, or selecting where to submit from the edit screen) SER will recognise the new .ini file straight away. Nothing major but just annoying, for me at least ;)

Raycasting in GameMaker Studio 2 to implement hitscan weapons?

I’m working on a 2D top-down shooter game in GameMaker Studio 2, featuring different weapons and obstacles all around the levels.

Since I don’t need a high degree of simulation, I’m implementing simple physics for character movement and interaction (e.g. weapons, bullets, doors…) myself via GML rather than using the dedicated physics library.

Currently, shooting works as follows:

  • The player presses the Left Mouse Button.
  • A bullet object spawns, according to the current weapon.
  • The bullet starts moving towards the mouse position at a given velocity.

Right now, the gameplay works quite well. However, I wanted to create different weapons with unique features, including different bullet speeds. And here’s my problem.

I tried to increase bullet velocity values, but they started behaving strangely: When shooting against objects, hits occur slightly before visual contact. Sometimes, bullets ‘warp’ beyond small objects or corners as if a collision hasn’t been detected at all.

There are two schematics, one for the general case:

Desired vs current behaviour 1

And one for the collision with thin objects:

Desired vs current behaviour 2

I think this is due to my code checking for collisions for given positions rather than sweeping along the expected motion trajectory. And, this doesn’t work well with laser weapons and sniper rifles, since players expect them to be precise when shooting.

My initial implementation was the following:

Create Event:

b_damage = 25; b_velocity = 100; b_direction = point_direction(x, y, mouse_x, mouse_y); 

Step Event:

var _xvel = lengthdir_x(b_velocity, b_direction); var _yvel = lengthdir_y(b_velocity, b_direction);  var _coll = instance_place(x + _xvel, y + _yvel, obj_CollisionParent);  if ( _coll == noone ) {     // No collision occurred, bullet can travel     x += _xvel;     y += _yvel; } else {     // Destroy bullet (shows sparks)     instance_destroy();     // Deal damage if an enemy was hit     if ( _coll.object_index == obj_Enemy )     {         scr_DealDamage(_coll, b_damage);     } } 

I then tried to increase precision by subdividing the collision check into smaller steps:

Step Event:

var _xvel = lengthdir_x(b_velocity, b_direction); var _yvel = lengthdir_y(b_velocity, b_direction);  var _coll; var _steps = 10;  for (var i = 0; i < _steps; i++) {     _coll = instance_place(x + _xvel/_steps, y + _yvel/_steps, obj_CollisionParent);      if ( _coll == noone )     {         // No collision occurred, bullet can travel for 1/_steps distance         x += _xvel / _steps;         y += _yvel / _steps;     }     else     {         // Destroy bullet (shows sparks)         instance_destroy();         // Deal damage if an enemy was hit         if ( _coll.object_index == obj_Enemy )         {             scr_DealDamage(_coll, b_damage);         }     } } 

Now, collision is more precise, yet it’s far from perfect. I still cannot use high velocity values without increasing the number of _steps. Also, 100 collision checks per step for dozens of bullets seem too much for my CPU. I would like to improve this aspect of my game.

I would like to use a raycast-like function, similar to Unity’s Physics.Raycast. I need to find the final impact position with a low computational effort so that I can make bullets travel instantly, draw impact particles at the right position, and show realistic bullet trails.

Why the UI text value is changing take affect only when returning back to the visual studio window and than back to the editor?

My guess is because I’m using OnValidate but is there another way to try to accomplish what I’m trying ?

The goal is use the drawn circle in one script information and use this information in another script.

For example the GameObject the draw circle script is attached to I want to get the Y position of that GameObject and assign the value to the other script specific variable in both Editor and Runtime modes.

This script draw a circle in this case around my player and I attached this script to a empty GameObject child of my player so I can change the circle height by changing the GameObject Y position :

using UnityEngine; using System.Collections; using System;  [ExecuteAlways] [RequireComponent(typeof(LineRenderer))] public class DrawRadiusAroundObject : MonoBehaviour {     [Range(1, 50)] public int segments = 50;     [Range(1, 5)] public float xRadius = 5;     [Range(1, 5)] public float yRadius = 5;     [Range(0.1f, 5f)] public float width = 0.1f;     public bool controlBothXradiusYradius = false;     public bool draw = true;      [SerializeField] private LineRenderer line;      private void Start()     {         if (!line) line = GetComponent<LineRenderer>();          CreatePoints();     }      //private void Update()     //{     //         //}      public void CreatePoints()     {         line.enabled = true;         line.widthMultiplier = width;         line.useWorldSpace = false;         line.widthMultiplier = width;         line.positionCount = segments + 1;          float x;         float y;          var angle = 20f;         var points = new Vector3[segments + 1];         for (int i = 0; i < segments + 1; i++)         {             x = Mathf.Sin(Mathf.Deg2Rad * angle) * xRadius;             y = Mathf.Cos(Mathf.Deg2Rad * angle) * yRadius;              points[i] = new Vector3(x, 0f, y);              angle += (380f / segments);         }          // it's way more efficient to do this in one go!         line.SetPositions(points);     }  #if UNITY_EDITOR     private float prevXRadius, prevYRadius;     private int prevSegments;     private float prevWidth;      private void OnValidate()     {         // Can't set up our line if the user hasn't connected it yet.         if (!line) line = GetComponent<LineRenderer>();         if (!line) return;          if (!draw)         {             // instead simply disable the component             line.enabled = false;         }         else         {             // Otherwise re-enable the component             // This will simply re-use the previously created points             line.enabled = true;              if (xRadius != prevXRadius || yRadius != prevYRadius || segments != prevSegments || width != prevWidth)             {                 CreatePoints();                  // Cache our most recently used values.                 prevXRadius = xRadius;                 prevYRadius = yRadius;                 prevSegments = segments;                 prevWidth = width;             }              if (controlBothXradiusYradius)             {                 yRadius = xRadius;             }         }     } #endif } 

The object with the drawn circle :

Drawn circle around the player

And this script is making an object the Target child to rotate around my player. I want by using the drawn circle information to set the rotating variables.

using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;  [ExecuteAlways] public class SimpleRotate : MonoBehaviour {     public List<TextMeshProUGUI> uiText = new List<TextMeshProUGUI>();      public DrawRadiusAroundObject drawAround;      // Add this script to Cube(2)     [Header("Add your turret")]     public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.      [Header("The axis by which it will rotate around")]     public Vector3 axis;//by which axis it will rotate. x,y or z.      [Header("Angle covered per update")]     public float angle; //or the speed of rotation.      public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;      private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;       // Update is called once per frame     void Update()     {         //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update          transform.RotateAround(Turret.transform.position, axis.normalized, angle);         time += Time.deltaTime;         //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay          if (time > delay)         {             prevHeight = height;             height = Random.Range(lowerLimit, upperLimit);             time = 0;         }         //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)           transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);          uiText[0].text = angle.ToString();         uiText[1].text = upperLimit.ToString();         uiText[2].text = lowerLimit.ToString();         uiText[3].text = delay.ToString();          upperLimit = drawAround.transform.position.y;     } } 

The object with the script that make Target object child to rotate around my player

Target is the basketball.

The basketball rotating around my player.

For example I tried to set the object Y position value on the Upper Limit variable in the SimpleRotate script.

Everything is getting update find in editor mode and runtime mode except the ui text.

First of all I’m not sure using [ExecuteAlways] in both scripts is the right way and second because I’m using OnValidate in the script that draw the circle the affecting on the variable upper limit is taking affect only when I validate by changing windows in the editor mode.

Batch update to replace special characters in SQL Studio Management

I am trying to remove/correct some special characters in my database that show strange behaviour when exported.

Specifically & and the apostrophe

I ran a query to find the values that contain the special characters, and while the query succeed at finding them, I still cannot replace/remove them with the second query UPDATE (nothing happens):

SELECT  [Loc1],[IND_KEY] FROM [Database].[dbo].[List] WHERE CONVERT(VARCHAR(MAX), Loc1)LIKE'%[&]%';  UPDATE [Database].[dbo].[List] SET  Loc1 = REPLACE(CAST(Loc1 as nVarchar(4000)), '[&]','and') WHERE Loc1 LIKE '%[&]%'; 

I am using Microsoft SQL Server Management Studio.

How to create metrics of specific events in Google Analytics or Data Studio?

On my site, I am firing an event when the user lands on a specific URL. I’m firing another event when the user clicks on a button on that specific page.

When I go to Analytics, I can see the Total Events + Unique events for each dimension (specific page view, button click on specific page).

How is it possible to create a new metric (I assume a calculated metric) to display the Unique Events as metrics for any dimension I’d like to use in a Table?

Here is an example of what I have now:

Event Label Total Events Unique Events
specific_page_views 100 50
specific_page_clicks 20 10

…and what I’d like to achieve:

Source Specific Unique Page Views Specific Unique Page Clicks Specific Page CTR %
(direct) 30 8 26.67
google 15 2 13.34
bing 5 0 0

I have been searching for an answer for many days now and can’t seem to find the answer to this simple question. I will want to create multiple of these Metrics, not just 2.

Is this actually possible with Google Analytics or Google Data Studio? (I’m planning to use Google Data studio)

Libgdx and Box2D with android studio: Why isn’t the ball responding to touch inputs?

public void create () { 

. . . . . Gdx.input.setInputProcessor(new PlayerControl(camera, BallBody));


        public boolean isPointOnPlayer(float x, float y){             for(Fixture fixture : BallBody.getFixtureList())                 if(fixture.testPoint(x, y)) return true;             return false;         }      public class PlayerControl extends InputAdapter {                  private Vector3 _touchPosition;          public PlayerControl(Camera camera, Body ballBody) {             _touchPosition = new Vector3();         }          @Override         public boolean touchDown(int screenX, int screenY, int pointer, int button) {             // don't forget to unproject screen coordinates to game world               camera.unproject(_touchPosition.set(screenX, screenY, 0F));             if (isPointOnPlayer(_touchPosition.x, _touchPosition.y)) {                 // touch on the player body. Do some stuff like player jumping                 BallBody.applyForce(new Vector2(0, 100f),new Vector2(0, 10f),true);                   return true;              } else                 return super.touchDown(screenX, screenY, pointer, button);         }       } 

Visual Studio Code on Linux – Privacy risk?

I’m a fan of Visual Studio, and recently installed VSC on my Linux Mint. However recently I did a deep-dive on Richard Stallman’s site reading about just how evil and depraved all the big tech companies are, including Microsoft (not that I didn’t already know that these companies are evil, I just didn’t realise the extent of their depravity).

Now I’m feeling edgy about having VSC on my machine. I’m security and privacy conscious, and use TOR browser often. I read recently that on Windows 10 machines, opening certain files through TOR browser reveals your real IP to Microsoft. This being the case, I’m wary of having microsoft software installed on my machine.

I was wondering what the risks are if I keep VSC installed on my Linux Mint 19? How can I confirm that this program is "sandboxed"? I don’t want it spying on me. What sort of information is it known to transmit to Microsoft, and what other information could it potentially be collecting without my knowledge?

Forgive me if this is a stupid question. I’m not sure how to do an independent investigation which is why I want to come here and ask the experts. If no one knows a direct answer to my question, I will still upvote pointers as to how I could investigate it independently. (I haven’t confirmed this, but knowing microsoft, VSC is closed-source, which obviously makes the job much harder)

Debugging T-Sql code using Visual Studio 2019. Error message: frame not in module

Has anyone had success using Visual Studio 2019 for debugging T-SQL code, the way SSMS allows Step-into & Step-over?

When I hit debug (Alt-F5), gives me this error, after making some progress. Looks like once it hits the section of the code that calls another procedure, it gives this error.

Frame not in module.   The current stack frame was not found in a loaded module. Source cannot be shown for this location. 


1  ..    2  ..   3  SELECT 1 FROM sys.objects   4  SELECT dbo.SomeFunction(1)   5  UPDATE TABLE SET X = 1 ....   6   

It runs well, until line 3, once it hits line 4, where it is calling a different function, it throws the aboe error. In SSMS, that line just opens a new window with code for the function and show debugging progress for each F11 step-into — but not in Visual Studio 2019 (Version 16.7.1)