#💻┃code-beginner
1 messages · Page 708 of 1
yea
not sure about those but 2D colliders/physics always simulate on the same Z even at different Z position they collide
I think most of the Physics2D option do have a zDepth for hits
huh, yeah
i thought they all just ignored Z
my understanding was that Rigidbody2D and all that it entails just used Vector2 so Z isn't taken into account
yeah pretty much
ig Box2D has no concepts of Z space
its the only "true 2D" thing unity has
but for example if you do
https://docs.unity3d.com/6000.1/Documentation/ScriptReference/Physics2D.OverlapPoint.html
it does have a range of zMin / zMax
anyone use gaia? cant get it to do anything
yeh no one answering in there
not much of a better chance here
how you figure coders would know anything about a specific terrain asset
figured there would be more people
not people that would know about that
those people are in #⛰️┃terrain-3d (presumably, i have no idea what it is either lmao)
why not ask the asset makers?
waiting for response
terrain generator type thing
yeh reckon its just broken
its really costly but hell with that money you should be getting direct IM responses..
tragic
lol got it going, its terrible.
Is this good singleton code or would this cause problems moving back and forth between scenes?
{
if (instance != null && instance != this)
{
Destroy(instance);
}
else
{
instance = this;
}
}```
instance is the static instance of the class
ideally you would not have the singleton move between scenes
you would have it DDOL or in a persistent scene
I'm having huge behavior problems moving out of the "GameScene" and back into it, but everything works the first time I enter the scene. Trying to track down what would cause it and think it may be this code I have in all manager singletons.
you don't really move in or out of scenes, they get loaded and unloaded
what kind of huge problems
is the singleton in a scene that's getting unloaded? it shouldn't be (hence the above recommendation)
This is the opposite of how most singletons work. This code is destroying the existing singleton and replacing it. Actually when it destroys the instance it doesn't even actually replace it. This code is wrong.
oh yeah wtf
Normally singleton code should look like this @ember tangle
private void Awake()
{
if (instance != null && instance != this)
{
Destroy(this.gameObject);
return;
}
instance = this;
}```
why's the instance != this needed? Awake's not gonna run again after instance = this;, no?
the static instance survives between scene cleanup, no?
well no not in this implementation
only if you make it with something like ddol
you need @ember tangle :
private void Awake()
{
if (instance != null && instance != this)
{
Destroy(this.gameObject);
return;
}
instance = this;
DontDestroyOnLoad(this.gameObject);
}```
unless you clear it in OnDestroy the object wont be gc'd
hence this recommendation
this is what I had read
no c# object magically vanishes
Most singletons never get destroyed period so it's not an issue most of the time (except when the application shuts down)
we say it was "destroyed" in unity land but the c# object is still there till GC
the monobehaviour instance will still exist, but the underlying structure will be destroyed as part of the scene unloading, so the monobehaviour won't actually be valid & active
if (Instance != null && Instance != this) Destroy(gameObject);
else Instance = this;
so this is wrong ?
no
The only singletons I have that survive between scenes are a data persistence manager and a game state manager
gameObject and this.gameObject are the same thing
its the same thing
then those other ones aren't actually singletons
But there is only one of them and they give static access to other systems?
oh i see , he used return so i was a bit confused haha
singleton pattern: fuck it ill use a static field and destroy duplicates :/
there are multiple, just not at the same time
reel
yes since there is no else there if you dont return it will still try running the remaining lines before being destroyed
this is basically the "early return pattern"
could probably just Awake -> set static reference, OnDestroy -> if static ref == this, set to null
instead of trying to shoehorn the singleton thing in i guess
you seem to just be confusing yourself there
oh I see Destroy(instance); he miss write instance instead this or gameObject xd I doesn't see
it's not technically wrong but it's not as safe. Using else there leaves you decently likely to put code after all of that by accident which would be a bug.
my brains a bit fried with the maths atm, but basically i wanna do something here where i loop over like 100 times so i can get a trajectory. does this look good for parameters required?
Usually you would pass in the time delta too
yeah i thought i was missing that too
Unless you can guarantee that it will always be static across the whole application and can access it statically
Hey guys! Can I ask about the astar pathfinding project here?
there's a discord for it
how can i recreate the bioshock infinite hook and rail mechanic in unity?
How do you want someone to answer that?
If you're just wanting to know what it uses, the answer is splines.
can you tell me why, when i attach this script to a GO, i can't change and drag-drop values from the inspector? they are public
Can't change as in the fields are grayed out? Or not there at all? Or the new values don't persist? Or something else?
like they are not there
i attach the camera follow script to the main camera, but the public values don't show up
The package?
did you save the file?
Errors in the console?
what if i have modelleld my rails in blender and i want them to work in engine
what scripts do i have to right
yes
yes but it's from another script
You have to fix all errors regardless of where they are
Why? It has to successfully recompile to include your new changes
You need to create splines that match your models, either by hand or come up with a way to procedurally do that. As a beginner, doing it by hand would make more sense.
looks cool!
Thanks asgore
i have uploaded a mixamo model for my pg player and implemented a little controller (nothing too difficult), i have attached the rigid body component but when he moves he collaps on itself. i think i'm missing something on the rigidbody component on a 3d model that is not mine, what could it be?
btw the movement is this, i used linearVelocity before but the tutorial i was following used velocity so i tried using that one
ok i figured out i could simply freeze rotation on the rigid body component
using UnityEngine;
public class Regular_Placing : MonoBehaviour
{
private Vector3 mousePos;
[SerializeField] private GameObject toSpawn;
[SerializeField] private LayerMask spawnArea;
private bool inArea;
private RaycastHit2D hit;
private Menu_Item_1 script;
private GameObject menuItem;
[SerializeField] private string name;
// Start is called once before the first execution of Update after the MonoBehaviour is created\
void OnMouseDown()
{
if(hit)
{
script.howManyToSpawn -= 1;
Instantiate(toSpawn, transform.position, transform.rotation);
Destroy(gameObject);
}
}
void Start()
{
menuItem = GameObject.Find(name);
script = menuItem.GetComponent<Menu_Item_1>();
}
// Update is called once per frame
void Update()
{
//following cursor
mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mousePos.z = 0f;
transform.position = mousePos;
// raycast for checking if in spawn inArea
hit = Physics2D.Raycast(transform.position,Vector2.up,0.1f, spawnArea);
}
using UnityEngine;
public class Regular_Placing : MonoBehaviour
{
private Vector3 mousePos;
[SerializeField] private GameObject toSpawn;
[SerializeField] private LayerMask spawnArea;
private bool inArea;
private RaycastHit2D hit;
private Menu_Item_1 script;
private GameObject menuItem;
[SerializeField] private string name;
// Start is called once before the first execution of Update after the MonoBehaviour is created\
void OnMouseDown()
{
if(hit)
{
script.howManyToSpawn -= 1;
Instantiate(toSpawn, transform.position, transform.rotation);
Destroy(gameObject);
}
}
void Start()
{
menuItem = GameObject.Find(name);
script = menuItem.GetComponent<Menu_Item_1>();
}
// Update is called once per frame
void Update()
{
//following cursor
mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mousePos.z = 0f;
transform.position = mousePos;
// raycast for checking if in spawn inArea
hit = Physics2D.Raycast(transform.position,Vector2.up,0.1f, spawnArea);
}
Trying to destroy object after it spawned another object
but Destroy(gameObject) doesnt work
everything else in if(hit) works
object it self is spawned prefab
If it's running, it will work.
Are you sure you're not getting any errors in console?
yep, that's exactly as it says in the warning
Component already has a name property. You're hiding that property by declaring your own name field
Add some Debug.Log to your code
to make sure it's getting to where you think it's getting
Also make sure you're expecting the right object to be destroyed.
it does get
That will destroy the GameObject the script is attached to
cuz i see howManyToSpawn going down
how can i access static fields in a script from the inspector? is this possible?
with every click
not possible
shite
You should Add Debug.Log anyway
You could with a custom editor script
it wouldn't really make sense anyway
you're right, just a bit annoying for my editor window
is there a way to get a gameobject from an asset path?
you mean a prefab?
i wanted to get a scriptable object
this is purely for editor side stuff
and i dont want to make a property field for it
Warning seemed to be a problem , didnt exactly understand what it was saying thx
cool, thanks! what do i do with the GUID though?
Oh wait you can skip the GUID and just use https://docs.unity3d.com/ScriptReference/AssetDatabase.LoadAssetAtPath.html I forgot
perfect, thank you!
trying to make a game similar to this duck life minigame, wondering how I make the obstacle spawn in a set position?
or if im doing this completely wrong pls help
what is float rangeX = (minX, maxX); supposed to do?
That's not valid code
uhh im not sure
well you wrote it didn't you?
i saw a tut for an endless runner cuz lowkey closest thing
but im sure i dont need a random range for this
You certainly didn't get that from a tutorial, unless the tutorial is just showing you erroneous code
so what do you need?
nono i just pulled it out of nowhere
why would you do that? Can you explain what you were trying to do?
the original tut code wasnt range it was random so that it would be a random X and Y value for where the obstacle would spawn but I realised that I dont need a random range for it
That's not an answer to the question though. I asked what YOU want to do. Not what the tutorial did.
What i need is the object spawning in that location (ish), continuing to move left perhaps, having a maximum of like 4 obstacles for better performance, and that if the obstacle reaches this border, the object(s) would stop moving
I think maybe a moving camera but I dont know if I need that or not
ok slow down
one thing at a time
yes
like this screenshot, somewhere on the right side
when you say "in that location", what location are you talking about? And when you say "ish" that does imply some randomness
put an object in the location you want them to spawn, then reference that object in your script and use its position directly
no im guessing its because it will keep spawning there but they cant stack?
that's the most straightforward way to do this.
oh ok
Is that a question or a statement?
I dont know
sorry
i have like the idea of what the game would be like but have no idea how to implement the logic/code
so if it sounds odd thats prolly why
THat's a very common position to be in
you are doing something really common which is your mind is running way ahead of itself
slow down and focus on one issue at a time
start with just spawning objects in a desired location
take it from there
ok
I've made it spawn in the location of a spawnlocation game object, and it looks like this, but I don't know what to do now
test if it works
it does
This will spawn in the location of the object the SpawnObstacle script is attached to.
yes
ok so... now you need to ask yourself what's next for your game
How do I get AI agents to avoid trees?
I have a 2km x 2km forest area with about 15 different tree prefabs. All of them have capsule colliders and I can't walk inside them but the navmesh doesn't recognize them at all and the agents walk through them. I tried writing a script that creates empty gameobjects in their positions with navmeshmodifiers set to "not walkable" but the navmesh generates ignoring them. I'm not sure what to do at this point
if "select dependencies" shows nothing but the script im looking for, that means its not being used anywhere in the entire project and is safe to delete right ?
Make it move
can you not add a NavMeshObstacle component to the prefab?
yes
I forgot that I already did. it does nothing
Make it spawn in random places
how ar eyou using the tree prefab? With the Terrain system?
Or manually placing them?
terrain
but im not making it spawn in random places
That was just an idea
This was in the tutorial you were trying to follow probably
This one should be easier to understand
works
I'm confused though
This creates a visible object for every tree but it's sort of what i was doing earlier
did i screw up the navmesh config
i'm kind of new to this
fair enough
im trying to figure out how to stop the camera movement after it collides with the border but continue moving if not
attaching this to the GameManager object is 😱
shouldn't it be attached to the camera?
also why would a camera collide with anything?
good point
i mean this logic is based on an endless runner
What kind of game is this?
wait let me find a vid for you
Endless runner? So which object(s) are moving, the player?
shouldn't the camera just follow the player?
with the player being the thing that might collide with stuff?
thanks, this was a pain
looks like you would just have the camera follow the player
also this game doesn't need physics
Another thing... you actually don't need to move the player or camera at all for this
just move the stones
im so confused
if you move the stones it's gonna look like the player is moving
games are smoke and mirrors
and you don't have to care about generating more ground
well in this video at least you will need to "move" the ground but that can be done simply by tiling a wrapping texture for example
ok so what should my first step be
the background is static, as is the camera. The player just does a little jump animation
no camera and no gamemanager parent?
spawn a cube and make it move left
The player and the camera are static, all objects just flow to the left (or right) and this creates a simulation of movement
You can aditionally make the ground's texture scroll, which will help sell the idea of movement
Also parallax on the background
not a code question
antialiasing
well yeah for pixel perfect isn't the idea to see every pixel?
it's not conducive for diagonals
where are you looking to see this?
is your game window zoomed in?
make it 1x
idk. Ask #1390346776804069396
this is a code channel
doesnt work, it js keeps spwaning, not each second or whatever input i add in the public float
your code on the right has a compile error you need to fix
is yours on the right or left?
you need to fix that error - namely you need to actually add the Spawn() function
how do i do that
the tutorial shows you, presumably
but right now your code looks different from the tutorial
i didnt include the public floats of min and max X and Y because i dont need to spawn it in a random location
that has nothing to do with the problem
Look at the Update function and the Spawn function
yours are totally different from the tutorial
i dont know what im missing is all
The spawn function
you are missing the spawn function
and you're calling Instantiate directly in Update
which the tutorial is not doing
Unity has a handy method, InvokeRepeating()
what does that men
You don't need a float like that to keep track of the time and keep increasing it
it's just another way to solve the problem you already solved
Yes, it does that thing you just finished doing
You can use that instead if you want to experiment
oh ok
Throw it on Google and find the Unity Documentation page for InvokeRepeating, try to read if and see if you can swap it for what you already did just now
tbh the invoke functions are a little stinky, ideally worth avoiding them
its a noob trap
You think so? Why?
easier to use at first , if you run multiple and need to stop 1 goodluck with that (unless cancelinvoke actually does work? dunno)
no parameters, using strings as method name, spelling errors, inefficient if you have a lot etc
oh if you need to change the repeat timer once started, nope
why use something bad when you can learn something better? and its not that much more difficult in comparison
Well when you start you tend to use bad but easy things, these things you can understand at least and increase complexity little by little, I wouldn't recomend them to try Coroutines, not yet, they just Instantiated their first object I think
I think this is a fair opinion but I do think depending on the person it can be worth jumping right into coroutines and/or update timers instead of the invokes. logically they make more sense which can help figure out how programming logic works and are used often enough to potentially justify the little learning hill they need
imo
Is there a way to "insert" a new layer like at layer 7?
If I just move each one 7 onwards 1 by 1
na its fixed array afaik
then my existing gameObjects in my scene are going to be assigned to the final index layer (which is not their "correct" layer anymore)
Hmm, I think recently I saw someone adding sublayers or something extra like that, but I can't remember what
So no good way to have a "sorted" layers array?
Not to throw a whole new problem your way but you are potentially misusing the ideal intent of layers here
Wdym?
Basically it's just that I only want certain collisions
You realise that if you move the layers everything that references them won't change
so you'll have to go across your whole project and update those indices
How do I "move" the layers?
Yes that's what I'm doing currently and it's annoying
Drag and drop I think
you don't, because it's an operation that has the consequences i'm trying to communicate to you
so I wondered if there was another way
Usually they tend to be used for a lot more broader, generic groupings, particularly for an initial first pass of collisions.
Then you would be abit more "specific" with what interactions you care about via programming logic (eg. tags, getcomponents etc.)
okay yes that's the alternative
but then if I want to have all my "enemy" layers together
are you confusing it with sorting layers?
and currently the enemy layers are 7-10 let's say and I have 15 total layers
Ideally your enemy layers should probably just be a enemy layer
then making the new "enemy" layer index 16 feels bad
I might be, I just looked at it and thoght I had done it before
The thing is that I have ground and flying enemies
and the flying enemies fly over the brushes
but not the ground ones
for instance
I'm probably spreading fake new, forget what I said before
||lmao||
hahahah
An option is to open ProjectSettings/TagManager.asset and sort the list via text editing.
You would only do this in the case where you are comfortable going across your entire project and swapping every layer and layermask on everything serialized that use those layers
I mean everytime I have to update all the layers it's just like 30 gameObjects maybe
so it's "feasible"
just feels suboptimal
but if there's nothing better it's ok I guess
Why do your flying enemies need to be tagged as a flying layer in order to fly over the bushes?
Also in that example how are you utilising the Bushes layer in order to handle that logic?
It's possible Bushes could be broadened to Foliage or Obstacles for example
spend 30 mins making a script to do it for you
Good tip for the text editing part though
Basically I just don't want the AerialEnemies to collide with the brushes
so I figured if I make an AerialEnemies layer and a brushes layer
and deactivate the collision between those two layers
problem solved
Here's some sauce for you
rigidbodies and colliders have layer overrides 😄
You can broaden Bushes to Foliage or Obstacles etc. to make it more usable in other situations then have the flying enemy explicitly ignore that in their colliders
wdym?
so then I would have to add the layer overrides to each of the aerial enemies?
isn't that more work than assigning them the aerial enemy layer?
Or just set it through code?
You could even do this via code
Made a lot easier if using prefab variants and/or just multiselecting them
oh yes
prefabs
Sidenote would kinda be nice if those layer override classes were a scriptableobject so you could do presets. that would be fun
Gotta use prefabs homie
What makes this preferable in your opinion?
Making a Layer class to expand out variants is an idea too, so via OnValidate will swap to those layers depending on say an enum you set in that script
With Jump PlayerInputAction new input system, is it a positive and negative binding?
How would that work?
or 1D?
I'm not sure what your mean by OnValidate
why not just Button
ahh ok gotcha
Layers are built to be the super broad initial first pass checks, When you try to get more specific with them you run into the issues you've been having.
The more stuff you can handle via code the better too tbh
just learning the new input system lol
LayerVariant.Flying -> Collides with Obstacle Layer, Collides with Geometry Layer
#🖱️┃input-system fyi
Thanks
LayerVariant.Ghost -> Ignores Obstacle Layer, Ignores Geometry Layer
Okay I'm going to look into this after then
I gotta go guys rn
But thanks a lot
I really appreciate it
Have a good day / evening y'all 🙂
hire a tutor
im poor
I have the patience for it, but not the time.
lol
then use !learn 👇 and learn it yourself, its free
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
like 10 bucks in my bank account
✅ Internet
✅ Computer
What're you waiting for, get that 🍞 up
You're making the wrong question
You should be asking "How do I do X?"
Then people would be more willing to help
Kinda weird to explain tbh
You have to show interest
Bad example
"Guys I'm trying to do X but it's not working, what am I doing wrong?"
This is a much better question
You're basicaly asking people to go out of their way to teach something to a random stranger
"I'm trying to do X But it's not working, I've tried the following blah blah blah What am i doing wrong?"
obama have dih
well yeah but i dont wanna lie
which one are u talking about because both em have dihh
so mature
bro '
I NEED SOMEONE TO BE MY FRIEND
im a lonely boi
and depressed
SO IM FUCEKED
yo dm me
there is no friend-making in this server, its just for help with unity
There's no off topic, as mentioned already, thanks.
Hi
i've 2 structures say:
public struct MyStruct(){
public int var1
public int var2
}
how to can I make comparsion of my structs with zero struct (when all variables =0) like this
if( _myStruct==MyStruct.zero){
//do something
}
?
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
using UnityEngine;
public class Instantiate : MonoBehaviour
{
public GameObject FloorPrefab;
[SerializeField] private float Timer;
[SerializeField] private float FloorZ = 6;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
Timer += Time.deltaTime;
if (Timer >= 10f)
{
InstantiateFunc();
}
}
void InstantiateFunc()
{
FloorZ += 212;
Instantiate(FloorPrefab, new Vector3(0.6f, 0, FloorZ), Quaternion.identity);
Timer = 0;
}
}``` for some reason instantiatefunc continues to run forever after the timer changes back to zero
when you changed timer to 0
update function still continue increasing it every frame
and when timer reach 10 starts instantiating again
so stop upd
or add condition
like this^
if(Timer!=0)Timer+=Timer.deltaTime;
okay!! ill try it out thank u
i think you can use .Equals
could also do this if you're determined to use ==
public static bool operator ==(struct1 s1, struct2 s2)
{
return c1.Equals(c2);
}
public static bool operator !=(struct1 s1, struct2 s2)
{
return !c1.Equals(c2);
}
thanks
i got it to work, thanks!!
You can make an internal bool method for that
public struct Stuff
{
int x, y;
string name;public bool IsThisStructZeroed()
{
bool temp = true;if (x != 0 || y != 0) temp = false; if (name != zero) temp = false; return temp;}
}
This
anyone have something
what do you mean by something
i dont know
Then stop spamming or you'll be removed from the server.
uh oh
should the winning condition be under the score text section or the score counting section?
which one is the easier way to maintenance/read?
Does the setting of text have any relevance to determining the win condition?
not really, i tried to put the if (scorecount = 800) part under ScoreCount = ScoreCount + 100; and everything seems normal
asking because unity tutorial's method is the pic one but i personally prefre putting it under the score part
since in the future i might work with other classmate and i dont want to have any bad habits
yeah, text doesnt have anything to do with a win condition so keep it seperate
Why unity refuse to see files after 1st one? I've tried to execute same method in normal cs file (w/o unity) and it worked fine
var fileNames = System.IO.Directory.GetFiles(path, "*.evg");
foreach (var fileName in fileNames)
{
Console.WriteLine($"{fileName}\n");
}
I've tried to remove search pattern and delete 1st found file and in both case unity just returned next file
Show the Unity code that doesn't work, not the console code that works
You are using Debug.Log() for Unity, right?
Also there's an error so it's not going to continue after that
public string[] FindAllSaves()
{
var saves = Directory.GetFiles(_dataPath, "*.evg");
return saves;
}
void Start()
{
_fileDataHandler = new FileDataHandler(Application.persistentDataPath, fileName, useEncryption);
var saves = _fileDataHandler.FindAllSaves();
foreach (var save in saves)
{
Debug.Log(save);
var saveData = Instantiate(savePanel, savesList.transform);
saveData.GetComponent<TMP_Text>().text = save;
saveData.name = $"WorldData: {save}";
}
}
Yes
Hey so like I'm trying to spawn a sphere prefab inside my player and make it move forward in the direction the camera was facing when it first spawned in but I can't figure out how to actually fetch the players position to decide where the sphere is supposed to go (and making it a child of the player kinda just breaks everything). I also can't rly figure out how to properly store and use the camera values I get so I'm literally just storing it in a var atm
my fuckass prefab code rn --> https://paste.mod.gg/dqlwubwwycwc/0
spawner code --> https://paste.mod.gg/ewvtretzjsvr/0
tbh I can't even figure out how to actually grab the prefab to make copies of it but ya
And which line throws the error?
Debug.Log(saves.Length) in your FindAllSaves() method
Or crazy idea, use a debugger
Oh, i though this error related to another thing and ignored. Anyway saves.length found all 3. Thank you all
FireballScript fireballClone = Instantiate(_fireballPrefab);```
to spawn a clone
I tried to use it but the editor would freeze until I continued executing the code.
For people who have Idea, is it possible to make a code that runs a audio (Live audio like radio) into unity audio source? Tried a lot of methods and asked for a lot of help, nothing helpt. If someone has expert and Idea, would be great to know how is this implemented
If any answers, I would like to get mentioned :)
ok but how do I put it at the players position?
Well, the fireball is a prefab. You can't reference the scene camera via inspector. And it wouldn't even make sense for every fireball instance to have a reference to the camera to only use it once. Just Instantiate your fireball prefab, make an Init method with position & rotation params, and pass them into the fireball through the spawner which has a reference to the camera.
By referencing the player's GameObject/Transform/SomeOtherComponentOnThePlayer, and calling .transform.position on it, or just .position if it's a reference to the Transform, and instantiating it on that position or via the Init method if you prefer so
But Instantiate allows to set both the position and rotation
So, I got a question about the code in the unity tutorials. The game you make where you make balls bash into each other and push them over a ledge, the code it has you do in the tutorials is enemyRb.AddForce(lookDirection * speed);, but when you're given a project after for a football game, their code given for enemy movement is enemyRb.AddForce(lookDirection * speed * Time.deltaTime);, but that way of doing it makes the enemies move very slow unless you crack up the speed variable into the hundreds. I'm just wondering what best practises actually is.
Just weird that there's a discrepancy between two near identical projects they've given you, and I'm not sure if * Time.deltaTime should be considered one of the bugs I have to fix or not
Multiplying by deltatime there is incorrect
What is the criteria for when deltatime is correct or incorrect?
the red thing in your console is most likely an error that interrupts your loop
I would assume either savePanel or savesList are null
Yeah, it is. I thought its relate to part which i didn't moved to another script yet and ignored
When you have a value that's in units per second and you want to transform it into units per frame, multiply by deltatime. For some things like AddForce you just have to read the documentation
I don't get it. I set the velocity to zero, but it keeps updating (Yvelocity in the Animator)
{
rb.linearVelocity = new Vector2(horizontalMove * speed, rb.linearVelocity.y);
if (OnGround && horizontalMove == 0 && Mathf.Abs(rb.linearVelocity.y) < 0.01f)
{
rb.linearVelocity = Vector2.zero;
}
}```
which update loop is your animator set to?
Update()
set it to fixed
Well I mean the animation is fine. It's the velocity I want to freeze. It keeps slipping on slopes
I would assume that your code runs and exactly after that the physics step executes, which applies gravity, the update then picks up the y value after gravity application
maybe move your Yvelocity update to the fixedupdate
right after you set it to zero if its too small
Hmm, Im trying to figure out how to addforce to the player's rigidbody in the direction the camera is facing. Modifying vectors based on other vectors is still confusing to me
yep, just confirmed it runs as follows:
- Update
- Update (might run multiple times between fixedupates)
- FixedUpdate -> you set linearVelocity = zero
- Physics step -> applies gravity -> velocity change
- Update -> picks up changed velocity and applies it to animator
Camera.transform.forward 😉
Ah. I thought I'd have to do some "player position minus camera position" or something
yeah you can do that too
your camera forward is not always equal to that vector you are describing, depending on if you look exactly at the center point of the player (then it would be the same)
Just because the way enemies work is Vector3 lookDirection = (player.transform.position - transform.position).normalized;, so I thought it might be another case of needing that
yeah if you do that with the camera you get the camera's origin point to players origin point direction
Yeah, I realize that the gravity will force it down eventually
I'm resorting to freeze constraints, as long as it lasts
why dont you just apply the values to the animator before the physics step?
no freeze tricks needed then
The animator receives value directly from the rigid body
uhh how does that work, wouldnt a script have to do that?
Basically just this
anim.SetFloat("Yvelocity", rb.linearVelocity.y);
yeah, move that command to the fixedupdate that you have shown above
Just after you set stuff to zero
oh wait, im stupid, you also wanted that gravity doesnt push you down while on the slope
dont you want to slip at all or just not with tiny slopes?
That command line only gets the value of the velocity, it does not change the velocity itself. The sliding movement happens because gravity is forcing the rigid body, making change to the velocity continuously
mhh you should look at adding a high friction physics material to your character and ground, aswell as trying some linear dampening
that should stop gravity from slipping you off slopes without any freezing
I guess that can work
I have to separate the walls and the ground into different tilemaps
Why is it purple...
#1390346776804069396 for shader related issues
Thx
modding discussions are not permitted here
for a game that is not your own. therefore modding
Wha... huh?
This is literally just trying to automate something in RRS
It's not like I'm hacking the game
that's cool. we don't support that game here
Rec Room Studio is a game, thats considered modding
I was told by someone who works in RRS all the time to come here
nobody said anything about hacking. this is not a support server to assist with modding third party games, this is for developing your own games
they were wrong. seek help in the RRS modding community
Ok, sorry
surely they have their own discord then
because you are modifying the behavior of a game you didn't make. modding isn't just "hacking"
and yet it's still not your game you are seeking help with. you are creating content for another game which is literally what modding is
I guess I misunderstood... I apologize
void Update()
{
_horizontalInput = _moveAction.ReadValue<float>();
_Jump = _jumpAction.ReadValue<float>();
if (_jumpAction.triggered && isOnGround)
{
Jump();
}
}
my Jump(); isn't firing my Jump Action, it states that when I press Space it goes to 1 so that works
but the actual jumping isn't working
public void Jump()
{
_playerRb2D.AddForce(Vector2.up * _Jump * jumpForce, ForceMode2D.Impulse);
audioSource.PlayOneShot(jumpSound);
}
you have to show the rest of the !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
_jumpAction = InputSystem.actions.FindAction("Jump");
have you actually confirmed that the if statement is true?
would help if we need to also see how you move rigidbody . You could be overriding the AddForce with velocity
Debug.Log and make sure both those conditions are true
I don't see isOnGround being set anywhere
I do have velocity on my Horizontal input on the 1D Axis, but seperate from the Jump method
should I do do the enables seperate?
would really help if you show us all the related scripts. isOnGround and how is the horizontalInput used on movement
The variable is declared, the movement input does work
The junp button does work since it goes from 0 to 1 when i press
Bool is declared not true nor false
jump method is in update, whilst movement method is in fixed update
this may be the issue
Figuired this out lol
I am currently using tiled, turns out it's my OnCollissionEnter2D not firing
to trigger said Bool
I already have collissions within tiled to be imported, imported into a sprite type collider
Still the same result
oh wow, I fixed it, nice
If you are working with Tiled, do a tilemapcollider 2D with your Tiled map grid that has said collider, get a CompostileCollider2D and in tilemapCollider set comps to merge
How can i pass variable to new scene? I've made save selection scene and all i need is to pass string with save name to next scene to load data from respectative file. I saw i could make scriptable object to pass it as it not bonded to single scene but game as a whole but i think it'd be a bit of overkill
How do I reference a variable in another script?
Few ways about it, but it sounds like you may want some sort of SceneManager singleton that lives in all scenes where you can safetly pass data to and let it cache or funnel it to the next scene
Thank you
SOs is an idea too as they don't live in scenes, but if you're writing data to it at runtime I wouldnt suggest that method
I am getting an error "The namespace Rendering does not exist in namespace UnityEditor" This error only exists when im trying to build the game and if I try to change it, none of the textures load.
I need help quick I need to submit this in 30 minutes
Looking up how to create a singleton and tagging it with https://docs.unity3d.com/ScriptReference/Object.DontDestroyOnLoad.html on game load will be helpful
Thank you again
I found out that "Unity Editor" only works in the editor and not when building, but what is a replacement for it
You're trying to compile using Editor only libraries. You need to specifically tell the compiler not to include those scripts, or inside of the scripts use preprocess directives:
https://docs.unity3d.com/6000.1/Documentation/Manual/platform-dependent-compilation.html
#if UNITY_EDITOR
Debug.Log("Unity Editor");
#endif
Im sorry, but I don't really understand what you are saying
Show me the script that's having problems
A tool for sharing your source code with the world!
remove using UnityEditor.Rendering;
Does that throw any errors in your script
I can't just drag my spawn manager into the enemy prefer to be able to reference it, so I'm kinda lost
no
If the prefab is in your directory then you cant drag scene gameobjects into it. When they are in your directory they can only reference other directory only assets. If the spawner is on the scene then the enemy prefab can be either on the scene or using prefab data from your directory*
Assuming you're dragging enemy prefabs into the spawner
The challenge says "The enemies’ speed should increase in speed by a small amount with every new wave"
And the hint is "You’ll need to track and increase the enemy speed in SpawnManagerX.cs. Then in EnemyX.cs, reference that speed variable and set it in Start()."
So first off I would never edit prefab data from your directories (at runtime), unless I am creating a whole new prefab. Now for this problem you'll be wanting to cache all the enemies into some data struct when you spawn them instead of letting them loose in the scene. This way when you increase the speed value you can iterate over this List/Array and increase each one of these enemies.
So at minimum you'll need:
SpawnManager (Doesn't need to be a prefab and can exist in your scene)
Enemy (Prefab as you'll be making duplicates)
Well the enemies are being generated in waves. They're just balls that move towards a goal and you have to stop them, then once thye're all gone, it spawns the next wave
Right... I still don't know how to create a variable in my spawnmanager script and then reference it in my enemy script though...
show some code
Create an Enemy Monobehaviour script
Make a gameobject on the scene and slap a Enemy component on it
Drag this gameobject into your asset directory -> becomes prefab
Create a SpawnManager script
Make a variable in this script called Enemy (make it public)
Make a gameobject on the scene and slap a SpawnManager component on it
Drag your Enemy prefab onto this gameobject on the scene into the Enemy property
Okay, I think I need to make it clear that I'm at the end of this project and am just trying to do this last thing. I dont need "step 1, create an enemy script"
This tells you in the junior programming pathway, but in unity 6, if you want to reffrence a script,
put in the script name inside of the script you want it to reffrence too and put the method after placing the reffrenced sprit into a variable like this
public JumpScript _jumpScript
_jumpScript.MethodName()
vice versa
Well, all the steps are there so if you've any more questions
I can't drag the spawn manager from the scene into the enemy prefab though, so it'll just keep throwing errors at me
you can´t reference scene objects in prefabs
I am aware
you can do that when instantiating the prefab and assign the field with some kind of injection
You want to drag the Enemy prefab into the SpawnManager, not the other way around.
Okay, I'll try and rephrase this.
My SpawnManagerX.cs script has a variable called "enemySpeed"
How do I reference this variable in my EnemyX.cs script?
Enemies don't need to know about any reference to the manager
Yh... Enemies don't want to know my location lmfao
Just show your manager script
[SerializeField] private Enemy enemyPrefab;
Enemy newEnemy = Instantiate(enemyPrefab);
newEnemy.speed = enemySpeed;```
They need them in an array list too
The problem reads as it's updating all current enemy speeds
use a paste site 👇 !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
this line in the update is not a good idea , just as a sidenote
enemyCount = GameObject.FindGameObjectsWithTag("Enemy").Length;
Instantiate(enemyPrefab, GenerateSpawnPosition(), enemyPrefab.transform.rotation);
You get a reference to this new object constructed as the return value which you want to cache
Well tell unity, I'm just following the pathway
Enemy enemy = Instantiate(enemyPrefab, GenerateSpawnPosition(), enemyPrefab.transform.rotation);
enemy.Speed = currentGameSpeed```
But remember, if the speed increases it has to change all enemies speeds
so how do you figure out how to reference the previous enemies
what Module are you on?
Do how you did with the learning module
since that's basically debugging
I basically had 2 issues with that pathway, had to reffrence the script directly rather then using the modular approuch
Okay, I don't feel like asking here is productive anymore
https://docs.unity3d.com/ScriptReference/Object.Instantiate.html
Learning about how to use the docs is a good idea too if you ever get stuck
can always use an AI to help with problems, they arn't always helpful either
debatable. depends on the circumstance too
yh, but truth is the AI is a reffrence tool rather then you looking online for it and wasting hours of your time
Okay, I dealt with it by putting
spawnManagerScript = GameObject.Find("Spawn Manager").GetComponent<SpawnManagerX>();
in my enemy.cs Start() and making the speed
enemyRb.AddForce(lookDirection * spawnManagerScript.enemySpeed);
also sometimes this helps alot aswel, just sleep on the problem you are having at the given context
Did it work?
I mean it's hard to tell really
Can use Debug.log on the associated bits that arn't working and isolate the problem
The game they have you make feels awful to play, so I can't really tell if they're getting faster each weave, but I used Debug,Log and the number is certainly going up
then it's something to do with the middle man then
No, I mean, I think they're going faster, it's just hard to actually tell
seems like a spawnInterval variable is fast
or spawn rate inside of a for loop
I don't even know what you're talking about anymore
i think they're saying you should make a timer to check
blind leading the blind
I can only guess on what you are stating, but then again I'm not exacly a qualified programmer
Hi everyone, is there an (official) tutorial on how to make and import a package from github? My package will have some scripts + a couple of image files; so far I could only make a big mess... 😅
AI is shit for referencing things it just does the same as you if you want to search something, but it doesn't even understand what it finds so it give irrelevant info / links.
how do I listen to an eventInfo callback regardless of the event parameters?
Everone has their own opinions on such matters
And yours are bad, doesn't help it's backed on outdated information so many links just don't exist anymore.
Excuse you, what works for me, might not work for you, keep your opinions to yourself?
dont really think there needs to be a whole tutorial for that. it's pretty much just 2 clicks as far as im aware
should just be able to press the + in the package manager
Ironic coming from the one telling others to use AI
You are in the past m8
reflection EventInfo?
which EventInfo are you talkiing about ?
reflection EventInfo, Im trying to get a callback from any event with any parameters
kinda like event += (_) => FooBar(); but reflection
The thing is I tried that (I have a package.json + scripts/components inside Runtime/)
The package imports ok, dependencies are good; but I cannot add my script components to objects in the project..
seems like a problem with the scripts then, not the package
in order for a script to be added as a component in unity it has to derive from MonoBehaviour
make sure there are also no compile errors
Well everything worked fine before; these scripts were part of my project initially (yes, they derive from MonoBehavior, no errors, etc.)
But now I want to package them so I'm testing on the same project
what is "reflection EventInfo" ?
still sounds like UI Toolkit..
or are you talking about System.Reflection
Hi I'm working on a Unity project and having some trouble with spawning fireballs continuously. I've got a powerup system where players can collect different power ups, including a fireball, but the fireballs aren't spawning as expected. Fireballs should spawn every 5 seconds after the player collects the fireball powerup. the fireball spawns once but doesn’t spawn again.
The first class is responsible for handling the fireball powerup in the game. When the player collects the fireball powerup, it starts spawning fireballs at regular intervals.
The second class handles the logic for applying powerups based on the player's response. It interacts with all my power ups, including the fireball.
https://paste.ofcode.org/NXs5nsvQExV8iTq7mb2LrA - Both classes are in this
can we discuss errors related to vs community here?
only if they are related to unity.
yes System.Reflection, I thought that EventInfo would be more commonly associated to a class in a System namespace, apparently its more related to UI toolkit here
what is an array
try googling that and see what happens
did you check console for errors ?
yes ofc, I'm trying to run my game with universal windows platform but this error always shows for some reasons
UnityException: Build path contains XAML build which is incompatible with D3D build type. Consider building your project into an empty directory.
PostProcessWinRT.CheckSafeProjectOverwrite () (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:300)
PostProcessWinRT.Process () (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:132)
UnityEditor.UWP.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:86)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.UWP.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/build/output/unity/unity/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:90)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <e2ec61eabaea4cfa8892d65208615f30>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <e2ec61eabaea4cfa8892d65208615f30>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Build completed with a result of 'Failed' in 4 seconds (4458 ms)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlay
there are no errors
put logs in the while loop and see if those get printed
are you building into an empty directory like it says ?
sorry what?
where are you building the project ?
it only got printed once
do you have Time.timeScale set to 0 somewhere ?
I've got a smoke particle effect attached to my sphere player that play when I boost with the space bar, unfortunately it rolls around with the sphere so it doesn't really look like a boost. How do I keep it behind the sphere?
paste these in links !code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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 for the long message Imma put it as a txt
yea in the question manager when the player collides with a powerup, a question pops up i set timescale to 0. do u think i mightve left it set at 0 or something
#✨┃vfx-and-particles
although i believe you just need to change the simulation space
WaitForSeconds doesnt work if timescale is 0.
you need WaitForSecondsRealtime if you want to keep running with timescale 0
here the error
that doesnt really answer my previous question btw
Which folder is the project path located, and which folder are you building the game into ?
wait lemme explain. so a question pops up if the player collides with a power up and if the player answers the question correct then the applypower method gets called for whichever powerup the player collides with. i set timescale = 0 when the question is up and im pretty sure i set it back to 1 after the player answers the question correct or incorrect. do u think i forget to set it back to 1 or is it some external problem with some of the objects components or maybe another script
C:\Users\youpr\Documents\test2
which of the two is that?
there are two questions there
once you set it to 0 I think it stops it completely
just switch it to WaitForSecondsRealtime and see if still does it
yeah the fireballs still dont spawn continuously
either the monobehavior that started the coroutine is either disabled gameobject or parent, or its destroyed. I don't see that many other reasons why the while loop would stop
could it be another class affecting this
sorry, I'm building the game in C:\Users\youpr\Documents\test2 and the project files are in C:\Users\youpr\3D Objects\Unity\3Dahhgame, is it okay? or the spaces are a problem?
oh hold on i mightve figured it out
it shouldnt but i never built for UWP so not 100 on that.. u have followed all the steps in https://docs.unity3d.com/Manual/windowsstore-buildsettings.html ?
https://docs.unity3d.com/Manual/uwp-getting-started.html
thanks for the link
uhh wasnt there a command for this
Input code differs between the built-in Input Manager and the Input System, and changes are required.
so what i must do?
did you read link
yea
and i must change something on my script or in my object
but i don't know if the ui throw me the error or player code
you change it in the Player Settings as it says
https://unity.huh.how/input/input-system/input-handling#enable-both-methods-of-input-handling
why is this code, bugging out debug.log its not the same name anymore, how do i amke it stop giving this error
what namespaces do you have
wait nvm its cuz i kept that one as "Debug" oops
and last question i do a script and i can look up and down but no left and right.Whad i do wrong?
Im trying to make a pixel 2d UI with a 570x320 image. Its native size is 570x320, its set to that in the image, the camera has pixel perfect camera with 32ppu, the canvas resolution is 570x320 with 32ppu and scale with screen size, yet the logo is too big in game
I always have a hard time with UI stuff
first you should configure your !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
• :question: Other/None
why 2017 🤔
also next time post the !code properly
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
the point was to use links, not spam the bot message again
* Time.deltaTime should not be used on mouse inputs btw
so what i must to change
well first get rid of that
A tool for sharing your source code with the world!
was this generated by ai ? seeing the same pattern on this dc..esp the *delta part
huh ? where did you get script from cause it looks exactly like others I've seen here
from youtube
hmm k.. did you assign all the fields, did you check console
so what i must change
hi, sorry to interrupt, i have a probably very simple question- it keeps throwing an error here at line 21 saying theres a missing semicolon somewhere and i can't figure it out =( https://paste.mod.gg/fcrvitskfoyp/0
A tool for sharing your source code with the world!
you probably assigned the body and the mouseLook the same object and its conflicting with eachother
so i must change something in code right?
transform. and playerbody should not be assigned to the same object
transform is supposed to be the camera object, usually child
configure your !ide it will underline where problem is
its not a semicolon missing but it thinks so because you just wrote something without assigning value so thinks you never ended statement
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
• :question: Other/None
so i must asigned a object like cylinder to playerbody?
the body should be the root, the transform should be replaced with a camera Transform instead
the structure is usually
-Player
--Camera
--BodyCapsule
can be cylinder?
the Root shouldnt have any graphics on it, only scripts and collider/rb or cc, graphics go on child , it doesn't matter if its a cylinder or capsule
thanks, my ide is configured and usually does underline and autocomplete code lol. im following along with the learnunity tutorials and my code looks exactly how they want it based on the pictures i think, and no one else mentions getting this error 😔
if it underlines then it should be underlining where issue is
screenshot the IDE
whats with you and cropped screenshots
anyway open the console you will see if its an editor failure or
its underlining 'new' in line 21 (20 now bc i deleted one)
there .. good
thats where the issue is
look at your code and the code from the lesson, you can easily compare that section for differences
ok
Did you forget a = ?
Oh sorry
He was learning 😓
looks like i did miss the =, thanks both of you -i was hung up on it saying i missed a semicolon i didn't even see it </3

yeah the computer thinks its a statement you didn't finish
good to know, will keep in mind
as far its consered it has no clue what you want to do with transform.postion
its like just saying red apples out loud lol
Sup guys, so I'm trying to do basic physics for a space game. This is basically my first time using Unity(1-2 hours in).
I want to get all the children of an empty object in the scene. From there on, I want to get the properties in a mono behaviour script attached to those objects. How do I do that?
Then saying green after 😂
depends though, its much easier to make specific references in inspector and assigning the components there
My teacher said it is not a recommended way to do getcomponentinchilden, the best is assign it directly in the inspector as if the children doesn’t exist or is placed in different index then you will get an error or not the component you want.

I'm gonna assign the folder of the planets in the inspector, then get all the children of that(basically my planets) in the script
Stupid question: how do i make an array of gameobjects?

lookup "make array c#"
its the same regardless of type
GameObject is just a type like any other c# type
Stackoverflow has a lot of tuto , i think it will be the first thing you will get
Thanks. These questions might be pretty stupid but I came from Roblox Studio where everything is a bit "simpler"
best do the c# basics though through Microsoft learn site & others like w3schools
If it the first time you are coding, learn first what is a array before using it
W3schools is goated
Oh no I've been coding for 2-4 years now
its okay the microsoft one is better but should get you started on the basics
mainly python and lua, but also a bit of cpp
But I stopped cpp after not understanding why it's giving me linker errors lol
Haha c++ is harder than lua or python basically but all three is used for different purposes
To be honest, I like that c++ is so "free" compared to Python or Lua
(not it terms of money)
🤔
Python is for beginners as it is very easy but the syntax make it hard to understand for higher programmers because you don’t have {} to delimit function range or something to tell you what type is a variable
Yeah, Python with {} and ; would be better
C++ considered statically typed compared to dynamic lang like Python..
(If i look back a the tower defense i have done 1 year ago in python) i am going crazy with all the if
)
Btw , for a custom pool manager, what is the best way to get a GO?
But i need to use with addressables
Why isn't it finding planet_folder

those aren't "folders"
Yeah gameobjects, I know
Point your mouse on the function and it will give you exemple in the doc
but you don't pass that variable where T is expected
its not a param
It a type of:)
GetComponents is Generic function, it expects a T not really a specific instance of t
did you look at the docs
Oh I remember templates from c++, it was traumatising
More easily to understand, when you see function<T>(params)
T is a class or a structure (not sure for struct)
It can be gameobject as personalscriptclass
(If it can’t accept it then the ide will tell you)
its very important in unity to know what Components are
basically any script that is on a Gameobject is a Component
Oh god roblox studio seems like python compared to c++
you should mainly be looking for scpecific scripts , its pretty rare you need to use GameObject
c++ ?
It is visual scripting
not sure how thats relevant here lol
Or majority
C++, C, C# or rust
C# is a cakewalk
I'm not a native english speaker, so I don't understand everything directly lol
still, you hasn't answer me, if I want to use addressables with unity pool system, is it possible ? or not ? (I made my custom pool system but just to know)
i'm too
don't worry
Yes, it is possible.

I made my personnal pool system thinking unity don't have it
cost me a lot of time lmao
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 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.
Eh, you can still fill the pool with water
i would suggest learning some data structures and algorithms
Wasn't a complete waste of time imo
idk why im really here i used to make games w unity and switched to software engineering
ig i just wanted to say learning dsa would make game dev easier
yeah like, you know more exactly what you are doing
definitely you reminded me of when i made my first object pool
it looked so complicated back then
#region Fields
private readonly Dictionary<GameObject, Queue<GameObject>> _unactifPoolableObjects = new();
private readonly Dictionary<GameObject, HashSet<GameObject>> _actifPoolableObjects = new();
private readonly Dictionary<GameObject, int> _dynamicPoolTracker = new();
private readonly CancellationTokenSource _cleanupTokenSource = new();
private readonly Dictionary<GameObject, GameObject> _instanceToPrefab = new(); // Copy instance
private readonly Dictionary<string, GameObject> _prefabsByKey = new(); // For addressables
#endregion
this is the Fields of my pool system 
yeah
it hard asf
event more when game designer don't use it like how it should be
whats up with the _ naming convention did you used to be a c/c++ programmer?
I start from C then C++
before going on C#
but I learn it in my school haha
lol i did the opposite C# -> C -> C++
Java > js > c# > cpp > rust
did you REALLY learn c++ though or is it just on your resume XD
btw , is it a good idea using gameobject (the original prefabs) as key in dictionary ?
its real 😆
its unique so should be fine
but may cause some gameobjects to never be gc'd
gc d?
garbage collection
Unity is for tomorrow, sleep is for today
I remember my nightmare in C was the memoryAlloc 
sleep ? what is sleep ? haha good night
Schlaf ist ein Zustand der äußeren Ruhe bei Menschen und Tieren. Dabei unterscheiden sich viele Lebenszeichen von denen des Wachzustands. Puls, Atemfrequenz und Blutdruck sinken bei Primaten und anderen höheren Lebewesen im sogenannten NREM-Schlaf ab und die Gehirnaktivität verändert sich. Das Schließen der Augen während des NREM-Schlafs unterstützt diese Funktion.
Anyways, cya all
atleast in cpp we have smart pointers
yeah
smart pointers are still annoying
std::vector<
std::shared_ptr<server::SPSCQueueT>>
m_response_queue_list;
i am seg faulting trying to resize this
the vector resize is segfaulting?
yup
its super weird the way im getting a ref to it might be the issue but it shouldnt be
what a nightmare
yea how did you make the shared ptrs?
hahaha
Hmm sounds like your fault 😆
do you know if it is possible to increase the speed of compilation ? as unity recompile each time you update a script and sometime it take longer than 1min ?
as it compile on one thread if i am not wrong
use asm defs
get better computer
cry
there is a setting for this
the setting is to disable domain reloading but that requires lots of things to be done to manually deal with the effects
yea
Uncheck Reload Domain and Reload Scene. This prevents Unity from recompiling all scripts and reloading the entire scene every time you enter Play Mode, drastically speeding up iteration times, especially when making minor code changes. Be aware that disabling Domain Reload requires manual re-enabling if significant script changes (like creating new classes or renaming files) are made, as these changes won't be reflected without a domain reload```
ugh
use domain reload off all the time.. the only thing to watch for is explained in the docs its mostly harmless , mostly static need to be manually reset / cleaned properly
hmm ok then I will keep it unable then haha yes
it not like 30s of compilation is long (30x multiple time)

you can jump around scripts in the code editor and jump over to unity when ur done bulk-editing
yup waiting for it every time you hit play adds up
i must lost multiple day in it
i set LineRenderer.sortingOrder = -1 but it still appears in front of a SpriteRenderer.sortingOrder = 0. how do i get the line renderer to appear behind the sprite?
i moved the sprite to layer 2 and the line rendere to layer 1 but it's still on top for some reason. are you saying change the z transform of the gameobject the linerenderer component is on?
Is this a 2d or 3d project?
it's 2d
this my code for the line rendere
protected virtual void Awake()
{
lineRenderer = gameObject.AddComponent<LineRenderer>();
//lineRenderer.material = new Material(Resources.Load("Assets/Materials/AimIndicator.mat", typeof(Material)) as Material);
//if (lineRenderer.material = null)
//{
//Debug.LogWarning("LineRenderer material is null");
//}
lineRenderer.positionCount = 2;
lineRenderer.startColor = Color.red;
lineRenderer.endColor = Color.blue;
lineRenderer.startWidth = 0.01f;
lineRenderer.endWidth = 0.01f;
lineRenderer.useWorldSpace = true;
lineRenderer.sortingOrder = 0;
}
this is the player prefab
well few things you can do first when running make sure the line renderer is never in front -z axis of the sprite
you dont want the opposite of this photo
or do you want the line renderer above the sprite?
behind the sprite
right now the line is on top
hello, uuh for some reasons I can only build my game (UWP) with build type executable only, when I select d3d project I get those errors
not a code question
usually setting order in layer to a lower number than the sprite should fix it, assuming they are on the same z axis
what does error MSB4057: The target "MarkupCompilePass1" does not exist in the project. even mean
again not a code question. please stop asking in this channel
ah okay, if there is no material assigned it appears in front, if there is a material assigned it appears behind. i wonder why
how can I profile memory to find memory leak ? 
like if it has memory leak after closing app
Closing the app like, sending a mobile app to the background, or closing an executable on PC?
closing executable
Nothing is open when you close an executable, all the memory is released
Memory leaks occur within a program's lifetime
(unless you're doing something non-standard that's reaching out to other programs in a way that doesn't link processes)
I can't check memory leak of my pool system and addressables manager then...? maybe changing scene but the pool is not reset btw scene
oh eh i don't think so
thanks for the answer
Anyone know how to get the high definition 3d option it’s not appearing for me
might depend on the editor version but it should just be there by default when creating a project.
also not a code question
ty also my bad
anyone know how the lighting is done here? especially at 0:52 where the light floats "up and down" and changes the shadows cast by the rocks above? https://www.youtube.com/watch?v=lMFaTxcCgx0
with shadow caster 2d, it just creates infinite shadows, are they doing some sort of 2.5d? could I make a script that does this in pure 2d?
We’re so proud to be sharing our first long-form gameplay video. This video shows off the first 15 minutes of our “alpha” demo. There are a few things to note when watching the video.
- It does not show all the features or content in the game.
- There are some missing elements like UI and UX polish.
- We have cinematics planned for the...
2d shadows seem neat and no clue how they work
but 2.5D is pretty automatic
with unity's currently lighting modules
do you believe thats what they're doing?
that light is just offset from the tilemap and the rocks have an invisible extruded form that casts a shadow?
they have a lot of self-shadowing going on so I'd say so lel
Actually it does make sense to self-shadow in some of this stuff
But looking into it more it looks intentional cause day scenes they do shadow properly without affecting the sprite
pretty neat though if it is full 2.5D
i wonder how hard that would be to make
i hate how top down lighting looks so bad in base unity2D
It's pretty simple, especially if you're not rotating the camera
yeah i'm not, but shadowcasters seem to cast infinite shadows?
since theres no perspective of how tall something is
like take this for example, idealy the shadow would be cut off since presumable the light is super high in the sky at an angle
not directly next to it
they aren't directly upwards. Everything is tilted by some degrees
similarly, you tilt the directional light to compensate
this is from a spot light, directional lights dont seem to work in 2D unless im doing something wrong?
i assume they are 3d only
Thing which makes me feel like it's 2.5D is they alpha cut all the sprites
meaning there's actualy depth sorting
yeah
the material on their stuff is also called sprite lit depth
not sure if thats relevent
i asked in the discord 🤷♂️
hey do you know how I would convert a 2d project into 2.5d?
2.5D is just a 3D project
how would I have tilemaps then? theres no option to create them haha
Install the 2D Tilemaps package
