#💻┃code-beginner
1 messages · Page 599 of 1
I think you should use two seperate canvases instead of scenes
- I highly doubt the video says E is an
int. - I don't care what the video says, I'm asking you
If you literally do not know what words mean, then attempting to help you is pointless. !learn
at least send the error and script for us to look
well no wondering you are not learning anything, this wont even explain shit.
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
how
alright, ill rather opt for 2 panel though
send the code atleast
of what because there is none for the int
it will work fine too I think better than mine
then how will it work if there is none for the int??
If there's no code then it doesn't exist and therefore cannot be having problems. Glad we could sort that out
how come he didnt use a code
those are the disadvantages of random videos my friend
can i send you my project for you to fix them things
No one is going to just write your game for you
take the time to actually learn how to use the engine
if you send the code I may look over it but not considering the project
so i cant make my game WONDERFUL
Turns out: Making a game requires effort
there is no code
if you attempt to put in zero effort, you will get zero game
bro wants to shortcut his way through an entire game lol
I think if you use events it will work better I myself use events almost all the time
@buoyant finch because there are multiple panels being set active and inactive, would it make sense to use an event or just disable everything that has to be disabled in one method?
how come it works then?
for who
the working of the game
idk how he did it
what was the video you sent wasn't it of your game I am asking about your cs script in visual studio
what?
I am asking that you paste here your cs script through which your game works
which script
this is your game's video or of the person who is giving the tutorial?
the person
https://www.youtube.com/watch?v=3y7P2hidGfI&list=PLWI8H56cvVoKsqSwpyDRmEPCGfJnCpUd2&index=3 this one
This is part 3 of my tutorial series where I teach you guys how to make a Slender-like horror game in Unity. Be sure to stay tuned for part 4 and more!
#Unity #Unity3D #gamedev
Scripts will be in pinned comment.
For more Unity tutorials like this or more videos in general - be sure to like, comment, and subscribe for more! 👍
Wishlist Bodh...
go back and start from the beginning then if its supposed to work like the video
double check all steps
im wondering, what are considered "advanced" unity problems? like dots?
i did
That is not a tutorial, it's just a recoding of someone working on the project. You won't learn much just blindly miming someone else doing something, you need to understand what's happening.
Unity's Data-Oriented Technology Stack (DOTS) is a set of technologies designed to help developers create high-performance games
that says HOW TO MAKE A SLENDER LIKE HORROR GAME
it should be more like "Watch me make a slider like project"
i was wondering what topics are considered "advanced" i know what dots is
yeah but he certainly doesn't show any scripts which make his game work
@simple vine If you have an actual coding question then ask here, explaining what you did and how you've attempted to debug it already.
You really think people would do that? Just bait clicks on youtube?
Otherwise this is pointless
low level programming usually, or dealing with more advanced things like interops etc.
yeah
he good tho and helped me on other one i used that he made
It's pretty arbitrary. I consider something to be "advanced" if it's a niche subject with a lot of technical complexity
you just use scripts from other people now that's another level of hypocrisy
Well, now that it isn't you have two options:
- Learn what it's actually doing and understand how to debug it and either fix it yourself or actually provide useful information
- Give up
he made other tut that worked
oh well done you made my life a living hell telling me to give up
no one is saying that
option 2 is the less desirable option
No, I gave you two options
If you choose to give up, that's on you
ok you know what copy codes till you can and let's see if you complete the game fully
huh
Crawl before you walk
I bet you cannot finish your horror game without learning cs
i cant
I would suggest starting with Unity Learn.
BECAUSE IT DONT WORK
It will give you a foundation for creating your own game.
forget tht tutorial
If you wanna prove me wrong learn and come back being a greater programmer then me
start from here
Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.
"tutorial" you're following is shite
you ain'tgonna learn anything but copy and paste
bruh this again
and you can barley do that
We are bringing it up for a reason.
If you are not here to learn don't spam the chat.
if you refuse to try at least putting effort in your own learning, that goes against community rules here
#📖┃code-of-conduct
it doesn't work because you are directly starting from 3d which is not an issue but I would recommend firstly making 2d games with basic shapes to get some command on the language
im quiting
ok but that makes you a quitter
no need to keep dragging this
yea because you are being USELESS
they were pointed to the resources, up to them what they do now
You are the one wasting everyone's time here
we know how to make a game because we actually put the time and effort to learn
oh right surely if you think someone is free here to listen to these screeches and just make you the game buddy that's not gonna happen
i tryed to fix 2 things and now they made it a big deal
Yes, since you want to make a game without ever putting in any effort, that seems for the best
you seem to wanting to shortcut your way through making an entire game without knowing a lick of c# or unity
@simple vine Now, do you have actual programming questions?
yea but not helping me
I am learning from a Leonty source, and the instructor has a different version than mine. When I write the code he writes, I don't see the same results as he does. Is the issue related to the version?
telling you to start from the ground up is NOT not helping
Probably not
yes 4 word, Help me fix this
But it depends on context, of course.
Unity changes remarkably little from major release to major release -- some stuff eventually gets deprecated and removed
This is how you !ask questions here.
:thinking: Asking Questions
:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #🔎┃find-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #854851968446365696
but the majority of stuff that worked back in Unity 5 continues to work now
i put effort into it
we are telling you from experience, how you are doing it doesn't work.. clearly
start from the beginning stages, work your way up
@simple vine If you don't stop bickering I will mute you. Research your question and post it here if you have one.
then whats the point if yall being useless
"Please fix someone else's tutorial but also I won't do any debugging or answer any follow up questions" is not how you ask a question if you expect an answer
why even make a game if its going to be a trash mess no one is going to want to play ?
!mute 1323412736519966841 1d Start with Unity !Learn lessons, then come back here.
therealpugsbros_77594 was muted.
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
yeah and you are being useful right not even trying to make a single script
What versions are involved here, and what are you actually doing?
I have a question
If I put a function in my script, would the game react if lets say I press a key that's supposed to make that function run?
Or does it have to be under like "public update" so the game always check if I pressed the key?
This my version , my teacher has 2021
yes you need inputs to be polled in Update, unless you are using events
It is certainly possible to make Unity call a function when a key is pressed.
But merely creating a method doesn't do anything on its own
private and public are to be used in case of different scripts if you want to acces their value for another script you need to declare it as public but if you want to keep it limited to that script private should be used
that was not really what the user was asking about
it is reasonable to point out that it's a bit weird to say "public update", though
public void Update() {
}
This is a method -- a function that's part of a class -- called "Update". It returns void, meaning it doens't return anything at all. Its access modifier is public, so anyone can see it
This method name is special. Unity looks for a method with this name on your MonoBehaviours and calls it every frame.
i always keep my keep Update private protected void
notably, it doesn't have to be marked as public -- the method can be private
What about for example loading a different scene when collecting certain amount of points?
you could check your point count in an Update method, perhaps
or you could check the condition every time you add points
This my code , and when i run the player doesn’t move or jump
learn events tbh
please use !code for large amounts of 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/, https://scriptbin.xyz/
📃 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 should start by checking if your code is running at all. Use Debug.Log to print things to the console
Not move also
did you actually put the script on gameobject?
Yes i did
I haven't looked into events yet, currently trying to understand why my code didn't work as it's own function, but worked when it was under Public update
show code
I'll send a screenshot when I'm back on my laptop 👌
no screenshots, use links #💻┃code-beginner message
Will do soon
What about mu issue
what aout it ? did you put logs as instructed?
test out if things are running at all etc.
we debug usually by process of elimination
process of elimination, you mean :p
you need to prove that your code is doing anything at all first
e.g. by logging a message at the start of Update, as well as logging the desired movement vector
What's the best way to deal with audio, brief sound effects in particular?
I'm using a singleton AudioManager class with a static PlayAudio method to be called from the object that wants to play a sound. But after that I saw multiple different ways of going about it online, and I'd like to know if there's a clear better/more sensible/efficient way.
For one, should the sound files be stored in the Audio Manager and it just gets a name/enum of the file it's supposed to play, or should every object hold its own sounds and pass them to the Audio Manager when it calls PlayAudio?
And two, should the AudioSource I use be a prefab in the AudioManager that gets instantiated at a location and then destroyed? Or should it be a child component of the AudioManager that gets moved around?
Actually, how important is the location of the AudioSource for 2D games in particular anyways? Or does it only matter if I actively try to get fancy with audio?
by fancy audio I think you mean Spatial sound, like 3d sound and yes it also useful in 2D. (unity is 3d engine)
If you plan on doing that you need the audiosource to be at location of the sound at the time, I just pool and spawn these SoundObject prefabs that let me play sound at whatever location.
I store my soundclips on the actual thing that makes the sound usually so its self contained
my objects that make sound don't know anything about sound manager, they just get registered to it OnEnable, then an event is invoked and soundmanager deals with the playing (sound clip gets passed in the event) , if its 3D sound spawn the object at location with clip, if its a regular sound then play it through sound manager player
pooling the sound to spawn can be basically thought as having 50 not-active sound sources on stand-by and whenever a 3d sound is needed at location, activates the gamobject with its new values, after it plays goes back in the pool
I see. Thanks.
I already heard about pooling and Events/Listeners, so I'll look into those too.
I'm lazy and I just use one-shots
I mean I also use one-shots not sure if that changes anything lol
you mean PlayClipAtPoint ?
i usually see people use this https://docs.unity3d.com/6000.0/Documentation/ScriptReference/AudioSource.PlayClipAtPoint.html
Ah yeah I see that one. For 3D sound but otherwise PlayOneShot suffices
that creates a new gameobject each time and then cleans it up but it builds up quick
But playOneShot also works for 3D sound, thats why I'm confused lol
i almost never use Play unless its like a background song or something
oh right I guess if you just give it a position yourself
as long as you got the new soundSource you can do PlayOneShot
i prefer it because it takes a clip so you dont need to swap the AS each time
if its a 3D sound -> Spawn the object that plays one shot at location
if its regular global sound -> play through sound manager as one shot
Right, that was a difference too. Is there a major difference between
myAudioSource.play();```
and
`myAudioSource.PlayOneShot(myAudioClip)`
Espacially if I create myAudioSource from a prefab just before this and Destroy it afterwards?
yes the latter cannot overlap sound
if you call Play on the same AS it stop the previous sound and plays from beginning
so if you must play another sound and its not ready you need to check or stop previous sound
myAudioSource.isPlaying == false
Play()
can someone explain how i can put my code in a box in discord like in vs codes?
!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/, https://scriptbin.xyz/
📃 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.
keep inline for small blocks, entire classes and large code like that goes in links
also this Discord server doesn't have line numbers for code blocks
ok thanks i saved the code in paste.mod, now how can i paste it here? should i just press ctrl+v?
u click the save icon and the URL will be updated
copy and paste that new url
I see. Thanks.
You must be blind if you can't C#``` @spark moth
Badum' Tisss!
dad jokes!
Hello.
Would someone tell me if I should multiply by Time.deltaTime when using AddForce inside onTriggerStay?
nope, i wouldnt think so, its a physics message.. runs on the physics tick..
It works the same way as if I was using addforce inside fixedUpdate, right?
mmhmm

lol whats wrong?
yes?
even in Update Time.detaTime would still be wrong
i think they were just unsure if the Stay() method runs on the update loop or the fixedupdate loop
good luck 🍀
is it ok if i send the link of my code from the website instead of pasting the code itself here? cuz i couldn't fix the problem
thats the whole point of those links
then explain how to paste the saved url from the website because ctrl+v just pastes the code like a normal text
paste code on the site, hit the Save button, send the new generated LINK in your address bar
like this?sry for my knowledge btw
https://hastebin.skyra.pw/obeyipiveb.pgsql
yup
oh ok because it shows the link for me instead of the code in something like IDE
How do I set the strength of a SpringJoint2D?
thats for large code yes, it looks like IDE on the site itself
on here you can use for small blocks the three ticks method
ok so let me send my problem
public class Test : MonoBehaviour
{
void Start()
{
Debug.Log("I hate C#");
}
}``` smaller code
but this doesn't give line numbers and is generally for 5-7 lines
wdym strength ?
i'm making a game which has a movement like subway surfer but when i want to dodge an obstacle by changing
lane and then coming back to that lane, the game thinks i hit the obstacle what can be the problem? if u want i can send
the video or more codes
player movement code:
https://hastebin.skyra.pw/ucagabefiq.csharp
Looks like "Frequency" controls stiffness?
https://docs.unity3d.com/6000.0/Documentation/Manual/2d-physics/joints/spring-joint-2d-reference.html
are you following a video tutorial? can you send that too
no, i was following brackeys tutorial but i'm now working on my self
kinda strange to use both AddForce and movePosition.
MovePosition might be undoing proper collisions
but if u want i can send the video of my problem
if you want sure
ok so wait i'll record one now
https://streamable.com if its too big for DC
Id be more interested in knowing how you do collision/obstacle detection
so should i also send you the code of collision?
wouldn't hurt
ok i'll send both just wait a bit
currentLane * 3; try to give numbers meaning by using variables
don't use magic numbers
oh ok
I want an object to lose all moving force when something happens. Tried doing that with rb.velocity but nothing happens (IDE corrects it to linearvelocity, dunno if it's the same thing)
is this the rightway to go about this?
it is
rb.linearVelocity = vector3.zero
rb.angularVelocity= vector3.zero
or
make it kinematic ?
velocity is deprecated
I did that, doesn't seem to affect it hmm
did you
verify its running
dont have other script setting it
yeah that's what I thought as an alternative...making it static then dynamic again
^ make sure when u do it u have ur other movement code temporarily paused
this is the video of bug and this is the code:
https://hastebin.skyra.pw/wiwanekobo.csharp
just b/c u set it to 0 on one line doesn't mean something else wont re-write it if u hadn't paused the other stuff
I actually don't have any movement scripts at all, it's a physics game with a ball
oh if its just a physics object u may want to turn off gravity.. when u set the velocity to 0
gravity obviously will continue to move it?
video isn't working
so setting it static will do the same, yea?
try downloading it
yea static should lock it in place..
not sure if thats the preferred method.. but def could work
and can i give you a friend req so you can help me?
but see I don't want it to bounce of a wall...so when it hits this special thing, I want to lock it in place for just a moment, then let it go down again.
Can I just make it static then dynamic right in the next line? Will that do the trick?
I can help you here dw. other people can too so its easier here
no.. that'd just end up setting it to dynamic.. if its the same frame
myint = 3;
myint = 4;
myint = 5;
in the same frame is the same as
myint =5;
ok ok fair
waittilnextframe may be good enough
but will that do what I want on a high level?
it could be the bad lerp causing the movement not catchup properly and using MovePosition is bad idea with collisions cause it ignores other coliders until it catches up with addforce i suppose
not sure what u mean by that
I mean will that achieve getting rid of the bounce and just letting go of the object downward
not sure that sounds like a 
ok
can u please fix the code?
this whole code needs to be re-written, its not good
I would suggest lookup a better tutorial video on this. Unity also has one pretty sure
https://learn.unity.com/pathways then go into better tutorials after
ok so i have to check the youtube. thank you very much and bye bye
youtube is a hit or miss :\ better you start with the unity ones then branch out
ok
so youcan better recognize where to improve on the youtubers u watchin
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Vector3.MoveTowards.html
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Vector3.SmoothDamp.html
heres a few alternatives may work better for ya
thanks
those two dont quiet work the same as lerp.. (you wont run into unpredictable lerping and slowing towards the end)
well that whole movement needs to go from
2 rb calls to just 1
using velocity at least
u can use lerp correctly to fix those problems but with these two functions its built-in..
foolproof-ish
facts imo.. its best to construct ur final vector and use one RB call to avoid confusions
finalVector =
(groundVector * finalSpeed) +
(airVector * playerSettings.airSpeed) +
(Vector3.up * gravitySim);
characterController.Move(finalVector * Time.deltaTime);```
this is CC but same concept
public void FixedUpdate()
{
rb.linearVelocity = new(sideMoveLerpMethod(), 0, forwardMove);
}```
also time.DeltaTime is the reason you had to crank forward move to 40000
ok you guys are going so fast lemme take notes
lol you can always scroll back 😉
erasing in 3....2....1.
ik but sometimes i have to scroll 1 km back
ok if there is any other advice tell me and if there isn't i go
hmm..fuck it..now I'm gonna make a video on infinite scroller with dash/jump ability
start simple then build up
no me!...
lol j/k i got other plans
thanks to both of u, and nav you got a new subscriber😉 bye
holy shit I'm old af ? if thats my most recent inifinte runner reference
what about me? 😢
yeah don't sleep on Spawn they got THE content
do u have youtube?
i was writing a lerp coroutine for an example even
spawn camp out!
me and nav are two threads from the same spoil
IEnumerator MoveToPosition(Vector3 targetPosition, float duration)
{
Vector3 startPosition = transform.position;
float startTime = Time.time;
while (Time.time - startTime < duration)
{
float t = Mathf.Clamp01((Time.time - startTime) / duration);
transform.position = Vector3.Lerp(startPosition, targetPosition, t);
yield return null;
}
transform.position = targetPosition; // Ensure it reaches exactly the target
}```
i use code like this for lerping
caching the original position.. (that way u dont feed the variable back into itself)
this is a bit complex for me but ok
woa never seen Time.time with a lerp, interesting
transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime);
this is how ppl normally do it.. and is wrong ^
spawn can u give me ur yt link?
ya wrry about lerping later lol
first you should even figure how to limit your player to 3 specific lanes
^ true..
i'm not gonna use unity for really long i'm gonna change to godot that's probably my last project
oh are u making a temple run game?
fun fact: GD can use c#
u might have a head-start
so why use unity for this at all?
seems like a waste of time learning this stuff just to move onto another engine
its not like its something you learn/ do overnight
im 50% in agree-ance
at first i was trying to use unity because of the number of tutorials out there but now i have changed my mind and i think godot has better future(no offense)
it wont hurt to learn a bit of fundamentals from unity
but if u plan on gadot u should start optimizing what ur learning for that engine
no offense taken, I dont work for Unity lol
but thats quite false
Unity has WAYY more features that godot has to catch up to
but whatever works for you, game engines are like your favorite hammer
ya, gadot is like half a decade behind imo (no offense)
but godot is only out for 5 years and unity for 20 years but it's not that much behind
unity's asset warehouse is bounds better as well 😛
I can churn out stuff pretty quick with godot, but the optimization isn't there and it's taking time for them to catch up after redoing their pipeline
that's why i think godot has better future and it's community is also growing non stop
https://github.com/Jan-Ott/CharacterMovementFundamentals @rich adder the kinematic controller asset i bought a few years ago that i use for everything was just dumped to github..
he's deprecating it
if you want to learn at a lower level on how 3D engines work, godot is actually a good experience
yeah you wont notice until you notice the limitations believe me
but yeah simple can be benificial for you
have you used godot?
yea
3D or 2D?
its not a bad engine at all, it just wasn't right for me
Godot has been released as open source since 2014 and was in developement since 2001
people say it's the 'easier' engine to learn, but I disagree and say it's easier to jump into, but harder to master since you've less tools available
at the time I tried it i only did 2D and tooling in c# not much game wise
ok so 11 years i thought it was 5
try https://www.redotengine.org/ then..
how come the open source time only count?
I just find the whole workflow uncomfortable tbh
the UI is sexy af tho
but godot is better with GD script maybe that's why you hit limitations because GD script is much better for godot than C#
Unity has been under developement for 0 years open source
yea and I hate GD script or any pythony languages
godot is more like entity system right?
the language, built-in IDE (with built-in docs), and UI is by far the best thing about it
i feel like the nodes things throws me off
Technically 24 years but you can't really compare a big engine with a team (unity) to an open source project anyway
python is so fun though :DDD
ok that's ur opinion. i still think unity is better than godot right now but godot will be better later
its fun what it can do, the language itself can die
ya, he said I hate.. ofc this is a "opinion based" subject in its own
no engine is subjectively better than another
I'm not disagreeing, just stating what I didn't like about it .
unsubjectively? idk u get the idea
Isn't python's performance just really bad? Why do people choose it for something as performance critical as a game engine?
anyway.. w/e u chose to do best of luck @spark moth
I suppose most engines are written in C++ and python is only for scripting, but still
thanks, and you also got the subscriber
its really fast at math.. is what ive been gaslighted into knowing about it
probably why pygame is limited af still
only way godot succeeds unity is if unity goes bankrupt in the near future, or games get to the point where hardware exceeds the need for any more optimizations and then godot just because the 3D engine without any fees attached
I think it has some really fast libraries in it. Any custom logic made in it is likely much slower than with compiled languages
From what i've seen, godot is like 10x slower in many cases compared to something like C#
i feel like AI will be making games by that point
the only reason id consider gadot would be as a 2D project
but why choose pythony syntax is what makes me skeeved out lol
Unreal did it with Verse scripting smh...
i could see it being atleast a bit competitive w/ 2D
probably because it's has great AI development tools compare to it's difficulty
python better for data science and ML
https://discord.com/channels/489222168727519232/1202155978372423690 we need to tack on Gadot to this discussion 😄
but you could probably adapt any Functional programming for that
AI tools being in Python is similar to how datascience tools used to all use MATLAB. It's like - just what the PHD mathy people knew.
Godot is surprisingly fast, but the rendering has problems, even with the new pipeline. It feels more like built-in considering how easy it is to use multi-shader passes
wait why does the unity server even have this?
just b/c it comes up so often
ud be suprised how many trolls come in.. and waste time and then say.. "well it doesnt matter, im going to Unreal"
I still use unreal for other projects, not every engine fits everyones needs
nice to have a thread to link as well when discussions like we're having now come up
but its missing gadot.
according to google, C# is 4 times faster than godot and godot is faster than python
google or google ai ?
don't believe that
👀 lol what?
no language is X times faster than other
"C# is faster than godot" doesn't make any sense
i think they meant gd script
That would make more sense yeah
Even then doesn't make much sense to say language is X times faster than other. It is all very much dependent on million things
i mean GD script
interpretation time is probably more important
compiled languages dont deal with that though
If I have
void OnApplicationQuit() {
FlushMetrics().Forget();
}
in a MonoBehaviour and
private async UniTask<FlushMetricsResult> FlushMetrics() {
// (...) nothing with await
UnityWebRequest unityWebRequest = new UnityWebRequest(url, "POST");
// (...) nothing with await
UnityWebRequest.Result result = await unityWebRequest.SendWebRequest();
// (...)
is it realiable that unityWebRequest.SendWebRequest() is called before the application closes?
I don't need the result.
like Fire and forget ?
Yes, but it should fire.
should fine , its just a GetRequest
i want to make 2D metroidvania games that's why i don't care that much for the speed. i want the language to be user friendlly but have a decent speed not it being very fast but not user friendly
What's the most practical way of attaching an animation/animated sprite to a static 'main' sprite?
I've got an unchanging bird body sprite, and two wing sprites (pointing up and down), and I managed to create a FlapWings animation that looks decent enough, but if I just attach it to the Bird object via an animator, the wings replace the main body sprite (as was to be expected according to what I understand).
Do I just need to create a 'Wing' child object in Bird attached to its back that holds the Animator and FlapWings, or is there some other way?
and i have to go bye
gdscript is more user friendly than c# ?
yeah GDscript is easier than C#
it's cleaner but I don't see the difference really
you lack interfaces but not like you need interfaces with c# to make something with unity
pretty much yeah if there are meant to be different then put them in different objects
func _on_body_entered(body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred("disabled", true)```
🥵
```cs
private void OnBodyEntered(Node2D body)
{
Hide(); // Player disappears after being hit.
EmitSignal(SignalName.Hit);
// Must be deferred as we can't change physics properties on a physics callback.
GetNode<CollisionShape2D>("CollisionShape2D").SetDeferred(CollisionShape2D.PropertyName.Disabled, true);
}```
what the func?
I take it the Wing object also needs its own Renderer to be able to show the animation, right?
yeah because thats what animates at the end of the day
I see, thanks.
SpriteRenderer just gets the sprites swapped
is there any way to look up a value rather than key in a dictionary?
im doing an encryption puzzle, and want every letter to be a different letter but without duplication
nvm just rubber duckied myself
ignore me lol
ok I came up with this method, but out of curiocity is there a better/more efficient method of handling that?
so instead of looking for a value, I check it in the list instead
Not sure I understand what this method is? It just looks like a dictionary and a list
The dictionary alone seems sufficient, no?
actually as I try to explain it I confuse myself
basically I need to also check if the value exists already for any key
ill look into that thanks!
Why do this select random letter thing
Just make a list of the letters
Duplicate it
Shuffle the duplicate
And then iterate over both lists in a for loop to set up the dictionary
that also sounds like a good idea I didn't think of that
is one or the other more efficient?
in terms of code I'm assuming yours is but out of curiocity is there a performance difference?
It'd be worse if you had a huge pool of letters and only ever used a few
but if you usually exhaust the list, shuffling it once seems nicer to me
If you remove an item from the front of a list, all of the other items have to get moved up one position
I forget if there's a built-in shuffling method. I just use https://en.wikipedia.org/wiki/Fisher–Yates_shuffle
Also, if you want to prevent a letter from encrypting to itself, that adds a little more complexity
(i have no idea if you want that)
from a cryptographic point of view it'd be a bad idea
there's also the trick to swap the element with the last one and remove it to avoid incurring the list reorganization cost when removing elements
it messes up the ordering, but doesn't seem relevant in your case
true!
from what I read do I understand it correctly: you essentially take a random index, and that index is now the first, then you do that for the next and the next?
No.
huh, just noticed that there's an extension method for it in the Unity.Collections package
You walk backwards from the end of the list, swapping that position with the front of the list
always thought it was built in for Lists
for position X, you swap with probability 1/X
I forget the proof for this one. I remember learning it back in a randomized algorithms class..
ok so you work backwards - you roll a number based on the number of things left, and then whatever that number is, is the new index of whatever bit youre on?
im so confused it literally says "rolled"
Yes.
You pick a random number between 1 and N
where N is your index (we're doing 1-indexing here)
If that number is 1, you swap the element at index N with the element at index 1
If it is not 1, you do nothing.
You perform this for every item in the list.
How do I stop a (looping) animation in an Animator? I have a bird flapping its wings (which are the animated part, in a child object, but I'm accessing the Animator from the parent Bird's script), and on a game over, I want the Animator to stop the animation, but myAnimator.StopPlayback() doesn't seem to work. (Starting the animation, and everything else in the game over code works, so that's not it). What am I missing?
doesn't that result in most of the list not being shuffled if its large?
if you only swap them if you roll 1 then you can end up with only 1 letter changed no?
did you untick Loop on the animator clip asset ?
Until the game over it's supposed to loop, though. Or do I need to disable the looping via code if I want it to stop?
oh man I am a dummy
why whats up lol
yeah, I mis-remembered the algorithm
its alright it happens
Yeah, you pick a random index and swap your current item with that index
public static void Shuffle<T>(this List<T> list)
{
int index = list.Count - 1;
while (index >= 0)
{
int i = Random.Range(0, index + 1);
if (index != i) (list[index], list[i]) = (list[i], list[index]);
--index;
}
}
the most important thing is you remember the name so you can look it up!
I was worried I had also implemented it wrongly, haha
I was remembering part of the proof that the algorithm works right
specifically, proving that it gives you a 1/N chance for the original first item in the list to keep its position
(which you'd expect for a random shuffle)
what does that mean in practice? a 50/50 or?
oh wait
If your list has 4 items, the odds that you never move the first item are
nvm
so my algorithm would correctly shuffle the first item into the list
unfortunately it would not do much else
😭
are there any other common methods for shuffling lists like that?
now that you explained it the Fisher-Yates one makes a lot of sense, so it's hard for me to picture other methods
your original code is another option
it's just not an in-place method
you need two separate lists
that's the main advantage of this method
yeah I think this method is slightly more optimised since I don't think I need the dictionary any more
I have a float in one script im trying to update in a different one, I've referenced it at the beginning using
public RandomSpawner spawning;
But when I reference a public float I have in the other script later like such:
spawning.upgradedTime -= .5f;
It spits out "Object reference not set to an instance of an object" on the upgradedTime line, I didn't think I was even referencing an object here but I'm clearly missing something. Thank you for any help, sry if so basic I'm pretty new.
declaring and assigning are two different things. Did you actually assign a specific component for it to do work on?
unity wants to know which RandomSpawner you want
How do I let it know which RandomSpawner? I should only have one class named such and it seems to recognize the upgradedTime var when I call it in my script in my editor. Sorry again j vry confused to this
you have a class yes that just defines the blueprint / describes how a created object from this will be like.
You need a specific object/component created from RandomSpawner
in Unity components are created by placing the script on the gameobject
then its now a created object from that template, and you can drop that into its inspector slot for your declared variable
it makes sense I think, so sorry getting distracted from kid, thank you so so much for the answer though, I'll be back eventually to really give it a good read
I am having this problem with my camera where, when I look on the display, it is perfectly fine and on top of my players eyes:
But as soon as I try to play my game, the camera goes to my characters hips and outside his body:
All of my camera position and orientation are set to be on top of the model but im not sure what is causing this
my cameras rotation seem to be reversed for some reason too?
Should I worry about that warning?
I think that might call the wrong function
I would definitely rename them
Pretty sure is the only class with that method name
I get that too sometimes but still works ok
anyone got any suggestions by any chance or has run into something similar?
its probably a script or animation
!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/, https://scriptbin.xyz/
📃 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.
// private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Player"))
{
rb = collision.gameObject.GetComponent<Rigidbody2D>();
//rb.linearVelocity = new Vector2(0, 0);
rb.bodyType = RigidbodyType2D.Static;
Debug.Log("collided");
}
}
Why is debug log not returning anything? They are physically colliding and everything seems fine otherwise
CollisionEnter doesn't work with 2D colliders
ooooh
you need the physics2d equivalent OnCollisionEnter2D
https://paste.mod.gg/jjnwzjowegvo/0
Would you mind quickly just checking if its my scripts?
I have 3 in here.
My PlayerCam to actually turn and stuff and turn the model
My MoveCamera to make sure my camera follows my camera position
And just incase, I also added my reticle script.
A tool for sharing your source code with the world!
OK but now I get this:
Script error: OnCollisionEnter2D
This message parameter has to be of type: Collision2D
The message will be ignored
ah ok figured it out
first you should show all the pivot points
in pivot local mode
more importantly cameraPosition object
Im sorry, this is my first time hearing about pivot points and pivot local mode. Ill look up what that is.
ye what about it
This is my hierarchy if this is what you mnea
same pivot for my orientation
didn't we do this yesterday r something ? or someone else with the same exact setup
wasnt me thats for sure
if you're gonna crop dont crop the important bits, doesnt show if its local mode
it is
CameraHolder
oh
and player cam is in player cam
No it just already is off set. When i look in the game display, it looks fine and im on the eyes of my avatar model.
But as soon as I actually play the game, my camera goes all the way down to the hips and im outside of the body
did you try starting with animator disabled
i can test that real quick
Nope the problem is still there. Also, when im turning my mouse, my character turns the same direction as my mouse, but my actual crosshair turns the other direction
wdym your crosshair
why would crosshair be moving
is this not fpv ?
i put both to 1,1,1 my camera is now inside my own body. Its weird, like the way im looking, isnt the way my player is looking at all. im looking at the back and my character is too, but as soon as i press W, my character walks backwards. I which I can send you my project to properly explain this.
never use * Time.deltaTime on mouse inputs, thats why your sens is crnked up to such high numbers.. Mouse input is already giving the distance moved since last frame so its already framerate independent
oh ok
what is scale of avatar
all my controls become inverted as soon as I orientate my camera differently from the initial position
1,1,1,
oh ok
would there by any way to send you this project to show the issue more appropriatly? im not sure if im describing it properly
eh maybe if it were a repo
I'm kinda on the go rn best I can view is code or videos tho
hello! im having a problem where inside a function to initialize some managers in my game, i get that one of the manager was found, but whenever i try to use it in the rest of the code it says its null, does someone know what could be the problem?
https://hastebin.skyra.pw/ofexisotov.pgsql
The top console message and the bottom one are the relevant ones, i think they should be checking for the same script right?
ty in advance
maybe make a video that could give a better idea of whats actually going on since strat
what would be the best way to send it if its too big?
ight gimme a sec
you cropped all the lines, what are we looking at?
ohh basically the top console log is line 46 and the bottom one is 166
if thats what you are asking for, maybe i´m confused
uh that doesnt line up
wait let me check
screenshot the full error ?
ye
so armyGridManager is nul ?
so it seems
def is
but in the debug.log that i made in line 166 it says it isnt
Oh its you navarone
it seems by the time it hits that SavePlayer2ArmyInfo method is not there
long time not see
yea yo
At some point im moving, I am just pressing W and S. Nothing else, yet my controls are inverted or jambled up.
https://streamable.com/atspzf
why could that be the case? i dont recall changing it
it should set itself on initializeManagers method and not be changed afterwards
is Player a mb ?
what is mb?
Monobehaviour
GlassBlocks = GameObject.FindGameObjectsWithTag("glass");
if (GlassBlocks.Length > 0)
{ foreach (GameObject block in GlassBlocks)
{
block.SetActive(true);
Debug.Log("found em");
}
}
OK why does this not work? The objects are checked for the correct tag and I initiate the search after they've been added into the scene
put this line
Debug.log($"Assigning positions to {player2} from {armyGridManager}" , this);```
above 70
okey
yup ok so its 100% armyGridManager being null
does clicking it bring you to the correct gameobject just incase?
clicking the armyGridManager Variable?
nah like the log
ohh
lemme check
it shouldnt be a gameobject tho
since player isnt mb
or am i saying nonsense right now?
I mean the log that printed this that has GameManager
just checking it isnt a bad clone or something gone wrong
if you click the log it should show you which object its on
when you add context to Debug.Log as second param at least (hence the this keyword)`
OK I figured out this doesn't work with inactive objects. Do I really need to find all of the game objects in the scene and then compare tags?
did you put this ? in the log as second param
yes
Debug.Log($"Assining fights to {player2} from {armyGridManager}", this);
thats what i wrote on line 69
weird normally it highlights the gameobject that spit it out
hmm, im kinda lost
also this is my only scene
in case that helps with something
its
if (gameobjects > 0)
{
foreach (bla bla)
{
}
{
you forgot a whole set of brackets
which gameobject has GameManager script on it
I didn't, I just didn't copy
ah
anyway, turns out finding objects with tag doesn't work on inactive objects which sucks
the GameManager that is on DontDestroyOnLoad
guess I'm gonna have to find all objects and then compare tag
show inspector for it
is there a reason you arent storing the objects in a list?
do FindObjectOfType() instead if you must
{
optionsManager = GetComponent<OptionsManager>();
audioManager = GetComponent<AudioManager>();
shopPoolManager = GetComponent<ShopPoolManager>();
fightersOnSaleManager = GetComponent<FightersOnSaleManager>();
armyGridManager = GetComponent<ArmyGridManager>();```
you know what GetComponent does right?
it gets the component
on THIS object
or sets the variable to the component to get
I saw that one and I must admit I don't know what a Type is in this context. I saw it being used with a type of "GameObject" which doesn't help
so that should be at the end of the method?
yeah I could do that too
no your scripts are on the children, not on this gameobject. See where I'm going here..
If you have a monobehaviour Car then you can do FindObjectOfType<Car>()
oh
if you want the component on the child use GetComponentInChilren
ah ok that's what I need then
so type is a class here basically?
classes are types yes
@rich adder Sorry im back, did u have any chance to watch my video?
okay but it should be written on the end of the method also, right?
myComp = GetComponentInChildren<Blah>();
a type is a kind of thing
public class Foo { }
public struct Bar { }
public enum Baz { }
public delegate void Buz();
all of these define types
wdym the end of the method? why
yeah it makes sense
i said nonsense
if im checking if its null its dumb to set it later on
types can be very broad, like unity's Object, or they can be very specific, like one of your own components
lmao
yes, from what i see there right now it has slight offset in positioning from Camera to Camera holder, that might already be a problem in itself
but it still throws in an error
show the error and send new code
also are you sure that InitializeManagers() is being called
it has an arg you need to set to true to make it get from INACTIVE gameobjects
otherwise it will skip em
should i add the prefabs as the children of gameManager?
its being called on awake
How do i get all objects of a specific component in the scene, i tried Resources.FindObjectsOfTypeAll<Prop>() but that also gets the stuff thats not in the scene
Do I use Rigidbody2D for top-down jumping or smth else?
I know where it is in the code, but doesnt confirm its running by just looking at the source code
use the same function thats in GameObject
GameObject.FindObjectsOfType
i get a debug.log that comes from awake, so yes it should
and that works for everything under that gameobject or is it global?
wdym Global
it's actually declared as UnityEngine.Object.FindObjectsOfType
so using GameObject is unnecessarily specific
oh right its Object
The method is a bit weird to me. It finds any kind of Unity object
but it also has special rules for inactive game objects
someone asking this question doesnt need to know this 😆
its static, doesnt mean the function only looks for GameObject tpye
in this case, it was causing confusion about whether or not it only found things on game objects
yeah new one is Like find First of Any type or some shit
idk what the line means
oh yeah, it's been replaced with FindObjectsByType
ah
the IDE tells you replacement
The new methods explicitly ask you whether you care about order
I find it annoying; I wish they would at least default to being ordered (thus matching FindObjectsOfType)
public class NpcWaypointGroupEditor : UnityEditor.Editor
{
private void OnSceneGUI()
{
Event e = Event.current;
if (e.type == EventType.MouseDown && e.button == 0)
Debug.Log("LMB was pressed");
}
}
why is the text never logged to the console? Ik onscenegui is getting called but the ifstatement is always false.
ye it didnt but i think it was because i was running in debug mode
oh right, but they were using the resources version before hence this happening. Object/GameObject one shouldn't get assets
there is no right answer because we don't know exactly what you plan on doing with it
Great it works!
unity 2d colliders only work in X,Y space so you gotta take that into consideration @cerulean badger
thank you!
hmm, i wonder...
This doesn't return Assets (for example meshes, textures, or prefabs).
but what if I constructed a mesh at runtime?
that's not an asset
hmm thats not something i thought of 🤔 no idea tbh
doesn't it also work with Interfaces, or is that just GetComponent
I want the jumping system to Interact properly with physics, applying collisions, making the player fall in case of a higher place and stuff. The player also should move freely while in air
getcomponent can get interfaces i swear ive done that before
find may not accept it with the generic arg version
i know for a fact it works for GetComponent just dont remmeber if it did for FindObjectOFType
yep, no clue why it still is null
im checking and modifying some things in case its the mythical "oh, how couldnt i have thought about that b4" but cant get to it
how do you call NextGameState()
I have a feeling its somehow being called before InitializeManagers()
it should not, since initialize should be instant, and i press the button on a few seconds of delay
Debug.log
armyGridManager = GetComponentInChildren<ArmyGridManager>();
Debug.log($"did we grab ? {armyGridManager }")
i write the debug.log exactly after line 106 right ?
oh wait u do have a bunch of logs after, did t
yep
this is going in circles plz learn how to use a debugger to figure this out 😐 @radiant frigate
This whole initialization problem could probably be avoided if these managers were simply attached to the game manager and referenced via inspector
I'm pretty sure the game manager you've dragged into the button is not the same as the singleton that has all the stuff set up
tbh this ^ prob
how do I detect cntrl left click inside of the scene view in an ediot script?
ok
there is like an event trigger type thing for editor though afaik
The method on the button should really be something like
public void NextGameStateForButton()
{
GameManager.instance.NextGameState();
}
That way you make sure that it's calling the instance's method
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Event-isKey.html I think it was this @steep dust
i added them as a child earlier tho, ill try to make it via inspector
i really don't like using GetComponentInChildren
it can blow up in your face in some surprising ways
serializing in inspector > GetComponent on self/children
(like when you add a new component and it gets grabbed instead of the existing one)
lol i think i found my issue tbh I had the code inside of a custominspector script and when i left clicked it deselected it. I changed it to trigger on control left click and since you dont deselect what you're already hovering in the heigharchy when holding down control it started working
makes sense
btw hi caesar !
Well, if they're already children of the GameManager then it would be pretty normal to just set the references directly instead of writing a wall of code
also long time no see
And hi
beginners do some truly weird things before they learn the ways of [SerializeReference]
ideally, the only time one should really use GetComponent is when grabbing a dynamic object and usually doing TryGetComponent
GetComponentInParent is a lot nicer. You often have one obvious correct answer there
I use that for things that must be attached to one of my game menus, so that I don't have to tell them all about the MenuController
GetComponent makes sense when component A absolutely must always be next to component B
i want to announce that it works!
But even then, I prefer to just make it explicit
I'm curious what was breaking previously.
same
I wonder if the game manager getting moved to DontDestroyOnLoad broke something
but as a wise man said (probably) "dont repair whats not broken"
might be the case
if it aint broke...wait..
I'm pretty sure instantiating with a parent that lives in DDOL is fine
i do that a lot in my menu code
kek
it's not like it winds up in the main game scene and gets lost
if it works but fucking shit then refactor it later ™️
indeed
//Todo: will need to refactor this
3 years later...yeah that aint done
LMAO
I love piling up technical debt
tbf im doing a very small game that should not become spaguetti code enough to make me want to start from 0 once i learn more about coding
spoiler alert: most of your beginning projects will be spaghetti no matter how hard you try
oh yea the code we wrote when learning was trash but you gotta learn!
with time you refine how well those systems you make become
(im completely delusional with this quote btw)
you guys are all goated
also at the end of the day you're making a game, it just needs to be fun and more or less performant . No one is gonna look or care about the code, as long as you are able to mantain it is the main thing
ty for the big help
yes, im making a demo for my friends to try out
(by demo i mean mini game, prolly wrong term)
me too ! but with netcode atm lol
what is netocode?
neato code. typo lol
Netcode = Networking Code
i have a random 2 week minecraft phase but isntead of minecraft coding
ohhhhh (still no clue lmao)
think multiplayer like uhh Among Us
coop type deal
so a multiplayer game
yea
same here but mine is local
thats the difference right?
yea
hence the "networking code"
I like the cooler term "over the wire"
makes sense now
LMAO
i would love to do it online also, but i want to actually finish it and dont get depression lol
it will be years probably. I know I waited at least 4 and I still feel like baby in comparison
if you have anything you want to show to someone at any moment, my dms are open!
if you wanna infodump me about your games
will do 
Busy with university rn, but I do plan on releasing a demo on Steam, preferably within a month or two, depending on how my final exam will go.
i would love to get a notiffication whenever its up!
I'll let you know. I'll probably also post about it in #1180170818983051344
noice
Hi, I need to assign my object named src to this, but it's not in the hierarchy as it's from another scene which transitions into the one I'm working on right now, meaning that I can't drag it into here.
Is there a way I can do that? or would I need to use another method?
Pass the reference to it via code
would I need to do it in any special Unity way or can I do that as I would with general c#?
Can always handle audio in a global matter and make a singleton that holds onto them
As long as a 'general C#' way works, go for it
You need a reference to your audio source, reference to the component with the src field, pass it in
A singleton is one way to do it.
thanks, worked
guys how on earth do i fix NUnit.Framework not being recognised as a namespace
ive got a Assets/Tests/Editor folder where the test script is with an assembly definition file
you need to add the test framework as a dependency in your asmdef
as in, as a reference?
ohhh
now test runner doesnt see it wtf
ok i had to remove the tests folder entirely
and generate it via test runner and that seems to have fixed it
so unintuitive though
also for some reason it's also not seeing inheriting classes, only the base class
it sees BaseCipher and not the other two despite sharing the same asmdf file
What's in them? What are you trying to do? What errors are you getting?
probably just needed to regenerate project ifles
as in retype it
maybe but i dont think it did idk
no its back to being broken
im going to restart unity and hope it fixes
ok now there are no tests apparently
Did you add your normal game assembly as a reference in your test assembly?
yes
And CaesarCipher is in that game assembly?
Just go back and make sure all your asmdef changes were saved
you wont guess what it was
Im pissed off… how do I get audio to not desync when using Unity recorder package with Timeline? Sound effects too near the start of the TL are playing desynced. I already set the sounds in import settings to preload
this is a code channel
could someone explain this to me or point to a resource, I sort of get what it's doing but it's hard to wrap my head around
how do i fix this? its my first time trying to code something i just followed a tutorial
you declared the variable "OnFoot" instead of "onFoot"
follow the tutorial better
Now one would be able to tell you what it's doing without any context.
does this help?
thank you sir
characters are just numbers in the computer. You can use this table to get the numerical equivalent for the letters:
https://www.asciitable.com/
A is number 65.
So B would be 66
If letter is B, then index will be 1, since you did 66 - 65
Ascii character table - What is ascii - Complete tables including hex, octal, html, decimal conversions
Basically you're calculating the index in that alphabet array
I managed to fix it by waiting 5 seconds before starting the timeline and the recording
So B - A is 66 - 65, which gives us 1, which is perfect because B is at index 1 in that array
ok that makes sense
still so hard to do in my head though
That's why we have the computers do it for us
Why do it in your head?
i mean just looking at the code, and visualising what its doing
might be because its late too
It's the difference between letter and A
You don't need to know what numbers each letter is
you just need to know they're in order
Try writing a few examples on paper. Or creating a diagram. This could help grasp the algorithm.
how do i fix this?
Finish declaring your variable
Also get your IDE configured
!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
variables in C# need a name.
e.g.
private <type> <name>;
You just have private <type>;
Can I not see the [HideInInspector] parameters on debug mode?
I kinda just want to hide them for the normal view
whats the simplest way to add a reliable fps counter that won't itself poorly impact framerate?
Use time.DeltaTime
void Update() {
float framerate = 1 / Time.unscaledDeltaTime;
}```
it would be impressive if you created a framerate counter that made your game lag
is there a way to play my unity project without alt tabbing from visual studio?
Attach Unity
even if you start it from Visual Studio you still have to interact with the Game View in unity editor..
Get a second monitor
do you mean this button?
yeah but all that does is press Play button for you, you still have to tab back in the editor , and ofc it also stop at line breaks if any
ah.. it gives me an error in some random script. i guess alt tabbing is required
whats the error
are those old? you got some compile errors
ah nvm fixed it. extension was for some reason attached to the function. i guess i have to enable the debug mode to use that button
yeah but again its more useful for break points and debugging than a way to press unity start from VS lol
got it ty!
oh wth i can leave playmode running.. edit a script and have the game updated?
cool beans
it works very limited
sometimes you will get Missing script errors
best to reset if major changes done
got it
hey
i'm new to unity can anyone suggest me how to get started and learn on how to make scripts for player movement in a 2d game
Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.
thank you
This is a thing I can do with methods right?
yes, that is called overloading
https://learn.microsoft.com/en-us/dotnet/standard/design-guidelines/member-overloading
What's the most sensible/practical way to have audio (in my case just a short clip) keep playing through scene loading?
I figured it out via DontDestroyOnLoad(myAudioSource) and then Destroy(myAudioSource, myAudioClip.lenght), but I was wondering if
a) there's some other better way of doing it, and
b) if the Destroy() call even happens if the GameObject that the script is in gets destroyed by the new scene loading?
Destroy is a static method, it has no information about what object it was invoked from so it would still happen, yes
You should destroy it after the scene finishes loading. What if the audio ends before the scene loads?
I see, thanks.
Speaking of static, for Singleton manager classes (in this case my AudioManager) do I need to have them attached to a GameObject in every scene I want to use them in? Or is it possible to just create them once in the start/main menu scene and once they exist they're accessible from anywhere?
you can use DontDestroyOnLoad
I know. And if I do do I still need the script to exist in a GameObject in every scene to reference it or not?
what do you think DontDestroyOnLoad does
doesn't sound like a code question. but make sure you have an event system in the scene
...I'm new and don't know all the specifics, why do you think I'm asking.
Also more to the point what's good practice? Do I just start my singletons in the main menu/boot up and then forget about them as long as I can be sure they exist? Or is there any point to have them lying around in every relevant scene too?
then what?
you've provided almost no information so i couldn't possibly say what you need to do
