#π»βcode-beginner
1 messages Β· Page 415 of 1
depends on your game
Is it the settings that caused the speed changes after landing?
its turn based so its similiar to undertale and final fantasy. heres a diagram
like maybe FlavorText when there is text in between turns or Ended when displaying like gained stats after the battle
what is a flavortext?
something like this
it really depends on what states you want
Yes. And material only applies friction on contact.
{
float scale = ChunkManager.Instance.scale;
float halfScale = scale * 0.5f;
int x = Mathf.FloorToInt((worldPosition.x + halfScale) / scale);
int y = Mathf.FloorToInt((worldPosition.y + halfScale) / scale);
int z = Mathf.FloorToInt((worldPosition.z + halfScale) / scale);
return new Vector3Int(x, y, z);
}``` I'm using this to convert my hit location to a gridposition but im getting different gridlocations back depending on which side of the voxel i'm hitting. is there something wrong with my formula or should i try subtracting the hit.normal to get a location more centered on the voxel?
ok i got know thank u very much You've been a great help. I've been struggling with this issue for a long time.lol
public enum States
{
Initialization = 0,
PlayerWait = 1,
PlayerAttack = 2,
PlayerItem = 3,
PlayerTalk = 3,
EnemyAttack = 4,
BattleWin = 5,
BattleLose = 6,
BattleDraw = 7,
}
i guess this is sufficent, right?
its the bare minimum
depends on the game
i mean this is plenty
also the = 0 etc. are unnecessary
they are assigned like that implicitly
rlly? oh ok thanks
you should only use that when you need a different order
Hello guys! Can you tell me how to make a prefab child of a gameobject without using the normal? Instantiate(prefab, parentObject);
Because I used to spawn the prefab this command
Instantiate(Resources.Load("Lvl1"), transform.position, Quaternion.identity);
var newObj = Instantiate....
newObj.parent = otherObj;```
.transform.parent perhaps?
transform,parent isnt
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
var newObj = Instantiate(Resources.Load("Lvl1"), transform.position, Quaternion.identity);
newObj.transform.parent = carpet1.transform;```
newObj is a prefab
carpet1 is a gameobject
GameObject prefab = (GameObject)Resources.Load("Lvl1");
GameObject instantiatedObject = Instantiate(prefab, transform.position, Quaternion.identity);
instantiatedObject.transform.SetParent(transform);``` is how id try it
ya Object is the basic type of Object in Unity... it doesn't have a transform
but a gameObject does
ahh yes, Resources.Load returns an Object you need to cast it to the appropriate type

aka GameObject
from these
i already knew how to set the parent by both methods... either .parent = otherGameobject.. and the SetParent() function
to these
what i wasn't aware of is that it returned an Object
once i learned that.. its easy to cast (GameObject)
same for other types of casts.. u just prefix the type in parenthesis
like u could cast a float to an int like : (int)myFloat; and that'd return an Int
soo after the reference is a gameobject it works like it alwys does π
so what I spawn is a prefab or a gameobject?
when u use Resources.Load it covers many things..(an asset)
u just have to make sure thats a gameobejct to set it as a child of another gameobject.. im not exactly sure why that is or even when i'd use Resources.Load
every prefab i can think of is a gameobject..
b/c for it to be spawned in the scene it has to be a gameobject right?
indeed
Resources.Load is designed to return a generic UnityEngine.Object because it can load various types of assets, not just GameObject instances. This allows Resources.Load to be flexible and versatile, accommodating different asset types such as textures, audio clips, materials, and prefabs. Since Resources.Load doesn't know the exact type of asset you're loading at compile time, it returns a generic Object, which you can then cast to the specific type you need.
heres an explaination ^
Thank you 
no thank you.. Today I Learned about Resources.Load b/c of you π
yessir
{
float scale = ChunkManager.Instance.scale;
float halfScale = scale * 0.5f;
// Subtract the hit normal from the hit point to get a position more centered on the voxel
Vector3 worldPosition = hit.point - hit.normal;
int x = Mathf.FloorToInt((worldPosition.x + halfScale) / scale);
int y = Mathf.FloorToInt((worldPosition.y + halfScale) / scale);
int z = Mathf.FloorToInt((worldPosition.z + halfScale) / scale);
return new Vector3Int(x, y, z);
}``` subtracting the hit.normal fixed my issue
Im still re-reading what you wrote to understand more clearly
https://gdl.space/uceyunujos.cs i have no clue why it says it is null
heres a prefab.. its a normal gameobject u can spawn it and add it as a child
Or use the generic version.
GameObject prefab = Resources.Load<GameObject>("Lvl1");
this is an Asset.. but it could be loaded using resources..
but its not technically a gameobject
so u couldn't set it to be a child of anything..
soo when u used Resources.Load (even tho u were loading a prefab) u had to implicitly tell the engine that it was a gameobject
yes this too! lol sorry I wasn't aware o Resources.Load i had to look up the docs π
@full kite u could do it this way too apparently
w/ the <GameObject> part
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
β’ Visual Studio (Installed via Unity Hub)
β’ Visual Studio (Installed manually)
β’ VS Code
β’ JetBrains Rider
β’ Other/None
configure ur IDE and u should get autocorrect / intellisense
i got all the suggestion and all works but still some arent downloaded
are u using VSCode or VSStudio?
The suggestions can be opened with
Ctrl + Shift + Space
studio
ya, studio should have all the stuff as long as u have the Unity Game Environment setup
i only get white color text but tutorial owner getting coloured sorry for broken english
already
at the top of ur IDE in the left corner above the text does it say CSharpAssemb
yea its working
or does it say Miscellaneous?
could it be because it isnt dettecting anny collider?
but urs is way more clealy
im also a c++ learner and ur code was more clearly for me cause I use the same thing in C++
well can you type in detail (what is ide)
in the top left
if u see Misc its not set up correctly.. if you see Csharp then it is
ya, thats set up π
ur probably using Transform when u should be using transform
capitalization woes π
what the hell now i have to find that Transform ?? and change it on every line
bro didnt worked
new one π
i dont know i am watching tutorial so i am following him
TYSM!
too sus!! i am thinking that you are in my pc!
nah, just common mistakes most beginners have
no no no dont lie
until they realize how important spelling and capitalization are
then it tends to happen less
ik you are in, so please make game for me π
lmfao!
lmao c ya
i been workin on my own one forever!
Wrong line, it's line 25
what?
The error is complaining about line 25
i love this discord server!! fixed β
Hello everyone. I got kind if a dumb question but how would I go about making a canvas persist across scenes. Do I need to attach a script to it with the don't destroy on load stuff or what. I'm trying to make some simple text ui and have 1 of em always persist and the other only exist in gameplay scenes.
You should have some kind of UIManager script, right? This script should be attached to Canvas and derive from the generic Singleton, you may copy [here](#archived-code-general message)
Oh ok I do have one so I need that to be a child of the canvas?
No, it has to be put directly on Canvas. DDOLs cannot have parents
ur first method was working as well
we just had to add (GameObject) to it
cause it was object and it couldnt switch from Object to GameObject
hey guys.
any idea why im getting an infinate loop?
its probably caused by the coroutine, since when i comment out the StartCoroutine and StopCoroutine methods on the lines 102 and 88, the editor hang.
it happens randomly.
ShootLogic has an infinite loop if targeting system has a target but it's not in sight
https://gdl.space/huxutatelo.cpp does someone know why it isnt detecting the enemies?
i have no clue why its ignoring them
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
sorry i wanted to get another paste bin link xD
Is it normal that in this piece of code:
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player") || other.CompareTag("Enemy"))
{
Debug.Log("triggered enter: " + other.transform.name);
player.enemyList.Add(other.transform.parent);
other.transform.parent.GetComponent<AShip>().OnDisableEvent += RemoveShipFromList;
}
}```
Even though there is only one enemy object with a box collider and rigidbody, I get "triggered enter: Ships" x 2 but only one object is added to enemyList?
how do i cap fps?
Application.targetFrameRate = target
thx
you can check if there is 2 triggers or 2 scripts
Replace your print with this:
Debug.Log($"triggered enter: {other.transform.name}; this: {name}", this);
Thanks.
Just noticed that it it picking itself too since it meets those criteria lol
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public Rigidbody rb;
public float movementSpeed = 5f;
public float rightLeftSpeed = 5f; // Adjust for desired movement speed
public CharacterController cc;
public float jumpspeed = 10f;
public Animator anim;
public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;
public bool IsGrounded;
public bool isjumping;
public float crouchHeight = 0.2f;
private void Start() {
anim = GetComponent<Animator>();
}
void Update()
{
// Forward movement (unchanged)
cc.Move(Vector3.forward * movementSpeed * Time.deltaTime);
// Left and right movement with smooth transition
if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
{
transform.Translate(Vector3.left * rightLeftSpeed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
{
transform.Translate(Vector3.right * rightLeftSpeed * Time.deltaTime);
}
if (Input.GetButtonDown("Jump") && !isjumping)
{
transform.Translate(Vector3.up* jumpspeed * Time.deltaTime);
anim.SetBool("isjumping",true);
isjumping = true;
StartCoroutine(jumping());
}
}
IEnumerator jumping() {
yield return new WaitForSeconds(0.75f);
anim.SetBool("isjumping",false);
isjumping = false;
transform.Translate(Vector3.up* -jumpspeed * Time.deltaTime);
}
private void OnCollisionEnter(Collision other) {
if (other.gameObject.CompareTag("obs"))
{
anim.SetFloat("die",3);
rightLeftSpeed = 0f;
jumpspeed = 0f;
}
}
public void FixedUpdate() {
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow)) {
cc.height = crouchHeight * Time. deltaTime;
anim.SetFloat("crouch",3);
}
}
}
@eager spindle
Is there an horizontal layout group for colliders?
it is fixed β
What do you mean
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
enough to flood chat
How can I draw a raycast/spherecast between 2 points? the documentation requires a direction and a distance, but I want to check for collision between 2 points
also it would be better if you asked more concise questions rather than "how can I improve this"
debug.drawray
spherecast no
can you use that for physics stuff?
oh you want collision between two points
yes
basically take an initial point and an end point
and check if theres something inbetween
what about direction?
difference is direction
hmm okay
ill try, thanks!
actually, how can I check what I found between those 2 points?
raycastall
hitinfo?
Hey, guys! I am dealing with a problem. So, I am currently making stairs functionality for my player, actually I am using character controller and for one reason that's happening what you see in the video. I think I don't have any colliders there and I am not sure why my player continue moving forward and doesn't getting down the stairs as he did for the upper stairs.
its most likely that you have colliders there. could you select all objects in the scene(ctrl-a) and double check?
also when moving your player are you using charactercontroller's Move or SimpleMove?
your game looks great so far btw
how can I set it so it detects triggers without setting a layermask?
queryTriggerInteraction
yes, but i also need to set a layermask for it
yes.
this is the overload you should be using
oh as in you want to skip setting a layermask
just use the default setting of layermask.all
you can use 0 << 100
as the layermask
so it selects all layers from 0 to 100
dumb solution but it works
hold on
No, 0 shifted 100 places to the left is still 0.
i just followed the tutorial why this is happening tell me
dumb solution that does not work and makes no sense
To select all layers, it would be the opposite of 0, or ~0, which happens to also be equal to -1.
do you know what , does in c#
You know I am pretty sure there is no any collider there and specifically at that layer where he continuously moving forward. What's the difference between Move and SimpleMove? I mean it could prevent my player from getting down the stairs?
simplemove takes gravity into account and also deltatime
im not sure what your gravity system looks like
something like this works? @eager spindle
RaycastHit[] hit = Physics.SphereCastAll(chargeStart, chargeRadius, distance);
foreach(RaycastHit hits in hit){
if(hits.collider.CompareTag("Enemy")){
explosion.Play();
hits.collider.GetComponent<EnemyStagger>().TakeHit(500);
}
}```
also id kind of want like a capsule, not a sphere, now that I think about it
Oh, ok. Then maybe I have to use simple move.
whats the direction of this raycast?
Vector3 distance = chargeStart - chargeEnd;
where is that distance in the spherecastall?
its set beforehand
as in where is it used
its on direction
Don't quote me please
You can just ask on this chat normally, someone will respond you
@eager spindle
I want to check if I hit anything in this line
I basically want to check all that space
why does capsulecast have a direction variable if theres already a start and end point
learn c# before you start
itll help you understand a lot more
π tho i cant bcz i wanna learn make games not to learn C#
god I need gizmos for this
theres visual scripting actually
where is courses in my language or eng doesnt matter
urdu/eng
hindi definitely has
π«‘
well i got ashamed...
we all start somewhere
!learn and, btw, you cannot learn to make games with Unity if you do not learn C#, so the advice you were given is totally correct
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
it also detects the player but its okay
erm acktually unity has visual scripting
altho itd be fun to see what the fuck its even doing
but yea c# is very important if you want to get anywhere
just check tags ez
cuz idk what the capsulecast looks like
thats what I do yeah
@eager spindle tysm for the help :))
i still dont get why capsulecast requires a direction but yeah
Think of them as thick raycasts
yes, that makes sense
but if I set a start and end point
which should create the "edge"
then why do I need a direction
if you have 2 points, and you draw a line between them, then isnt the direction already evident?
like maybe you can change if it does from a to b or from b to a
isnt this what capsulecast does?
take the 2 points, draw a line between them, and then thicken it using the radius?
i beg please kindly tell me only this why this is happening
Because you have a syntax error
Look at the bit underlined in red (by the IDE, not by you) and fix it
that pechkus?
I have no idea what that means. But start at the top of the script and fix the red underlined things one at a time
screwdriver i clicked that now
listen
send code on private
You should only ever call CharacterController.Move one time per update per character controller
You should have one script handling both movement and jumping
If you try to do it multiple times, they will conflict with each other and mess up things like collision detection and ground checking
My guess is they're going to try to rope you in to spoonfeeding them the solution to their typo
Anyone know of a way to clear all subscriptions to an event such as this one?
researchButton.clicked += () => ResearchTech(tech);
If it's an actual C# event and not a UnityEvent, I believe you can just set it to null
researchButton.clicked = null?
Yes. That'll cause all the existing events to get garbage collected so it's not as good as everything unsubscribing itself when it is no longer necessary, but if you're doing it during something like a scene transition, the extra memory overhead won't matter much
Just don't clear it like, every frame, and you should be fine
Alright, ill try it out, thanks π
Cant set it to null it seems
Ah, you can't clear it from outside of the class. Events are weird, they're kind of both private and public. You'd need to do it in whatever class researchButton is
You can't assign it because action is not mutable
You can make a public function that sets it to null and call that function
Can anybody help me with smthing? I got a prefab that its a child of a gameobject that has a pivot. He is anchored in a place. When I switch my resolution, the prefab is also moving in the screen. Why s that?
Button is a ui toolkit class
Are you talking about UI ?
Ah, then you're probably not going to be able to modify it.
nope
You might need to keep track of the functions you add and remove them one by one
Read the error
You can't have two things with the same name
I want to do a forward definition of my coroutine tho
Is that just this:
researchButton.clicked += () => ResearchTech(tech);
then
researchButton.clicked -= () => ResearchTech(tech);
?
So name it something else
no, you cannot unsubscribe anonymous methods
No, you'd need to make that function into a "real" function,
private void Research(){
ResearchTech(tech);
}
Then you'd do
researchButton.clicked += Research;
researchButton.clicked -= Research;
What's the right way to set collision detection in 2d objects?
It will allow it to compile
It will do quite a bit of good actually
How do i make a forward definition of my coroutine then
I have a 2d collider on each of my game objects with scripts in them implementing public void OnCollisionEnter2D(UnityEngine.Collision2D collision)
I have no idea what you mean by this or why the name of the variable would matter
nothing happens
Real function?
I want my script to know theres a coroutine before I implement the functionality of it
Like I showed, an actual function with a definition, rather than an anonymous function that you lose a handle to once the function ends
Okay but why does that mean the variable needs to have the same name
call it literally anything else
Do you have a rifusbody
rifusbody?
I believe he means rigidbody
Oh
I don't think so
Sooo then how would the script know the coroutine im referring to if its named a different way
Because you tell it to
You are the one who assigns a value to the variable
Ohhh i see ok
thanks
That's what = does. It tells the code what value the variable has
Looking back it seems you are trying to get OnCollision working?
It requires a rigidbody. So if you do not have one, it will not work
Gotcha
Here is a troubleshooting guide
https://unity.huh.how/physics-messages
So I got a problem. I got a prefab that is anchored that is a child of another gameobject that is anchored and has a pivot in order to let that prefab to move. Even with all of those, when switching the resolution, he s still moving. Why s that?
is there a way to make the variable name in a script different from the one in the inspector
You could use a custom inspector but it's usually better to just pick better names
custom inspector doesnt seem that hard
Sure but "Just pick a better name" is even easier
does anyone have a Fps movement wsad normal speed and jump etc and also mouse movement script.
Yup Google
Did you fix the spelling and punctuation errors in your script?
quick question, is there any way of "stopping/breaking" a for loop if certain conditions are met?
break;
ty!
i give up bcz of no idea i dont even know ","in C#
Then stop working with unity until you do both of these
https://www.w3schools.com/cs/index.php
And then
https://learn.unity.com/pathways
i dont want to learn C# i want to make games and C# is used for others work
Then stop trying to use c# and just do the part you want to do, and be prepared to pay a lot of money for the programmer
But you should probably take the couple hours to learn c#
well treat me like a beginner because you should tell me why to learn C# and why to use it to make games
we are
I just did
You've been given some great starting resources
that you should definitely look at if you're a beginner
you all means that learning C# will also guide me to make any kind of code like wsad moving etc when i press jump button so player plays that animation of jump etc..??
If you intend to make games in Unity you will need to learn C#. Full stop. That's not really negotiable. Even if you hire a programmer, chances are you're going to have to make changes to their code at some point
I should tell you why to learn c#?
Because you need to in order to use unity....
C# is the programming language unity uses. You will be writing C# code when you write any functionality whatsoever in unity
just stop crying and try using chatgpt, it can give you any type of wasd movement script
Absolutely the fuck not
If you want to run you first need to learn to walk
I'm not debugging spam machine output from someone who doesn't know the difference between a comma and a period
nah bro i should learn and it gives too much error so i cant use it
yes we have to gain knowledge and work on codes well too silly
Yes and if you take that knowledge from chatgpt it will be meh at best and absolutely wrong at worst
Absolutely wrong on average*
@glass aurora already replies like a bot
Just stop. No need to insult people...
I have encountered chatgpt being usefull exactly once when i had a build error nobody had a clue how to solve it and after 2h of googling i decided, whatever might aswell ask it and it told me to delete and recreate a file that finally helped. Out of the around 10 other times i tried this I got no useful answers π
Im here to answer questions and no one asks anything, just blames chatgpt.
is it necessary to download this well i already downloaded the development with unity
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
β’ Visual Studio (Installed via Unity Hub)
β’ Visual Studio (Installed manually)
β’ VS Code
β’ JetBrains Rider
β’ Other/None
nah tell me here!
read the manual
just code online
okay so i am learning C# from W3SCHOOL it says that download this so what to do
If you want help learning general C# you should follow the W3school tutorial and join the C# discord server
Are you blind. This is the most active channel on the server, people constantly ask questions. Only complaints about gpt are when lazy people just say use gpt.
Just gonna block you.
No
Step 1 is learning to follow instructions
I suggest learning C# from here
https://learn.microsoft.com/en-us/collections/yz26f8y64n7k07
um Okay so they are saying that download the first one to learn C# but you are saying that follow instruction
I don't see any active coding questions atm.
everyones using chatgpt i guess π
They both are basically the same thing
hey please just tell me which website i should select for C# to make games
That question doesn't make sense honestly
C# is c#
check the pins on teh channel ^
Hey, so I'm trying to make a game work on Android and I have a code like that:
var pressed =
#if UNITY_ANDROID && !UNITY_EDITOR
Touchscreen.current.primaryTouch.IsPressed()
#else
Mouse.current.leftButton.isPressed
#endif
|| _isClickAltPressed;
if (pressed)
{
var mousePos =
#if UNITY_ANDROID && !UNITY_EDITOR
Touchscreen.current.primaryTouch.position.ReadValue();
#else
Mouse.current.position.ReadValue();
#endif
But somehow when I build things doesn't work at all, would anyone please know why?
put logs
From command line?
yes
How can I see the logs on Android?
Yes
also not a code question
How
Run the exe using the command line
I'm noob pls help
is ur Active Input Handling setting in the Player Settings set to Input System Package.. or Both
It's set to the new one
can i watch this?? or waste of time
and it just doesn't work at all on mobile?
nothings wasteful
yes or no
more exposure == more better
its only a waste of time if you dont learn anything
spoke broken eng
nothing is a form of no
these long format videos are horrid though
Stuff like menu that just use buttons work but the code I sent where I try to access it from code doesn't
how do i learn
just stop procrastinating and dive in
apply your brain to it
theres been tons of resources linked
You were already linked some learning resources
and theres pins at the top
Anybody here more experienced in unity i want to make simple 2d games can anyone teach me
where
the pins at the top
!learn
:teacher: Unity Learn β
Over 750 hours of free live and on-demand learning content for all levels of experience!
Ya but learning alone is very boring
inviting you...
sure I charge 25$/hr
And no one in my home is interested in games
uh oh samee
meh, i find it easier to learn by myself.. less distractions
i think i got a partner..
Either attach your phone to your PC and build it to the device directly or use the unity phone streaming (not sure if that is still a thing)
I'll try to use the first option thanks
yea the menu works b/c of the event system component.. its a little different than the rest
in the build options should be an option on what device to start it
oh and make sure USB debugging is on on the device
for sure
robbing urself
hehe special learners discount * limited time only
ahh that trial experience π
Also to your general problem, if you want to keep it simple you can enable touch using mouse events and then just using those, if you want a more elegant solution go for the input system, but thats a major refactor warning right there π
he's already half-way there w/ the new input system
altho he's using it like polling and current? stuff
Oh yeah thought for a second its the old one
learn c#, not unity c# first
where and how to
i showed you where
https://learn.microsoft.com/en-us/collections/yz26f8y64n7k07
^^ this one is the best one imo
the screenshot you posted above, the 4h youtube video is very good
Are you trolling?
how do i find Vector3 vel?
(vel is rotated by angle degrease along the right vector)
this?
am not
If you want to really dive into c# yes
https://www.youtube.com/watch?v=_cCGBMmMOFw&list=PLFt_AvWsXl0fnA91TcmkRyhhixX9CO3Lw&ab_channel=SebastianLague
this helped me when i first learning.. think of it as a crash course.. then once u get a feel for it move onto to something else
Welcome to this introduction to game development. We'll be starting from the beginning, so no prior knowledge of programming or the Unity game engine is required.
Unity can be downloaded here: http://unity3d.com/get-unity
Watch episode 01: https://youtu.be/9iCnjdXEfMA
If you'd like to support these videos, you can make a recurring monthly don...
its a bit tamer and starts w/ fundamental conversational type info
not big Sebastian Lague fan for these
what is bit tamer and w/fundamental conversationol type info
watch 20 or 30 seconds of it and find out
aok
You can rotate any vector by doing Quaternion * Vector (only in this order, vector * quaternion does not work)
its an entire playlist starts small and works it way up to making ur own prototype /game
You are underselling yourself.
its not a replacement for unity learn and the documentation.. but it helps wrap ur head around whats happening
Doesnt look like it is rotated along right vector. The axis seems to be the cross product of right and forward
ahha too kind!
its *intro pricing
so you watched the full playlist
2 years ago yes
well its supposed to be going into the air.
spawn puts in the effort 
moderate effort
but honestly the microsoft one is the best c# because its just you and the console/compiler
no bs UI and other distractions
$25/h is entry level, like the kind of i know nothing and need a teacher level, if you can do more than creating a pong/tetris demo double it (for freelancing atleast) π
do you suggest me to watch it full as a beginner ?
^ yea.. like i said.. its not a replacement.. but its a solid foundation
yes
try to work along side of it when he starts getting into the engine parts
but the first few are just going over parameters/variables/methods/classes
at this point im entertaining all offers, I got laid off and still working at a restaurant 
all the basic stuff u need to know about
i'll trade my roofing job
roofing in july . RIP
Hey, same problem here, i have 3.5y of professional experience + around 400m downloads on google play and its still hard to find a job in games rn, looking at offers around 75k⬠in europe right now
so something like this?
yeah much harder to find anything in game development , the traditional software jobs are "easier"
shit I'm willing to take that at this point in the market 
yeah im looking at frontend dev as a fallback atm, which i did before gamedev
yeah though those are mostly senior jobs
nah not another backend, im freelancing a backend gig rn and dont wanna do more in that area
lmao i dont blame u brother
you use frontend in c#/.net or another framework ?
bruh i cant understand anything
dk if i can post this here or in #archived-game-design but basically im making a turn based battle system and every enemy has its own special attack pattern so should i just:
jam it all into one script
or make seperate scripts for each enemy or
make a script called EnemyAttacks
I can use either React or Vue, so typescript based
if nothings making sense then brute-force it...
follow an entire tutorial Flappy Birds/ Angry Birds clone
and then return
Should probably watch more than 3 minutes
basically my language is hindi/urdu
I'm trying to run OnRoomListUpdate, but it says that entering the lobby in ConnectToServer makes it not work, where should I put OnRoomListUpdate? this's on Photon
ouch.. sucks to have a language barrier
Was my answer not good enough?
πΏ
ahh nice.. TS and JS are nightmares for me, I'm stuck with whatever .net gives. Blazor aint bad though if you combine with nice css library like Tailwind
Ah ouch
im looking for a variety of answers, is that against the rules?
oh a language barrier instead of a tech barrier? search on youtube if you can find something in your language, maybe there is a good tutorial guy out there
let me research
Typescript comes closer to c# than you think if you use the OOP stuff
And yes im prepared to be beheaded for that statement
yep but i want detailed english
I mean, it does make sense haha.
It's not. But, maybe, you can point out [your first question](#archived-code-general message), so that people may be able to correct my response too?
It can use tailwind? π Okay maybe I am tempted to try it out at some point. The web app usage of it made be wary of it for general sites though, but I've never used it sooooo haha
oh ok π thanks
i mean tailwind is just a styling library, anything that translates to valid HTML can in theory use tailwind
do it! it's fun , I know a few good C# devs are kinda sleeping on this
thats whats amazing about Blazor since its web you can combine it with any frontend you want, even react. So yeah any css library works, boostrap(default template), tailwind and "mudblazor" (specific blazor utility library)
wait so it's a front-end that can also use react?
How does that work? Is it like a weird layer on top of what they provide for you to use
blazor basically is a backend that can handle any frontend with Razor files which are essentially C# + HTML/JS files
but it says it is a front-end π€
oh maybe i'm confusing what a backend is ?
i just found out you can use c# to build web apps.. like last week
isnt that awful?
you can certainly use it to write backend, because thats how i'm using databases n whatnot
Like NextJS is a backend framework that uses React as the frontend, but I am not sure what Blazor does if it seems to be both (?)
yes blazor is similiar to nextjs basically
Ah I see
in the MS MVC concept, Blazor is basically the V part
why do you think microsoft is pushing typescript (and in parts react)? π
backend c# is fine, everybody i know that used c# in the frontend was like "never again"
here is a blazor login im doing for a unity cloud account
made with tailwind
Client APIs are endpoints that allow you to access Unity Services as a Unity project user. These endpoints are called inside the project after
the syntax is basically html with c#
well that is basically vue at that point xD
css especially with a preprocessor like scss got pretty good, html can go and dig itself a hole somwhere π
scss has eluded me for now.. but i havent had really a reason to dive into css again for now
π€
with web you have no choice though
i use inline css >8)
I mean thats why i use utility css like tailwind
so i write 0 css
i literally just copy and paste it
but whats the deposit on learning that?
wdym
no wonder you hate it π next you tell me you write all your unity code in one file and wonder why you hate it π
like how much time invested in learning that to utilize it
to save urself from writing css containers all day
not much at all. All i do is say, Ok I want a dropdown
copy and paste it works lol
tailwind and other utility css usually have premade components you can use , you write no code if you don't want to
I just switch up the items to actually c# array items etc
im trolling just a tad lol
i ofc use external css
yea bad workflow now-adays innit?
# listButton
# listButton:Hovered
# list-Button_darkmode
etcc.
nah thats still normal if you dont have tailwind, but we might be a bit far offtopic here right now π
true lol bringing it back to unity.. so um yeah using front end to login players of UGS via website
ya, im u-turning.. but thanks imma look into these libraries mentioned
thanks for the heads-up
interesting.
whats UGS ?
ohh ofc ofc.. that any good?
its ..getting there..
figured as much
still lackluster on the web side
got a good dashboard?
yea
welp thats enough for me to try it
speaking of react I think its actually react
better than finding a place to host my own
dont you use the Asset Store publisher pagge ?
ohh i like react
mmhmm is it similar?
the UI is the same
ahh gotcha
they finally give cloud save their own section woot
whats the speeds like?
speeds of what?
like data transfer.. no wait times or nothing negative?
pretty quick so far
nice.. im not a fan of ur dark reader π
I only tried Leaderboards and cloud saving
yeah I rather not get flashbanged though
i wish there were better ones out there
i ran mine for a while and had to toggle it off all the time b/c some sites were unreadible
darkmode on cloud actually is decent
I just have dark reader on by defualt
the edges are more defined. But yeah it works well. The Leaderboards is good too, I mainly use it because its authentication already built into unity games
yes ^ thats a 110% improvement
yea, i think imma try out some leaderboards soon
im not going multiplayer.. but leaderboards would be coo.l
working on a quick video on Leaderboards rn
link me when ur done.. ill use ur implementation π
sure thing! I'm going to show both Anonymous login and Username/pass for auth a user
the theme I use on the microsoft docs xD
and he doesnt wanna get flashbanged
wdym you never used High Constast on windows XP ?
lmao.. no...
god I uused to feel real hax0r
ya, i turned my parents cellphones on high contrast
but its been calmed down a bit
omg myb im steering this into titanic size offtopic
or you scared them away with the offtopic π
perfect time to post a ? tbh.. u got 4/5 just itching to answer something
*give me questions now! *
Why? ||
||
imma get some work done.. i'll have questions as soon as i run into my first wall of the day
touche
@rocky canyon You can save it for #1180170818983051344
@rich adder @rocky canyon Take it to DMs next time
{
Vector3Int positionToCheck = GetNeighbourPosition(cell, direction);
if (ChunkManager.Instance.IsValidGridPosition(positionToCheck))
{
if (CellIsEmpty(positionToCheck) && !newFluidCells.Contains(positionToCheck))
{
Vector3Int positionBelow = GetNeighbourPosition(positionToCheck, Direction.Down);
while (ChunkManager.Instance.IsValidGridPosition(positionBelow) && CellIsEmpty(positionBelow))
{
positionToCheck = positionBelow;
positionBelow = GetNeighbourPosition(positionToCheck, Direction.Down);
}
MakeWaterTile(positionToCheck, newFluidCells);``` what am i missing in my logic here? i want water tiles to only be made on the lowest tile at their neighbours xz coordinate. but it keeps spreading horizontally
yes! apologies
Break it down with debugging more and see what exactly is being executed. And in which order.
What does GetNeighbourPosition do?
{
switch (direction)
{
case Direction.North: return new Vector3Int(gridPosition.x, gridPosition.y, gridPosition.z + 1);
case Direction.East: return new Vector3Int(gridPosition.x + 1, gridPosition.y, gridPosition.z);
case Direction.South: return new Vector3Int(gridPosition.x, gridPosition.y, gridPosition.z - 1);
case Direction.West: return new Vector3Int(gridPosition.x - 1, gridPosition.y, gridPosition.z);
case Direction.Up: return new Vector3Int(gridPosition.x, gridPosition.y + 1, gridPosition.z);
case Direction.Down: return new Vector3Int(gridPosition.x, gridPosition.y - 1, gridPosition.z);
default: return gridPosition;```
Maybe while (ChunkManager.Instance.IsValidGridPosition(positionBelow) && CellIsEmpty(positionBelow)) is not always running and then it places a water tile at the original position, instead of the lower one? π€
from what i can see the lowest one always gets placed
Don't guess, debug it.
i set up a debugger breakpoint after 5 loops but other than the gridpositions i cant find much. im also very new to using the debugger
Hello, Ive been working on a problem for a day now, I have to lerp the object using physics or it wont move the object correctly, the problem is, it doesnt "stick" once its done lerping. It seems to keep lerping once i pick it up endlessly.
Sometimes more visual debugging is easier. You can place a gizmo on the coordinate where current block is placed temporarily, then break point will halt it on that moment and you'll see current placed object. Or change color of it really temporarily and put break at that moment.
You can even just print out coordinates in the log of the current element placed, then you'll know their order.
Their order should tell you how the code executed and why extra blocks are placed.
If you are overriding physics with animation you should make it kinematic for duration and also might have to zero out any momentum it had when switching back to dynamic physics.
I have it swapping through kinematic when it needs, so its not fighting physics or jittery
btw
Vector3 lerpingPos = Vector3.Lerp(transform.position, placePoint.position, Time.deltaTime * lerpSpeed);
https://unity.huh.how/lerp/wrong-lerp
it seems as if it has a second lerp on top of the tray lerp
Yes i heard that, so it doesnt ever really reach 0 right?
yea it wont ever reach exact value and it varies on diff fps
something to look into for sure later on
I tried jerryrigging it to do < 0.001f but it just kept doing it but at a greater cuttoff range. Im guessing MoveTowards needs to be used in tandum with it
yeah , I usually use Coroutines for these lerps, or if i need a quickfix in update or something use
1 - Mathf.Pow(fraction, Time.deltaTime * 10)
part
is there a way to make UI interact with physics
ugh coroutines make my eyes hurt. I havent gotten used to using them correctly
they are in completly different spaces
thats a shame, what about colliders
colliders are physics lol
use a 3d object, worldspace UI, then put it on there and put physics on the object
what are you trying to do exactly ?
tried that; screen wouldnt scale
Yea its bad scaling stuff, gotta get width and hieght to match object. Probably easier way of doing it but htats how i do it if i need to
i want to make my buttons fall and stuff and the player has to catch them or alternatively click with his mouse, its a very strange combat system but i need to have UI with physics
liike that google browser wityh physics lol
you can fake it
can a sprite interact with UI in collision or not?
yeah exactly that was my reference
how exactly?
just use tweening libraries and simulate the falling, then use the Event System to raycast on them
i need the player to be able to hop on the buttons too
ill look into it, ive heard good things about it
i use tweening to animate the breaking pick
nice
here i have a vid ofwhat your trying to do i think
dotween is my top choice
PrimeTween is also fantastic https://github.com/KyryloKuzyk/PrimeTween
heres a reference of what im trying to do exactly, the stickman is the player and the thing on the top is the enemy. the player has to collide with stuff obviously but he also needs to be an image not a sprite so he can scale with the screen accordingly
That center area could be a render texture in your ui
yes thats similiar
Yea its just a 2d cube with a collider, and an image slapped on it
what do you mean?
that way you can move the object with physics, or transform
A camera can render to a render texture, you can put that in a RawImage ui component
whats a render texture again?
ahhh i see
what are some use cases of render textures in games? just so i can get a better understanding
uh off top of my head now..
for example you want a monitor to display what some other camera in the game is seeing
or a mirror
oh ok interesting
It's just what a camera sees (in this case), yeah
anyone with too much time feel like explaining a couple lines of code to an idiot (me)?

my bad bro i was typing it
float targetRotation = Mathf.Lerp(-maxRotation, maxRotation, (RB2D.velocity.y + FlapForce) / (2 * FlapForce));
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, 0, targetRotation), rotationSpeed * Time.deltaTime);
all the context you should need for this is that i have a maxRotation int var set to 45, a rigidbody2d var thats letting me access the velocity, a flapforce var set to 5, and i think thats it
im very very new to this and i am trying to re create flappy bird and this is intended to recreate that effect where when the bird is falling it rotates down proportionatley, my system so far has been to use a combination of google and chatgpt to get code that works, then figure out why it works (idk if its efficient but its working alright so π€·ββοΈ ) but this code is way too big brain for my caveman cranium to comprehend
what exactly is the part you're confused on?
first one just finds the target rotation to do a slerp (spherical lerping) on.
It might help you to understand it if you broke it down into it's constituent parts instead of that spaghetti
pretty much all of it honestly
like i know super basics but idk wtf a quaternion.slerp is lmao or how to use it ect
just like an explanation on what everything does cuz im lost lol
"slurp" or "es lerp"
how is it pronounced?
sleeerp
slurp is objectivley funnier so im going with that
7/11 sleeerpy
if you dont know what you're typing then you should go step by step
π€€
RB2D.velocity.y + FlapForce) / (2 * FlapForce)
this is pretty much doing that math for the rotation . No idea where it fished those numbers from
ok so i know it makes a var called targetrotation by getting the min rotation and max rotation, and interpolating between them using the interpolation variable i think its called, but i dont know what that does? and then the other line im just lost on lmao
Lerp will give the value between (0-1) A n B by a ratio of t
so if t is .5 then it would be 50% out of 0-100%
is t always a decimal?
wait why dont coroutines show up here?
do i have to make a function to call that coroutine now? seems like a pain in the ass bcuz i have 12 of them
atleast always for when i would need to use it
not always but t is 0-1 ratio
so only whole number would be 0 or 1
thats the proper way to do it anyway
okay then
I would never call Coroutines from any other scripts but its own (with a void method)
so would u say this code is convoluted or my baby brain cant understand it
not really thats the most math its doing
the rest is just applying that rotation "smoothly"
why is it doing that math tho? like i get that its taking the velocity and adding the flapforce (5) then dividing it by 2*flapforce but why??
its only taking the vertical velocity, I have no idea why those division numbers probably to get a decimal out of it
my math aint mathin today to explain how gpt came to that
how would you have done it ?/whats a way to get the same result in a way that is readable/makes sense
if it works , I would not touch it
maybe doing the slerp(rotation one not targetRotation ) with a coroutine https://unity.huh.how/lerp/wrong-lerp
here i can give u chatgpts logic if u want (aka i asked it wtf it was thinking lol)
RB2D.velocity.y gives you the vertical speed of the object.
If the object is moving upwards, RB2D.velocity.y is positive.
If the object is moving downwards, RB2D.velocity.y is negative.
Normalization Process:
FlapForce represents the force applied when the object flaps (jumps or flies upwards).
The range of RB2D.velocity.y is approximately -FlapForce (max downward speed) to FlapForce (max upward speed).
Offsetting and Scaling:
Adding FlapForce to RB2D.velocity.y shifts the range from [-FlapForce, FlapForce] to [0, 2 * FlapForce].
Dividing by 2 * FlapForce scales the range from [0, 2 * FlapForce] to [0, 1]. ```
yes the first Lerp is normalizing the value
sorry if this is a dumb question
what that mean?
basically making it 0-1
well max length of 1
not necessarily 0-1
Whats the best way to track down the "AABB" errors?
It has a small amount of jittering when moving, but im gonna have to move on if i want this game finished this year loll
are you scaling or something ?
show errors
once I take away the reference I get about 15 unique AABB errors that dont point to the code
can you show the full stacktrace or are we to guess lol
something insanely creepy just happened. chatgpt knew my function and method names even though i didnt give them to it, word by word, as its written in my script + its memory is erased. weird...
for now i wont touch my code for this bit and maybe ill come back later when i have more practise and when im not running off 3 hours of sleep in the last 24 hours lmao
I would be very careful using gpt, especially as beginner
If you just wanted a t for y velocity you could do like (not tested but should be simpler to look at)
// gets percentage between -1.0 and 1.0 velocity -> 0.0 to 1.0
// -1 velocity -> 0.0
// 0 velocity -> 0.5
// 1 velocity -> 1.0
var t = Mathf.InverseLep(-1f, 1f, velocity.y);
// gets the angle at that percentage between -90 and 90
var angle = Mathf.Lerp(-90, 90, t);
var fromRotation = transform.rotation;
var toRotation = Quaternion.Euler(0, 0, angle);
// will suffer from rolling lerp.to speeds, but should be fine for a
// flappy bird visual tbh
transform.rotation = Quaternion.Lerp(fromRotation, toRotation, Time.deltaTime / duration);
its watching you
I don't know what that means, but the errors don't provide any context in the debug log:
is there a way to bookmark stuff in discord? cuz i should probably read this later lol here one sec ill be able to find this lemme at keywords
||(thing i needed to read later find this script fixed)||
yeah looks like some strange stuff you're doing maybe with transform component ?
it happens exactly when the formation state machine changes to "dead" and I take away a 'target' GameObject reference from a script.
i would start with the one that says about assigning position to that rigidbody .position @ember tangle
since you're trying to assign NaNs to it
what is AttackRange
Its a sphere collider trigger for ranged attacks and fire at will behaviour, but you're right it does have a rigidbody, ill disable it in the script when the formation enters a dead state and see if that is the issue
but I haven't destroyed any GameObjects so I don't know why it would be causing this
oh ok
if you can show the script where you assign that maybe can offer some clue there
i fixed the issue with water stacking on top of eachother. but am wondering if there is a name for a fluid system like this? i'd like to read more about it but can only find about particle based fluid systems
Cellular Automata
holy shit your batches shoot through the roof with that water though
just want to get the algorithm working for now. even the water cubes themselves are just for testing
thanks ill read some more about that
yea naa looks good ! procedual stuff frightens me
was just staring at that for a second but you still got a respectable 300+ fps so its a non-issue lol
UnityException: Transform child out of bounds
Handle.Place (UnityEngine.Transform placePoint) (at Assets/Scenes/User Mechanics/Handle.cs:63) getting this error
https://paste.ofcode.org/nrkJ8cktfWbAabMTu2Y3dQ
https://paste.ofcode.org/nrkJ8cktfWbAabMTu2Y3dQ
im trying to place stuff on a cart but its not acting like any other object when being placed on it
are you sure about that line
this is the wrong file
That's the wrong script
wait this wrong script
hmm I disabled the collider object and it caused 999+ divide by zero errors in addition to all the AABB stuff
send Handle
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
you're making the transform implode somehow lol
sounds like you have a negative size somewhere
https://hatebin.com/mgqmanyosk the divide by zero error is pointing at this function, really confused as all GameObjects are still active.
they just change into a dead state
I guess they get removed from a list
maybe just wrapping everything in some type of foo != 0?
i change the start color of this particle in the particle generator with the script. It does change the color but the particles dont spawn
what wrong
is there a way to get the position of the edge of the screen in world space?
and store it in a Vector3
or Vector2
Screen.width
Screen.height
wouldnt that get the entire WIDTH of the screen? i only want one point on the edge of it
yeah but you have the "edges"
hey guys. why is the initial velocity, calculated by the CalculateProjectileAngle() method incorrect?
because it seems to be working when using this debug script, that has the same code.
debug script : https://hastebin.skyra.pw/vohapujeho.pgsql
the one used on the soldier : https://hastebin.skyra.pw/quqerututa.pgsql
Is there a way to draw capsules using Gizmos?
so find a point between 0, and screen.height at the screen.width x
oh i get it now
ok thanks
I am having some issues with a capsulecast I have
and I have no way of even seeing what the capsulecast looks like
you might want to account for "safe area"
https://docs.unity3d.com/ScriptReference/Screen-safeArea.html
as some screens can cut off that very edge
seems useful
this is the formula i used from Wikipedia
https://en.wikipedia.org/wiki/Projectile_motion#Angle_ΞΈ_required_to_hit_coordinate_(x,_y)
Projectile motion is a form of motion experienced by an object or particle (a projectile) that is projected in a gravitational field, such as from Earth's surface, and moves along a curved path under the action of gravity only. In the particular case of projectile motion on Earth, most calculations assume the effects of air resistance are passiv...
i just subtracter the init positions x and y from the target positions x and y, since the formula originally only worked for a projectile that starts at (0,0)
anyone?
Camera cam = Camera.main;
Vector3 bottomLeft = cam.ScreenToWorldPoint(new Vector3(0, 0, cam.nearClipPlane));
Vector3 bottomRight = cam.ScreenToWorldPoint(new Vector3(Screen.width, 0, cam.nearClipPlane));
Vector3 topLeft = cam.ScreenToWorldPoint(new Vector3(0, Screen.height, cam.nearClipPlane));
Vector3 topRight = cam.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, cam.nearClipPlane));
so can i use this?
this wouldnt work for UI though right
if this is going on UI item you don't need screentoworldpoint
my canvas is in world space so its ok right
if its a world object then its in world coordinates yes
π
{
float totalX = 0f;
float totalY = 0f;
float totalZ = 0f;
foreach (var unit in units)
{
totalX += unit.transform.position.x;
totalY += unit.transform.position.y;
totalZ += unit.transform.position.z;
}
float centerX = totalX / units.Count;
float centerY = totalY / units.Count;
float centerZ = totalZ / units.Count;
return new Vector3 (centerX, centerY + vOffset, centerZ);
} ```Turns out this function was trying to access an empty list, crazy how many unique errors that can cause...
now I live in fear of AABB errors
its because you're diving by 0
which is a big nono in any calculator, that includes a computer lol
now it checks units.Count before its called. It all makes sense to me now
I dont understand why you create 3 individual floats when a Vector3 at the start would do it for you
hmm that is a good point
I assumed that at some level 3 floats were more lightweight than a Vector3.
no, actually heavier to a minisucule amount
why is that?
Because they might be stored in different places in memory and it's faster to read three values in a row instead of spreading around
because 3 floats are 3 stack addresses whilst 1 Vector3 is 1 address + 3 ofsets
A Vector3 is all in one contiguous stream of memory
I learn so much from this discord lol
more importantly, your code would look so much cleaner using a Vector3 rather than 3 floats
tuple 
why reinvent the wheel?
not if you have your own library, no. I have every Unity class and struct remapped into POCO's
I just remember Json.net threw a hissy fit for Unity's V3
something something self referencing loop
i change the start color of this particle in the particle generator with the script. It does change the color but the particles dont
spawn for some reason, if the color isnt changed it spawns normaly
Yeah without the custom serializer, it tries to serialize its normalized property, which is a vector, so it tries to serialize its normalized property, which is a vector, until it overruns it's internal serialization depth limit
ahhhh the property normalized yeah I remember reading about that
i had to enable the option for json.net but was only a bandaid
unity cloudsave uses json.net it cannot be modified so i couldn't serialize anything with v3 via sdk sadly
so I'm guessing the json utility handles this case specifically ?
It's a property IIRC, so it just skips over it lol
in json.net I had to do ( only works on my local unity project save not unity cloud)
JsonConvert.SerializeObject(Poco, Formatting.Indented,
new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Serialize
});```
maybe they have something like that by default? that would be horrid seems like its a bad thing here no
Yeah that, or declare a custom JsonSerializer<Vector3> class (it comes bundled with the version Unity uses, or as an addon if you install it yourself) and add it to the settings
Yeah i'll look into that might be easier, so far I just made a custom struct that handles the V3 conversion
why doesnt Vector3 correctly translate to my image rect transform? its a little off
can we see it?
A Vector3 is just a collection of numbers. If it's not where you expect it to be, you gave it the wrong numbers
i cant screen record right now, everytime i do it doesnt work
are you usin anchoredPos?
but basically i have this vector3 and i want to instantiate an image in my world space overlay UI canvas in a random x position somewhere and when i put them its a ltitle off
no im using position
if the image is UI rect transfrom inside the canvas try using anchoredPos
iirc transform.position doesn't account for scale of canvas so its off, I could be wrong there
hi guys anyone know why is this error showing?
first you should configure your vscode
how?
yeah button list doesn't match unlockedLevel , is out of range of whats available
!vscode
follow this guide exactly
done
but is showing the same error
what i was supost to do is the first map is clickeble but the other dont
you done what?
configuring this wouldn't fix the error, it would fix your editor from being just a text editor
the vs
the error you have is a runtime error , nothing to do with the fix
oh
you should still not be coding in "Restricted mode" and without the Unity extension enabled
Can someone tell me why when I press restart button, timescale doesn't reset and gets stuck on 0.3 value? I need it to completely reset the scene what am I doing wrong?
the error to fix is simple keep the amount of unlockedlevel always less than buttons.length
sorry no other way around
when i run a coroutine does it automatically wait for the coroutine to finish THEN continue to the next line?
no
well how do i make it wait
make what wait
mak the script wait for coroutine to finish executing
wdym "the script"
the coroutine is part of the script
im saying where are you trying to make it wait, explain what you're doing
Update?
!code
π Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
π Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
you can yield coroutines
i screenshotted it so the comments would be easier to read
no dont screenshot code
how? yield return enemy.Attack1()?
right
but.. the colors
so that would wait it out?
private bool someResult = false;
private void Update()
{
if (someResult == false) return;
//other stuff waiting
}
private IEnumerator Operation()
{
yield return new WaitForSeconds(1);
someResult = true;
}```
colors work fine
but yea i see you're trying to do something else
oh wait they do? i thought it was black and white
inline is black n white
codeblock and inline are different things
large classes use a website
codeblock is for a paragraph one inline is just one line
right?
codeblock
https://gdl.space/iwafiqiwub.cs does someone know how could i use vector2.dot with each vector2 and choose which one is the highest
ah ic ic
i wasnt telling you to paste the code lol i was using it for myself lmao
you can use it for one line if you need highlighting
oh lol
void Method(string something) //wow colors```
srry for the confusion
epic
nw
you should bookmark these by now.
bookmark?
no need to keep summoning bot
bookmark you know it
my guy you want to gamedev you should know what a bookmark is
no clue srry
are you trolling ?
oh
pretty sure thats what he means
makes sense
eh thats subjective, bookmarks have nothing to do with gamedev theyre just a normal thing
yeah i should save the link somewhere
π
hatebin.com is my favorite
use it
yes it does, know how to use a computer should be a mandatory requirement for any gamedev..
i didnt know what a bookmark was till the end of my first 4 months of gamedev and i was fine
but i agree, it is pretty useful to know
just not, mandatory
thats just sad
wesbtie names are short theyre not that hard to memorize anyways
i know them by rule of thumb
this day and age someone who doesn't know a bookmark should have computer locked away
i can think of a way but it would take like 300 lines for sure alone lmao