#VS Code Unity Extension Problem
1 messages · Page 1 of 1 (latest)
@haughty dust i didn't even notice this tiny little thing
i had to squint really hard 🤣
💪 thats the new stuff
it still asking you about multiple solutions?
nope
ok , and you reneged project files before opening?
oh
- did u delete all the .proj and the sln files
- did u regen or open thru Unity
- are you sure ur vseditor plug-in is updated to 2.0... in the package manager
also double check VSCode editor package is removed from Package Manager
^ yea, that too
that could cause issues lockin on
yes, and i re-opened vs code and this is in the output
imma do it again
isnt this correct now?
well at least its not complaining about sdk being missing
it should be working if it says loadeded
same thing again
no solution explorer tab in the explorer window?
also did you check if VSC editor package was in package manager in unity?
progress, it's there now
open yes
😐 lol
i restarted it, still doesn't work
what are we trying to do.. was it just his explorer being wrong?
no underlines
wdym restarted
does it show the files?
it doesn't do any unity stuff, not just underlines
re-opened
do you not have the same solution explorer?
still have it
and the solution is still open
what
show
ok were getting somewhere
expand assembly
find yout script in Assets
double click it
check bottom bar while anything is loading
this is the only thing that changed, this line went from light blue to this greenish-blue
hover it.. does it tell u anything?
if it shows rigidbody then your good
where is context box
intellicode
this appears while i'm typing
good
thats b/c its now actively picking up errors
and this is technically an error.. b/c its not complete
i should write some type of blogpost for this lol
i think it just needed it refresh a couple of times or the old sln was bust
better than when sdk is missing
a PC restart probably woulda cut off some time
so now, it's time to actually fix the error
my PC takes 20 mins to restart
ah, nvm then
i have a hhd, so it makes sense
oof
hhd < ssd < nvme
ik
white-noise machine
i have a 1 TB hhd
big boi
ya, i have a pile of SSDs that have died over the years
BIG PILE
my HDD is my saving grace
they are more prone to digital degradation
the thing is, how did you use 2 TB
esp with frequent access
assets my friend
im an asset junkie
also i have a 2 TB not a 1 TB hhd
some of my files are 100GB
my unity projects just keep stacking
ya, ive been seeing alot of ppl have scenes larger than 100gb
thats insane to me
i cant even.. must be some big ole environments i guess
how does tarkov handle that? or is that not that big
not even sure what the biggest map in unity is thats hd
cities skylines 😉
is it?
iono.. but its a pretty big map.. but i think that game is scaled down
just feels like its just scaled down tiny
yup
doing it in blender might save a lot of storage for that
w/ a mod called 81 tiles.. u can use every single tile in the game..
i think default they lock u into 9 or so
what kind of GPU handles that
how
idk.. they have some crazy optimizations in that game ¯_(ツ)_/¯
and they keep alot of it hush hush
my PC freezes up when I open discord
once I reach 1million population my shit starts dying
my PC is at 90% memory as we speak
i have 16 gigs
same
hdd and ram for me
but, my brother is the one who got this
he got a pre-built
gotta do what u gotta do
yup
why does it give me an error tho
hover over it
hover over the second error
well u dont assign it like that
it tells you you cannot use access modifiers inside a method
how then
public Transform play1;
public Transform play2;
public Transform play3;
public Transform[] characters;```
the first three not needed btw, thats why i suggested array
{
charcters = new Transform[] {play1, play2, play2};
}```
like that i think
but yea.. u can just assign them in the inspector
no need to declare them seperately
player1 would be characters[0], player 2 would be characters[1], and soo on
this is also probably the code before the method
yes just call it players[] avoid confusion
so what do i change
idk what you wrote before it
send the entire script https://gdl.space
is that what ur trying to do? like a list of players u can loop thru.. checking their distance.. and soo on
using a for loop would loop thru the collection of Transform[] characters
this is all sorts of wrong
why
you closed class early
wdym
because you initilized an array wrong , its reading the } from it as closing the entire class
messing up the rest
also the way its written in start is wrong because you never put access modifiers inside methods
oh
so what do i change
why not assign em like this
do this ^
since they're gameobjects anyway
altho u coulld do it like this..
but thats weird
also if you wrote it as
public Transform player1; public Transform player2; public Transform player3;
Transform[] players = new Transform[3] { player1, player2, player3 };
it would've worked but no sense in doing that at all
but because they were Gameobjects it makes no sense, its trying to fit spheres inside a square hole
hmm what happens when u leave the new [] blank?
ok i did it
array need a length when new afaik
since they are fixed
im let loop it
no more errors
oh you mean if already initilize it with 3 ?
ohh thought you meant in the initilizer
this doesn't give errors
public Transform player1;
public Transform player2;
public Transform player3;
[SerializeField] Transform[] players;
void Awake()
{
Transform[] players = new Transform[3] { player1, player2, player3 };
}
sorry
all good my brain farted
but yea.. i dont necessarily even have to drop in 3 elements.. the {x, y, z} thingy just makes it work
magic 🪄
that should do it
now u have players(0->2);
i removed the 3 btw
you're assinging it to a local array
it will not affect the original array
remove awake entirely, and just assign in inspector
ohh yea remove the Transform[] part of the awake/start
u just need to assign the players
players = new Transform..
^ and you dont need public Transform player1; public Transform player2; public Transform player3; anymore
array is literally a collection of players
assign em via the inspector in other words
and dnt worry about setting them in code
(dynamic)
i got errors when i removed it
b.c u didnt assign em in the inspector probably
because you have to remove awake too
you're prob still trying to new() an array with player1,2,3
this is literally all you need
until u go to access them in code
ok before removing do this
put them back
click the player one and do Rename
then rename them all to player[0], player[1], player[2]
and do for all 3
then remove
only thing to keep in mind is collections/arrays are 0 index
wdym by do Rename
so player1 is player[0]
ye i saw that right after i posted it, and i fixed it
that too
do you have places where you wrote player1 ,player2 et.?
like outside this script
yes, but they are not related to these ones
this is my code rn (bc i'm getting kinda confused)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemies : MonoBehaviour
{
public int enemy_health = 100;
public string nearest_player = "Player1";
private int random_number = Random.Range(0, 3);
public Transform player1;
public Transform player2;
public Transform player3;
[SerializeField] Transform[] players;
void Awake()
{
players = new Transform[] { player1, player2, player3 };
}
void Start()
{
}
void Update()
{
if (enemy_health <= 0)
{
Destroy(gameObject);
}
}
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Bullet")
{
enemy_health -= 10;
}
}
Transform GetNearestPlayer(Vector3 point)
{
Transform nearestPlayer = null;
float minDistance = Mathf.Infinity;
foreach (Transform player in players)
{
float distance = Vector3.Distance(point, player.position);
if (distance < minDistance)
{
minDistance = distance;
nearestPlayer = player;
}
}
return nearestPlayer;
}
}
you did like nothing of what we told you the past 20 mins
i kept asking you wdym by do Rename and you didn't respond
right click it . n rename
but if you said you're not referencing it anywehre else dont worry then
delete them
and remove the awake()?
heres ur code... identical from when i copied from paste-bin
and yes you need to remove the start and awake
since they're empty
but this line is having errors because player1 and player2 and player3 don't exist
players = new Transform[] { player1, player2, player3 };
really...
what do i replace player1, player2, and player3 with
i did
you add them via the inspector
do you want me to remove the players = new Transform[] { player1, player2, player3 }; line too?
ok
then player1 becomes players[0]
i removed awake, not the thing that was in it
did you just delete Awwake () wuithout deleting the entire codelock
that wouldnt have even compiled
thats a classic.. 🫣
you have to start doing a bit of c# crashcourse
learn what a method definition is etc
anatomy of a script
important
i was a just a bit confused on what you wanted me to do
but anyways, now there are no more errors
lemme test if that works
yes but dont blindly follow , try to understand why you're doing something if you don't, ask
it works
my strategy is follow, and understand after it works

