#💻┃code-beginner
1 messages · Page 251 of 1
makes sense, but I assumed it was capped to 60fps so I didnt expect such a dramatic change in force requirements
It's not capped unless you cap it
yea I thought I did lmfao
regardless you want to use Fixed so it's consistent
ofc
That unity course has a few games. Like roll-a-ball, which is a great place to start. Brickbreaker is a good one. Battleship is great for ai. Then do a super basic 3d platformer just for getting some movement experience
Ok thanks
If you find yourself fighting/modifying the rigid body physics system too often, consider using non physics or kinematic rb. Oftentimes, it's easier to implement your own gravity than to fight friction/sliding and forces applied to your target - which will happen if your game isn't a ragdoll/roll-a-ball or physics simulator. Unfortunately, rigid body physics is extremely popular, so you'll be losing a lot of support if you're intending to use Character Controller or roll your own (kinematic/Transform)
I have a question about best practices with coroutines. I'm writing a function to crossfade between two audio clips in my audio manager script. I'm planning to have a coroutine to handle the fading out of one clip/source and the fading in of another, but I'd rather the calls to the audio manager not require the caller to start the coroutine. Is it common practice to have a public function like ChangeClip and a private coroutine called internally called something like _ChangeClip? Or how do others handle things like that?
As an aside, does the caller of a coroutine "own" that coroutine? As in, who would need to call StopAllCourtines() in order to halt it? The caller, or the script on which it was called?
You'll need rb physics for complicated physics behaviors though, unless you're wanting/willing to implement those yourself.
thank you , i actually finally achieve to do something , just need a lot of smoothing , thank you for this help
was thinking to far
I was referring to reducing or limiting your current velocity on button release. You'll probably not want to completely abandon forces and doing so probably still won't work the way you would entirely expect it to - you probably wouldn't want to be assigning the vertical velocity a positive value or zero if you aren't grounded/flying etc
i finnaly just apply a vector in started and another one in canceled
but later i might pass by something like this
Hey guys
I have this class.
In this class there's a bool variable and I made a property to get set it.
And in the Awake method I set this bool to true
Does this mean that the property is set to true too ?
You didn't use the property at all.
Oh, that was intentional (:
I wouldn't say the property is "set to true"
Available certainly evaluates to true, thouh.
Hi, when i create a default unlit shader and create material and apply it, the object disappers.
is this intended or is something wrong with unity ?
The mono behavior instance that started the script would be the owner of it. cs StartCoroutine(...);//This is the owner other.StartCoroutine(...);//Other is the owner
It's whoever StartCoroutine is invoked upon, indeed. The actual place you define the IEnumerator method doesn't matter.
(well, it doesn't matter for the sake of who owns the coroutine)
I havent touched anything in the shader code, its just the default shader that gets created when i click on create unlit shader
public void StartJump(InputAction.CallbackContext context)
{
if (context.started)
{
if (isGrounded)
{Debug.Log("isGrounded");
_jumpScheduled = true;
jumpForceactual = jumpForce;
}
}
if (context.canceled)
{
Debug.Log("Cancel");
_jumpScheduled = false;
Vector2 velUp = Vector2.zero + Vector2.down * jumpForceOnFall;
rb.velocity = velUp;
//rb.velocity = Vector3.down * jumpForce/2;
}
What do you think about this ?
In another class I called the property Available.
So is it true or false ?
It will be true once Awake runs.
so, for example, if you're referencing a prefab, Awake won't have run on that object
and the property will return false
Awake runs as part of instantiation as long as the game object that SpawnPoint is on is activated
bool foo = spawnPrefab.Available; // false
var point = Instantiate(spawnPrefab);
bool bar = point.Available; // true
@ivory bobcat true xD
hey, guys! I am trying to load my best time and make it in format of a clock. So, how to do that right here?
{
bestTime = PlayerPrefs.GetInt("BestTime");
int minutes = Mathf.FloorToInt(bestTime / 60);
int seconds = Mathf.FloorToInt(bestTime % 60);
bestTimeText.text = "Best Time: " + bestTime;
bestTimeText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
}```
but still the problem that i lost instantanetly my momentum and get drag to ground , how can i simulate a parabola ?
I don't know how to make that like I am displaying the best time text but I dont know how to convert that on that format
You're doing it with the format string right now. Note that the first bestTimeText.text = ... is useless because it gets overwritten by the second one
If you need both, then put the Best Time: in the format string directly
"Best Time: {0:00}:{1:00}"
An alternative would be to store the time as a TimeSpan, which handles time automatically and supports formatting
Just noticed but your int bestTime parameter is useless because you overwrite its value on the very first instruction in that function
Whatever you passed there when executing the method is lost
why cant vs find playerRb?
ControlGravity is static. Static methods cannot access non-static things
oh alright
thank you
what is the name of the G button because this doesnt seem to work
it tells me to change the input settings but i cant find them
Edit > Project Settings > Input. This will search for the axis there
read the documentation for https://docs.unity3d.com/ScriptReference/Input.GetButtonDown.html
you probably want https://docs.unity3d.com/ScriptReference/Input.GetKeyDown.html (with a KeyCode argument)
so the "Fire" button could be bound to the spacebar and to a button on a controller
and both of those things would be able to make Input.GetButtonDown("Fire") return true
do these variables "Gravity", "Sensitivity" etc. matter if i want to just do something when the button is pressed?
You should be using GetKeyDown instead
it says that the input key named G is unknown
Show your code, you need to pass a KeyCode value into that
a string doesnt work?
It does, but the enum value provides more safety, you cannot pass a random value without it yelling at you immediately
Can't do KeyCode.fkljglkf for example, you get a compiler error
you gotta create a reference to the TMP object, and then in whatever script has that reference you can do referenceToText.text =
you can do stuff like
integer.ToString(); and it’ll convert the number to a string format
or just manually type the number, but i’m sure you want that to work dynamically so using a variable would be better
i want to add dashing to my game
the code been writted but idk how to add a button to it
i asked cahtgpt
and idk what to do from here
What do you mean "Add a button to it"
like an input
To an input asset?
Well the first step I guess if you're using ChatGPT is to follow ChatGPT's instructions. You haven't followed step 1 and 2 of its instructions
How did you add all the rest of them if you have other inputs?
Just do that again for your dash button
i imported something forgot the name
k ill try read it more carefuly
btw is the instructions correct
generally but it mostly seems geared towards creating a whole new actions asset which you likely already have one of.
it's also only telling you how to create the action
not how to bind it to your code
😭
It's probably better to follow actual input system tutorials
You should probably just read the actual documentation for the Input System
rather than asking CGPT
Then you won't need to wonder if it's done something right
can u send pls
you'll know it's right
ty
I'd only recommend using ChatGPT for summarizing Unity's docs
It's not reliable enough to generate tutorials on its own
so, I have this code, and it sorta works ig, but when the object drops below 1 health it destroys the atual object rather than the clone of the object. How would i make it destroy tthe clone instead?
this will destroy whatever object the script is on
This code should basically not be running AT ALL on the "original". Since it is, you've done something wrong
so how would i make it destroy the clone thats being affected rather than the object?
Most liekly rather than properly cloning things from a prefab, you're cloning things from an object in your scene
it will do both right now, because of how you set things up
Make a variable, make the variable = instantiate, then refer to the variable
But each copy will only destroy itself
not even necessary in this case - the copies already refer to themselves
wha
they just need to make sure they're instantiating from a prefab instead of a scene object
If this object's health is below 0, it will destroy itself. That seems like a reasonable thing for something to do
so what should i do to make the object be a perfab
:/
I don't know what you mean. If this code is running at all then it definitely is not a prefab
Drag the object into the project window to create a prefab from it. Then delete it from the scene
Then have your spawner reference the prefab instead.
ok make your spawner reference this instead of the scene object then
ok ty
also you probably want to delete the copy in the scene
MyInstantiatedObject = (instantiate code here)
If (health <= 0)
{
Destroy(MyInstantiatedObject)
}
no reason for one to be there
But yes, this isn't necessary if you use prefabs
this implies the thing tracking health is not the object itself
they would be separate objects
Its not letting me
🤷♂️, not sure why you'd even want to destroy the object on the instantiate script
what's not letting you do what
it gives me that red circle cursor
where's your spawner? Is your spawner not in the scene?
Just make the instantiated object have its own destroy script
when i try to put it into this
You need to show more context
Nothing they've said so far has indicated that this is the instantiating script
it is
where is "this"
more context
i cant
ok so i messed up bad
Show the enemy prefab
i already deleted tghe object
just ctrl z to get the enemy back in the scene and make a prefab from it as I described before
oh i didnt know ctrl z worked on that
mine cant do that
0-0 i cant drag it into the project window because im dragging it around the scene
...what?
drag it from the hierarchy window to the project window
idk 😭
not the scene window
my explanations are bad
don't worry about it, that's just some new shit that isn't needed
i see
how do i get to the input action
should i create a thread?
open the input actions asset you created
how
This isn't related to code so no one here is likely to answer it
Oh
now the script for the enemies isnt working
This seems like you just want to put a texture on something or put an image behind something
yeah thats more of a unity question i think
they dont move or anything
do u mean project settings 😅
no I mean project window
that would be where assets live
the window labeled project
the window created specifically to hold project files
that window

rendering?
are you trolling me sir
"It's under general"
"Okay but by general did you mean rendering"
Well to be fair
why would they mean rendering if they said general
mhmmm
then you look at the project window
and find your asset
and open it
assuming you created one
if you didn't create one, you create one now
If this is a premade project, there will already be one... somewhere
Yeah because the project window is probably open already
probably because it was already opened
as we said
now go look at it
the one labeled "Project"
the script for the enemy wont work now, i need this player transform thing in here for it to work but when i delete the enemy object it wont let me put the player into the player transform thing
that was probably a bad explanation
oh top
You'll need to set the Player variable on the instance of the object you create in code
prefabs cannot refer to objects in scene
how would i do thast
would i have to change something here
It might help you if you read this really quickly https://docs.unity3d.com/Packages/com.unity.inputsystem@0.9/manual/ActionAssets.html
it's probably this:
You would need to set player variable on the instance of the object you create in code
ty ill try find it
it wont let me
why not
gives me the red circle with a line going through it looking cursor
i got to here
Go back to this message and re-read the last two words
#💻┃code-beginner message
and i pressed that button and it did nothing
In code, set the variable after you spawn it
oh yeah that's something else
I don't think you have an input actions asset yet
beginner D:
but my charchter can move and attack
And how are you handling that input
i dont understand such complicated words
Well - is that script even using the new input system?
do you know what a variable is
yeah
do you know how to set a variable to something
not in unity i dont think
isnt it just blahblah = moreblahbalh
with a few more words like public float for number values
So, you know how to set a variable
So set the variable on the object you instantiate, not the prefab
whats instantiate
The thing you're doing to make there be enemies in the scene
i haven't really i just need like a base idea of how i would do that
by any chance how would i access this and add an inpuit for dash
how are you making enemies exist in the scene
how
idk
then this conversation is over
I literally cannot continue further without this information and you don't know it
so there's nothing more to be said
If you don't know how you're spawning something, how am I supposed to know what you are doing
That's not the input system
to use as my dash
im using that
so how would i make them follow me.....
then what you've just shown isn't that
and the code work
idk how to access it
i tried the thing that the person sent and my thing dosent have the thing under it
Open the input actions asset you've made
i dont understand how instantiating them has got to do with me not being able to set this
oh ok the conversation really is over
nice
thanks for the beginner help
why don't you answer the question?
Set that variable after you instantiate it
Sorry I cannot respond in the twelve seconds after you posted that I am also doing my actual job here
idk where to find it that the provlem
why dont you read what i said.. i clearly mentioned in it "i dont understand"
surely you know how you are creating instances of the enemy
you wrote code that does this
no
actually
im a beginner and watched a tutorial on how to do some basic stuff and still dont understand how it works because im a beginner
literally started yesterday
So, how are you spawning the object whose variable you want to change
Okay. But you still must have actually written code that makes the spawner work, yes?
stop spamming
sorry
Im strugglign to find a starting point to unity, the doc has no actualy starting point
this is not the input action asset. This is the PlayerInput component.
It does currently reference the input action asset, though.
!start
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
Yeah and where do I go from there
Instantiate returns a reference to the object it's made. Set that object's .player variable
omg what kind of treasure hunt is this
It just tells me to use premade things
i recommend trying to recreate a small game like flappy bird
well, you found the wrong thing instead of the right thing, so it's not surprising that you need to look elsewhere...
yh but ive been looking for a while
just double click on the reference to the Input Action Asset and it'll be highlighted in the project window
how would i set it to that
is there like a websiter
Do you know how to set a variable
to how insantiate woeks
follow the learning pathways
we went over this
that's how you get started, yes
Ok
Learn the basics of C#, use the basics to create a small game, when you finish that game create a slightly bigger game.
Right. So, store the result of Instantiate in a variable. Then set the .player variable on that variable to the object you want
Ok
how would i store the result of it though
Learning Unity, and programming/modelling/drawing, is all about practice
by creating a local variable.
Do you know how to set a variable
you've created two different InputActionAsset assets
all i know is the absolute basics of setting a variable
you named one "Player movement" and one "PlayerInputActions"
This is the absolute basics.
dam so how would i resolve this
well i know less
i think one of the is usless
With an equals sign
ok so i should write blah blah = insitiate...
then set that variable's .player to what you want
how do i know which 1 to use somone pls help
Which one are you actually using?
whichever one your PlayerInput component was referencing is probably the one you were using
where in my code does it say .player? im so confused
You can type "unity instantiate" into google and it will bring you to the documentation
Which will help a lot
im i using playerinputactions
if you have absolutely zero idea how C# works then you should seriously consider following the Unity Learn pathways
we can't teach you ever single aspect of programming one message at a time
That's the variable you're trying to set
Store the result of Instantiate in a variable
Set that variable's .player
that's the thing you're trying to do
okay, so use that one
ty i finally found it
I'm working on a 2d game, but I want the ability to have a 3d object as a part of the ui- i.e. there's a robot, and the player can rotate the robot to get a better view of this. I'm not sure how to implement this- it should be able to go over ui. I haven't done anything like this before- is there a standard way of doing this, such as a secondary camera and a camera view for that?
What would the variable do so i know what to call it
im not asking you to
It will hold the instance you have just created
and this is private variable?
It's a whatever you want variable
does anyone know how to set the background of a unity project?
but there's no reason for it to exist outside of this function
so probably not a class variable
Still not a code question
A local variable (one declared inside of a function) can't be private, or public, or anything else. It only exists inside of the function.
but a variable has to start with private or public and stuff liek that
no it doesn't
No. A member may have an access modifier.
members being things like fields (variables declared in class) and methods (functions declared in a class)
Local variables are not part of a class, becaues you declare them inside of a specific function.
i learned something new and it’s not even my question
EnemyController has a variable named player. player is a member (a field, specifically) of the EnemyController class.
public void Foo() {
int bar = 3;
}
bar is a local variable I declared inside of Foo
public class MyClass : MonoBehaviour {
public void Foo() {
int bar = 3;
}
}
bar doesn't exist outside of the Foo method.
Local variables should be used for things you need to temporarily store.
such as, for example, the enemy you just instantiated
you don't need to store it for a long time, so you don't put it in a field
you just need to hang on to it for a moment so that you can do something with it
so where would i store the variable for insitiate
Where you call Instantiate most likely
Theres no template called 'Microgame'
Oh ok
so why did you show me this
Because that is the variable you want to change, right?
You asked what .player was
so I showed you what it was
your variable named player on the object you're instantiating
from what you explained, all I understand on what to do is this:
clone = Instantiate(Enemy, pos, Quaternion.identity);
how did you declare the Enemy field? this will be important.
show me the entire line where you declare it
private GameObject Enemy;
this?
yes, although I presume it's got a [SerializeField] above it
Yeah
You are currently referencing the prefab as a GameObject.
Instantiate will return a GameObject.
This isn't very useful, since you want to set a field on the EnemyController component on the prefab.
Random recommendation - that should probably be named "enemyPrefab" to be clear about what it is!
indeed
You should change that declaration to:
[SerializeField] private EnemyController enemyPrefab;
This will allow you to reference the EnemyController component on the prefab
Instantiate will return an EnemyController.
You'll need to re-assign the reference to the prefab after making this change.
i dont know how to declare it
look two lines up
thats what i was going to ask
you declared a local variable named pos of type Vector3 there
Yes but its not going to be a vector
You declare variables in C# with:
TypeName variableName;
okay, but what is it going to be, then?
Thats what i was going to ask
well, what is the type of enemyPrefab?
EnemyController
That's the type that Instantiate will return.
and thus that's the type you want to use
EnemyController clone = ...
so what will i put here
Name:Clone() prob
what you already have.
store the result of Instantiate in the variable.
so there will be 2 lines with that
all on one line.
just like Vector3 pos = transform.position;
you've instantiated two enemies
so get rid of the second one
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
clone now stores an instance of EnemyController, so you can access any public field on it and store whatever you want in it
clone.foo = bar;
much like how you set pos.y = Random.Range(-5, 5);
wait so whats changed
i still cant put the player object into the zombies script on who to follow
So how would it follow the player
someone has to give the EnemyController the player's transform
You have the enemyController script of the object spawned right here ^
It's called clone
your telling them what to do without saying how to do it
thats like giving someone ingredients but no recipe
I'm not just giving them the code.
I am working towards the answer.
We don't spoonfeed here
It harms them
thats not what im saying is it
learning is the best way
And it is against the rules here
that would be giving the product not the recipe
these metaphors aren't working
Do you want help?
If so, please humor me.
you have the newly instantiated EnemyController stored in the clone variable.
What fen is doing is the absolute best way for them to learn
i said giving ingredients with no recipe,
not watching someone cook for u
Stop giving weird metaphors. If you wanna help then do so
Fen is helping, you are not
Why do these people have the same damn profile pic lol
name change.
lol
o.o
so, you can read and write its fields, call its methods, etcetera
oh, no, it is two people
baffling
Or one person with two accounts
you know whats funny, is that PraetorBlue has giving 2 sentences of advice and has prob helped more
no
no
there would be no need
Your silence is appreciated.
thank you
That sounds exactly like what one person with two accounts would say
quickest way to edit the line of code below to make it so that the movement is always rounded to 1 or -1?
public void Move(InputAction.CallbackContext context)
{
horizontal = Mathf.RoundToInt(context.ReadValue<Vector2>().x);
}
ur silence is also appreciated
can i get help now
what
You have been. Listen to fen
You haven't done what they asked
yes i mean all of this nonsense to stop
Yes, I do hope rain stops with their nonesense
The enemy spawner is placed in the scene, correct?
its hard to listen to fen when im being accused of two accounts O.O
It's not something you instantiate after the game starts.
yes
because they dont understand something you said doesnt mean they arent listening
Okay. So, the enemy spawner can store a reference to the player.
[SerializeField] private Transform playerTransform;
The enemies can't, because they aren't placed in the scene. They're spawned in later.
That's the problem.
so the player would also have to be a prefab?
No; prefabs can reference each other, but that's not very useful here
The enemy could know about the player prefab
But that's not the actual player in the scene
The enemy spawner can give the reference to the newly-spawned enemies.
I never said they weren't listening. Grow up. Help or leave
I was telling them to continue listening to fen, because fen is helping
var instance = Instantiate(prefab);
instance.foo = 123;
instance.bar = "Hello";
e.g.
in your case, you need to assign clone.player
the enemy spawner tells the enemy about the player
so i would have to make a variable with the players location
You already have the variable
You already have a variable called player that holds a Transform.
clone.player
You will need to add something to the enemy spawner, though. #💻┃code-beginner message
The enemy spawner holds the player's Transform.
The enemy spawner holds the enemy prefab.
The enemy spawner instantiates the enemy prefab.
Then it gives the player's Transform to the newly spawned enemy.
Now the enemy knows about the player's Transform.
so i have that variable
playerTransform
But what would i actually do with ti
like how
Transform has a position property
why don't you tell me what this does?
particularly lines 2 and 3
If the enemy has a reference to the transform of the player, it can get a constantly updated position
stores 2 local variable inside instance
right
it sets two fields on instance
it sets instance.foo to 123 and instance.bar to "Hello"
now how about this one?
instance.baz = myField;
baz?
You're thinking is right, I believe. But LOCAL variable isn't the right term. That would mean it's in a method
what does this line do?
stores like
lemme think
stores the data from myField
which im guessing is another variable
instance.baz
Right.
It stores myField in the baz field on instance
(and "variable" is perfectly valid here, too)
now, we just need to change the names here to make this solve your problem.
clone.??? = ???;
Almost -- clone.player = playerTransform
not clone.pos
but otherwise, exactly (:
We store playerTransform into the player field of clone.
And since clone is our newly spawned enemy, the enemy now has a reference to the player's Transform
Now the enemy can figure out where the player is and chase them.
wouldnt that include some complicated math
Correct.
An important thing here is that if you store the position of the player, it will not UPDATE with the player.
If you store the transform component OF the player, the position WILL update
well, that's a separate matter
This is a very common pattern. Someone in the scene tells a new copy of a prefab about stuff
random examples from my game...
cant you just put it in void update and it will
No
gameMode = Instantiate(gameModeTemplate);
gameMode.Configure(gameModeTemplate.ConfigData);
controlHint = Instantiate(controlHintPrefab);
controlHint.Create(label, action);
root = Instantiate(configListPrefab);
root.configurable = configurable;
You wouldn't have a reference to the player TO update the position without some component reference
It would just be some numbers
transform.position is the current position of a Transform. It's not going to change over time.
It's just three numbers in a trenchcoat.
Transform is an actual unity object that's attached to a game object
so what do i do to make it do all of that
Vector3 is what is known as a value type, meaning whenever you set a Vector3 variable, you're setting the value of it. Once it's set, it's set, and it'll always be that until you change it.
Transform is a reference type, it refers to an instance of something. A different thing could go and change values on that instance, and anything else that references that object would see those changes
Store the transform...
Didn't you already have code to follow the player before you made the enemy a prefab
yes
If your only problem is that you couldn't reference the player's Transform, your game should be working again now.
should'nt that be rb.movePosition(rb.position + ...);
You've got your player again.
idk it was working before i made the enemy a prefab
the enemies dont move they just stay at the spawner
First step: check your console
seems pretty relevant!
ah
Show the code where you set player in the spawner code
oh wait
spawner code
Where do you set it on the instance you create during the game
assign it in the inspector im guessing
it's a prefab
you know, the code we were just talking about?
u can assign prefabs too right?
yeah
The thing several people just painstakingly explained for the past hour and a half
prefabs cannot reference scene objects.
okay, so you don't actually do anything
Fair enough
you need to actually write the code
yeah i was asking that earlier
Where is clone.player =
What happened to all of this
You had it
you had the answer
you finally cracked it
and then just
didn't write it
would it be he needs to assign the value where the object gets instantiated? like
instantiatedObject.reference = blah
well, why don't you reason through that question?
hey guys, so i have this problem when i try to use animations in my game that its not working in the code:
once you realized you used the wrong name at least
you want to give the newly spawned enemy the player's Transform, yes?
what does "is not working " mean
because im braindead
i dont actually think about what im writing
im slow
Start doing that
i mean it seems like the visual studio doesnt know animator
i try
Give yourself some goddamn credit and think.
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code
• JetBrains Rider
• Other/None
configure it
i think but this is too confused
There are only a few places you can even put that line of code without getting an error.
confusing
maybe start with a smaller project bob? do something simpler where you only worry about a few parts
Just, guess
where do you think you should put the line
read each line of code and describe out loud what it does
Correct, since that's the only place that clone exists.
anywhere after the enemycontroller line?
That's where clone is declared, so yes.
You can't use a local variable before the line that declares it.
hey it worked thanks!
so like that
well, did you assign playerTransform?
i tihnk so
Did you actually assign anything to playerTransform in your spawner
Check
i did this
That does not assign anything to it
Okay and where did you set it
That declares the existence of a field.
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
so what would i assign to it

What do you want it to be
the position
what is playerTransform
I get that you're invested but at some point it becomes spoonfeeding despite all your attempts to have him reason about what he's doing
surely you know how to assign a reference in the inspector
If you want it to be a position why is it of type Transform
yeah I'm running out of energy here
doesnt transform store the position...
i respect the dedication
im running out of hope
you badly need to follow some written tutorials
Literally put in a single frame of thought into it
it's called playerTransform
what do you think it should store
You named it that
You know what it should be
so set it to that
No
It is a reference to a component
That component HAS a position PROPERTY
But the transform itself is not a position
thats what i meant
then why didn't you say that
Ok, well still no. It is a lot more than just that
right here
the thing you were saying was not correct
So, knowing this now
what do you think
the variable playerTransform should be holding
transform
of?
the player
but uh
nevermind that would just be annoying
i sweat to god there literally nothing in my code thats holding the players transform
for me to give it to playerTransform
so drag
it
in
the spawner is in the scene with the player
drag it in
why
because i dont know what to put in it
Declare the variable as public or serialized and drag in the player
i was asked some thing about where it was declate
"assign" meaning to drag something into the inspector
but.i.cant
i suppose that does have a double meaning
why.not.
Is your spawner also a prefab
if so, stop
yes it is
that has nothing to do with being a prefab.
If you've dragged a spawner prefab into the scene, just assign playerTransform on the instance in the scene
its an object
Then why do you keep fucking saying it is
Think before you answer god damn it
i said it fucking once
Stop just saying shit when I ask a question
This is like the fifth time I've asked a question and you've answered it with the exact goddamn opposite of what you're doing
Give it like, a single frame of brainpower, check the question, and give the actual answer
am i not allowed to get words confused with eachother on my second day of using unity
my deepest apologies
i have a car asset i threw in my project, i and i noticed this, its for the audio i believe, to ramp up the pitch as the car accel..
my question is does this affect the entire scene? (my gut says yes) just want to confirm.. and if so.. bad asset imo
So, anyway, back to the issue. The spawner is not a prefab. So drag in the player to the variable
setting of the fixedDeltaTime, that is..
WHAT DO YOU MEAN DRAG THE PLAYER THE THE VARIABLE
am i still in visual studio or in unity
tell me when you want me to switch
other wise i will get lost like right now
when * you drag something * its referring to the editor
you don't drag things in VS
sometimes they use an odd selection fo words
this is completely standard, and you've already demonstrated that you know how to drag things into the inspector
given that you were trying to do it with the enemy prefab
so i get confused if they mean what theyre saying in a way that matches the dictionary definition
havent i said i cant like 5 times
imo your being abrasive.. just be humble.. we're aware you may not know certain things.. cussing and using all caps isn't very productive.. just say you dont know them
Press the left mouse button while hovering over the player object in the hierarchy. Then, and this is important, without releasing the button, contract the muscles in your arm such that your hand moves the mouse across the table. Use the power of 𝕥𝕖𝕔𝕙𝕟𝕠𝕝𝕠𝕘𝕪 it will move the little white arrow (called a "cursor" in nerdy internet jargon) accordingly. Now, the hard part. You need to position your arm and hand in such a way that this "Cursor" overlaps with the box that describes your playerTransform variable. Then, and only then, do you release the button
couldn't have said it better myself
its almost like... i cant
like i have said MANY times
Screenshot the entire editor with the enemy spawner selected.
Why. Not.
The entire screen, please.
You said the spawner is not a prefab
is you hand broken? or it doesn't allow you to drop it in the slot?
Wild guess compile error
Yes. The thing with the playerTransform on it
No, we've seen their console (like an hour ago at this point) so it's definitely running
Not a random unrelated object.
well i have one on the enemy called "player" and right next to it it says transform
Yes. That's why I said spawner over and over again multiple times and used the name of the variable in the spawner and asked if the spawner was a prefab because I meant the spawner
if you refuse to pay attention, your game will refuse to work
setting fixedDeltaTime in 1 script modifies it everywhere in the project basically? am i correct in that assumption?
just trying to fit my foot in the door for a sec
yes yes im not paying attention
Wait, this is your second day? Why are you on here? Why are you doing any of this. STOP, DO A BEGINNER TUTORIAL
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
that's my understanding.
ok, this is a dumb asset then..
i wouldn’t imagine it would affect the whole project’s master volume. is there a separate function to affect the project itself instead of the audio clip?
let me cook
you're just changing the timestep
CAN I JUST GET HELP... what do i do next
that's some funny code.
That would be fine, but this was not that. You need to have the basics down before asking here
why would they do that?
Spawn literally made a gif of what to do
yes and I DID IT
oh that is funky
jesus christ
cool so what's the fuckin problem then
nothing
good
ya, the asset is awesome.. but this is ridiculous imma try to reverse engineer it and remove it
we're done
ok THANK YOU
You need to help us help you if there is something wrong. Wtf is even going on
i believe in you
It looks like it's trying to adjust fixedDeltaTime to stay proportional with deltaTime
@void siren i still recommend trying to recreate a smaller game. seems like you’re taking a bigger challenge on than you’re ready for
I'm actually not sure how changing deltaTime affects how often physics updates happen..
If it doesn't, then that code would make sense
nah ive made this game many times on other coding things and i wanna try it on here now
this is usually the first thing i try to do
10% timescale means you need to update physics 10 times as often to get the same apparent physics update rate
let me see if the cars are rigidbodies.. or translations
(assuming this is the case)
i make it harder for my self, i know
and for everyone around you. that took an extraordinarily long amount of time
i wish you luck then. sounds like an unintuitive way to go about it to me
i think you’d learn faster going about it another way
i wanted to include that into the message but i send it too fast
meh
anyways ima do the tutorial now
damn homie really does just want it to be harder
wild af
yeah, i do
disabling the TimeManager (that script i shown) breaks the car script completely.. but no compile erros
lmao that sounds like progress in a sense
i want to modifiy time values in my own scripts (for my player and game/) maybe i can integrate it INTO the script
that this scrip uses
b/c i dont feel like a wild goose hunt
lol
it also makes me want to quit
he was talkin to me i assume
you just need to do some tutorials
no offense.. but u should probably coming seeking help here atleast after watching/ learning for a few days
if not a week or so
we use terminology that we assume people will atleast be familiar with
if u dont know that terminology its gonna hinder ur progress
why do it this way if you feel frustrated?
feels good when im done
dopamine++
rather than doing some boring tutorials
you know you don’t need to, right? like there’s no shame in making things easier on yourself
you don't get a runner's high from falling off a cliff
look, i'm going to be as polite as possible here
you are not in a position to "just figure it out"
I know im not
You are a toddler in a welding shop. You are just going to hurt yourself.
im yoinking this
it took well over an hour to add a few lines of code, and you repeatedly demonstrated that you have no understanding of fundamental concepts
usually how i learn coding languages is i just do some trial and error then do research when i want to quit
and it works
im on the research stage
You cannot do this. I certainly won't be enabling it any further.
Then do that and keep us out of it
have you tried a less frustrating approach?
what?
if its a series of getting frustrated and quitting, maybe you have an approach that is unhealthy
great. put that energy into following well-written tutorials on !learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
misread it. but if you want to quit so frequently, maybe you should try something different
first i experiment then learn
I learned Unity with very few tutorials. I also happened to have at least eight years of programming experience already, plus some prior experience with game making.
I didn't do it because I decided I'd get brownie points
I did that because it was the most efficient way for me. It is clearly not the most efficient way for you.
it is though, i learn languages in a week or two doing it that way
only putting a few hrs into it each day
is there a debug / stats like window to monitor timescales?
what languages have you leaned thus far in this way?
no; i'd just stick that in an OnGUI somewhere
Scratch
really
I suspect "learn" is doing a lot of heavy lifting here
just a joke bub, calm down lol
i am calm...
good, i dont wanna see no more caps
fr though. what have you learned?
can u enlighten me on how to do that real quick? or should i just look it up?
by "this" i mean im currently leanring it
i don't use OnGUI that often, and i know u do alot
OnGUI lets you call GUI and GUILayout methods to draw IMGUI
Here is a basic example
are you fluent in these languages?
yes
void OnGUI() {
using (var _ = new GUILayout.VerticalScope()) {
GUILayout.Label(gameObject.name);
someBool = GUILayout.Toggle(someBool, "Toggle Me");
someFloat = GUILayout.HorizontalSlider(someFloat, 0, 1);
if (GUILayout.Button("Click me")) {
Debug.Log("Clicked");
}
}
}
thanks so much
GUILayout automatically positions the elements for you. GUI does not.
php i use on a website me and my friend are making and with python i make programs and games
then the difference might be not only are you learning C#, you’re also trying to learn Unity at the same time
Note that if you have several objects all trying to draw stuff at once, they'll all be overlapping
You can use GUILayout.AreaScope to create specific regions (it takes a Rect argument)
i want to see whats going on in this asset
My IMGUI debugger is one enormous OnGUI
It calls methods on anything that's being debugged to let them draw stuff
seems like a fun challenge
that using keyword just automates the disposal of the scope after I'm done with it
are you having fun? getting frustrated like you said you are?
codes sooo counterintuitive..
i havent figured out what modifies the time scale bsides this script
i am having fun. the only time im not having fun is when 10 people try to explain 10 different things to me about 1 subject
u shouldnt post in a channel that has 10s of thousands of people then..
that will happen
yesterday i got only 1 person helping me. today i wasnt expecting 10 people
lol, thats fair
sometimes theres crickets in here.. other times its procrastination city
and yesterday i was actually learning from it
exactly
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
do remember not everyone will be willing to explain a concept to you that can be learned from the beginner courses
clearly 10 people were willing and it was too much
i had someone to do it for me once?
i didnt get them to write me a paragraph of code or something
the other day when i’m assuming you had one person talking to you
i’m not saying they gave you code. but it seems they explained a principle to you
ah then thats different
It’s definitely scaling the fixedDeltaTime up and down as the timescale changes
oh yeah, and that makes sense
I have a "Headless mode" for my game that turns off the camera and cranks up the timescale really high
When I do this, I get a ton of FixedUpdate calls per frame


