#💻┃code-beginner
1 messages · Page 598 of 1
its just darkness
There's more than 5 links. And you can use any of them.
there all darkness
Take some time to observe what you are seeing and what is being told to you
Paste the code, save, share the link. It's not rocket science.
ok
If that website doesn't work, try a different one.
Or even just the discord code syntax that's explained after the links in the bot message
theres no share button
A tool for sharing your source code with the world!
wait that might of done it
is that it
A tool for sharing your source code with the world!
they are the codes
i done it
Add some logs in your code to see if it executes as you expect.
what logs
Debug logs.
where
In your code
but where
Debug.Log
where do i add it
In the relevant places. Where you want to confirm if the code works.
Do you understand what your code does?
i didnt make it so how do i know where it goes
yes
they make stuff work
and stuff
If you understand it then you should know where to put logs.
It looks like you might have two components here that both try to control the Nav Mesh Agent
but i didnt make it
But you understand how it works, no?
i only understand nothing
Ok, then perhaps don't copy code that you don't understand.
but he made alot of stuff that my friends uses that works
I recommend you pause your project and go !learn the basics properly
and it helping me
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
ok
Without understanding how your own game's systems work, you cannot implement fixes or debug methods we would suggest
Did you go and learn the basics already? That was fast!
i didnt i just dont understand
Don't understand what?
the thing
What thing?
the scripts
What are you saying
You wouldn't understand them if you don't know the basics.
can you just send a monster moving scrpit
No. We don't do spoon-feeding here.
Learn properly and write it yourself.
And when I started learning to program, my head started to hurt.
bruh why
If you want people to write code for you you gotta hire someone. Programming is labor. And no one likes working for free.
i find videos tho
Then use the videos and write the code yourself. I don't see how that contradicts what I said.
That's very obvious.
they most likey put it in the comments
Well, the pugs, if you want to program, you have to start with the basics of coding.
but that takes too long
It's true but it's worth it
Look at me, I started with the same thing and look at me now
idk how to script
I already know more or less about programming
You just have to search on yt or other places on the internet on how to start programming but BE CAREFUL you only have to learn the code for the type of game you want to make.
horror
If your game is about horror, then you have to search on the internet.
ok
This is what I did and it worked for me
IT WORKED
is there a difference between None and Missing if im checking for null? trying to run an event when it becomes unassigned/null but its not firing
Anyone know how I can make an InputAction always trigger when one of its buttons is pressed, regardless of another button being already down? I have a little mechanic in my game where you can essentially jump twice, but if you jump with, let's say space and you don't release it, then preceed to jump with up arrow, it won't do anything because space is already down. Any fixes for that?
Missing means destroyed
none means actually null
If it's missing it won't be because it was assigned as null it's because the object was destroyed
Nobody does when they first start learning how too, you just need to stick with things and you'll improve over time
hello, i'm using unity cloud code js scripts and I want to just simply wipe any players inventory when their user id is provided in the params. Does anyone know if it's even possible to do that, or is there a better way of doing it, idk it's just not working for me at all
How can I rotate an Object around the local axis shown in the editor, bc transform.localrotation doenst work and space.self with transform.rotate also doesnt work
bro with code
oh idk
you can always use transform.LookAt() with a Vector3
where do you want to point it? @solid jay
well I want to make a free cam which works in every orientation like in space engineers the player controller
for free cam just use cinemachine its way easier and faster to implement
Just add Cinemachine FreeLook Component @solid jay
but the free look needs a target to look at
your player
Ok I may havent made it clear I meant like a spectator camera with free looks, sorry for the confuision
!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
ohh well you can just use a simple freecam script like this:https://gist.github.com/ashleydavis/f025c03a9221bc840a2b
turns out I had to manually add the Visual Studio Editor package to unity (never had to do that before) and regenerate project files
so weird
can you just tell me how you would rotate it around the local axis like in the editor when you select local
You can do something like this: transform.RotateAround(transform.position, transform.up, Time.deltaTime * 90f); where transform.up is the axis to rotate around on (the y axis in this case)
or this: transform.Rotate(0, yAmount, 0, Space.Self); @solid jay
Is there a way to instead of rotating it by a specific amount to set the rotatition while still rotating around the local axis
transform.localRotation = Quaternion.Euler(x, y, z); @solid jay
not the same thing
transform.localEulerAngles = new Vector3(x, y, z) @solid jay
man I got no damn clue what your up to if your making a free cam just use a simple one from the internet or ask chatgpt and if your making first person cam + movment just follow one of the 10000 tutorials on YT. otherwise these are the ways to set rotation if that doesnt work for you i dont know what will @solid jay
Just transform.Rotate(x,y,z)
this is what im trying to get, that no matter which way the player is rotated it always rotates to the left when i move the mouse to the left etc @deft breach
and that also with the x axis
hello! im trying to make a variable of type Rect Transform but when i drag in a Rect Transform it says "type mismatch"
does anyone know why this happens and how to solve it?
ty in advance!
ur trying to add scene components into a preafb arent ya
yes
yea thats not allowed
Assets can't directly refer to Objects in Scenes, but their instances can be configured with those references.
again ty! i was lost for like 3 hours
now it works, ty!
@solid jay ``` float newRotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * freeLookSensitivity;
float newRotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * freeLookSensitivity;
transform.localEulerAngles = new Vector3(newRotationY, newRotationX, 0f);
bad idea to read and set the eulerAngles
Well I got the code from him https://github.com/ashleydavis and his code works (reference: https://gist.github.com/ashleydavis/f025c03a9221bc840a2b)
Software craftsman | Author | Writing rapidfullstackdevelopment.com | Creator of Data-Forge Notebook - ashleydavis
well it doesnt work
still wrong anyway
you should never touch the euler angles manually to avoid gimbal locking issues nvm unity internally changes into quat
thats the whole point of using Quaternion
unity docs does it
where
hmmm apparently unity does set them to quaternion internally but as it states, you shouldnt read and write from euler angles
When using the .eulerAngles property to set a rotation, it is important to understand that although you are providing X, Y, and Z rotation values to describe your rotation, those values are not stored in the rotation. Instead, the X, Y & Z values are converted to the Quaternion's internal format.
When you read the .eulerAngles property, Unity converts the Quaternion's internal representation of the rotation to Euler angles. Because, there is more than one way to represent any given rotation using Euler angles, the values you read back out may be quite different from the values you assigned. This can cause confusion if you are trying to gradually increment the values to produce animation.
Bad idea to round-trip it, to be specific
Wouldnt be hard to rotate, but the problem more relies on the fact that no human will move their mouse precisely on one axis
The vector you set is not same as the vector you get
It converted to Quaternion and loses euler axis info
I think to get a nice sample from the input is to evalute atleast a few frames of input to determine the direction
so to compare the most growing axis and direction on that axis
how does the game space engineers does it then
Probably how I explained it
maybe this will be insightful https://discussions.unity.com/t/how-am-i-supposed-to-use-euler-angles/704741
thanks i understand the issue now
I don't think for this question you need the current transform rotation anyway
whats wrong with Transform.Rotate again?
isnt that just a quaternion anyway?
but how does this help with a camera controller, dont I just choose one axis then
Perhaps it was not included in the project initially when it was created. Often happens when upgrading from older versions.
XY euler works unless you plan on rotating 90 degrees or more on the X axis (then you get gimbal lock)
yeah but I thought wants to rotate locally no ?
Transform rotation is always a quaternion in the end
well its Euler input that rotates quaternion
what are you trying to do exactly, lazy scrolling up for context
Not sure what you mean, but if the camera is pivoted on the player then you get a direction relative to the camera
dont u want local rotate? transform.rotate should be fine
I want to make a camera that can roate 360 degreese on all axis
so whats wrong wih transform.rotate again ?
You just want this?
this looks clamped, they said 360
Including Z axis? 🤔
yes wait a sec i will show you
Do you do a flip when you go above 90 on the tilt
like this
oh you do do a flip
yes
Yeah I was imagining a space game
So where's the snapping come into play. Seems smooth to me
So yeah, transform.rotate
which snapping i never said anything about snapping
Ah, may have misinterpreted it then. I assume you wanted it such that it only rotated to specific directions
I just want a camera controller like in this game...
would be weird if it was that since i didnt update anything until visual studio as a fix
oh well at least it works now
rotationInput.x = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().y * sensitivity * Time.deltaTime;
rotationInput.y = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().x * sensitivity * Time.deltaTime;
transform.Rotate(new Vector3(rotationInput.x, rotationInput.y, 0)); // Rotate Player Based On Mouse Input
when I do it like this it is all weird an doesnt work at all
Did you log the value of rotationInput?
Also rotating the X and Y axes in separate Rotate calls might be better here
Calling cc.Move multiple times in update loop for character isnt recommended, but is enemy script calling public method with cc.Move in player after player update fine?
the enemy update should not at all matter for the player update.
AFAIK the multiple Move calls is bad only because CC's isGrounded property only gets affected by the last move call
But yeah, that sounds weird
What is the mechanic here? Why is the enemy "moving" the player?
yes I did and it all seems fine but then when I rotate it also for some reason rotate on the z axis which isnt even in the code
^ @solid jay try this
Because rotating X and Y at the same time can combine into a Z rotation
like this?
rotationInput.x = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().y * sensitivity * Time.deltaTime;
rotationInput.y = playerInputAction.BlueprintMode.Camera.ReadValue<Vector3>().x * sensitivity * Time.deltaTime;
transform.Rotate(new Vector3(0, rotationInput.y, 0)); // Rotate Player Based On Mouse Input
transform.Rotate(new Vector3(rotationInput.x, 0, 0));
Sure
Btw Rotate has an overload Rotate(x, y, z) which is easier to read/shorter than that Vector3 one
well still rotates on the Z-Axis
What are you looking at? The inspector?
Or does it actually rotate on its own local Z axis?
If you see non-zero Z values in the inspector, that's fine
yes and the camera the shoulndt roll but it does
@verbal dome
Yeah I see the issue, I think the fix is to keep track of your up axis manually and rotate based on that and your forward vector
I did a lil test scene to replicate that issue
Can probably test the fix later when i got more time
Q and Z (or whatever keys you use for Z rotation) would roll the up axis around your forward
I dont use rotate, but I'm pretty sure just using angle axis would work fine
then multiply the quaternions out
can you send me maybe a dm then to explain it more since I dont really know what you mean by that
try rotating along local axes before you dive further
theres a space parameter for rotate
space self relates to local space
Self is default
yeah and it does not work the way I want it to work
Maybe later if/when I find the fix
And no DM's, I'll ping you here if anything
ok that fine to
hi
@solid jay I don't understand what you're doing with the camera. This relates to accumulated delta on those respective axes?
Anyhow, if so, then the y movement should probably relate to a rotation along the local x, whereas the x movement should relate to a rotation along the local up axis
i'm trying to develop a game with a movement just like subway surfer but when i want to change the lane in the game, sometimes it doesn't change it and i have to press the button again. i'll send the code in the next message and if there is anything wrong about it please tell me and if u want more details i'll send more about my game
the code:using UnityEngine;
public class SPlayer : MonoBehaviour
{
public Rigidbody rb;
public float forwardMove = 30000f;
public float sideMove = 6f;
public float moveSpeed = 5f;
Vector3 targetPosition;
int currentLane = 0;
private void Start()
{
targetPosition = transform.position;
}
private void FixedUpdate()
{
rb.AddForce(0, 0, forwardMove * Time.fixedDeltaTime);
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
if (currentLane > -1)
{
currentLane -= 1;
}
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
if (currentLane < 1)
{
currentLane += 1;
}
}
targetPosition.x = currentLane * 3;
rb.MovePosition(Vector3.Lerp(rb.position, targetPosition, moveSpeed * Time.fixedDeltaTime));
}
}
!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.
@spark moth FixedUpdate isn't guaranteed to catch input.
It's because you are checking the input in FixedUpdate . . .
so i should change the fixed update to update right?
The problem is you are moving the object using two different methods: AddForce and setting the transform (does not use physics). You have to choose one method . . .
You do not multiply by deltaTime when using AddForce in FixedUpdate . . .
so how should the code be written like?
Store the input in Update and check its value in FixedUpdate . . .
public class AngleAxisTest : MonoBehaviour
{
public float sensitivity = 2f;
private float yaw = 0f;
private float pitch = 0f;
void Update()
{
float mouseX = Input.GetAxis("Mouse X") * sensitivity;
float mouseY = Input.GetAxis("Mouse Y") * sensitivity;
yaw += mouseX;
pitch -= mouseY;
Quaternion yawRotation = Quaternion.AngleAxis(yaw, Vector3.up);
Quaternion pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right);
transform.rotation = yawRotation * pitchRotation;
}
}
AngleAxis my beloved
tested and it works fine
Choose a method to move the object: by force, by velocity, by using MovePosition (kinematic Rigidbody), or manipulating the transform . . .
can someone say how can i write codes like this in discord?
I posted a response on how to do so above . . .
this is just a test:
E-
As the message from the bot suggested, use a paste site when posting large code. It takes up the entire chat and we miss questions and answers from other people . . .
sry for my knowledge but can u tell me what paste bot is?
They need to be able to rotate on the Z axis too
Using constants Vector3.up and Vector3.right doesn't make sense when you are in space
Hmm, I feel like that would be kinda nauseating
I dont think that would work with mouse though, you'd need a key for the roll
Sure, that can be Q and E keys for example
My point is that using world axes here is out of the question
Oh yeah that totally looks like some key input
I'm not sure which part troubles you. If you read the message, it tells you to use any of the provided links to share large code . . .
oh sry ya know i'm a bit lazy so i red the Inline Code part
Then don't be lazy . . . 😆
it's impossible for me
hi, does anyone know if there's a way to change the default presets, specifically for importing images, on all projects? (or atleast newly created ones), i want to change the max size to the max option, and the compression to none by default accross all projects without having to change the settings manually or make a preset every time i start a new project
thats the whole point of a preset asset tho
but it doesn't work across projects ?
just put the preset file in the new project
why isn't there just an actual way to change default settings...
🤷♂️
ok i saved the bundle of my code does it mean if i press ctrl + v, it will paste the bundle or should i paste it in another way?
if i have to import a file and set it up as a default preset every time then it's barely a default setting
that's not far off from just changing the settings every time
its not possible to put something form sceneview into an prefab right? but can i put one prefab into another
i mean like in the code section
It is default, every time you import an image for that project. each project is separate. The same way you import packages every time for a new project . . .
so as a field
then, how do i change the default settings for new projects
Be smart and think ahead. Create a default (empty) project with all the packages and presets you need. Clone that project every time you start a new one . . .
that's a dumb solution to an issue with unity itself
that is just unnecessary if they let you change project defaults
@cosmic dagger i have to go can i give a friend req to u so u can help me more?
I'm busy and away from comp. You can just post in the chat. Anyone here can help . . .
ok thanks anyway
can some one help idk why this is happening
when i remove the animation
it works completely fine
what are we looking at
the camera isnt centered
because
i added the animation
well yeah your root object has bad pivot
why do you have so many cameras
i have 1 only
its just a cemra hold er
dw thats not the problem
you have 2 main camera components
can you show like the way its actually setup then
cause nwo you have main camera and player camera
sure ills end you the code i can explain it if u want
ok
its a code that makes it so the camera pos in the player object updates the positon of the main camera to the camera pos every frame does that make sesne?
sense?
yeah but thats not the issue if the root of the parent is wrong in the first place
you were showing why the camera is on his shoulder
yeah im asking why its like that
when you set something to = transform.position just goes to whaetver the pivot is
if your model has the pivot there, then it will go there
how do i change the pivot ?
dont send code as images
want me to copy paste it?
the code is to give context for the rest of how you handle parenting / positioning
i screen recorded iot
use links, copy and paste into link, save and send link
📃 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.
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!
i sent them
which gameobject has MoveCam on it
where is cameraPos at during animation/play mode. click on it and show its gizmos(arrows)
seems like animation might be shifting your transforms
where is the armature at before playmode
yeah
lol
how do i fix that tho?
that wasnt a problem before i imported the animation tho
just put the position to 0 , 0, 0
oh okay
player Obj too
generally child shouldnt be offset
unless you got some extreme case, like the cameraholderpos to the head pos etc
btw you can remove TIme.deltaTime in the MouseInputs, lower the sensitivity
mouse input shouldn't need Time.deltaTime
thats why you got it cranked to 300
the mouse axis is actually the distance that it took from last frame so its already framerate independent
oh okay
also uh
it still didnt work
for some reason
let me screen record thjis rq
wdym doesn't work
ok so i have this system where the player has all the guns in his inventory but can only use them if he walks past the gun , bur for some reason it isnt working , i dont know what happened if its in the code or in the inspector , let me show you the code
code for the guns be picked and unlocked https://paste.ofcode.org/3aR4vDkK2dZJDsX6LcVkWAH
code for the players inventory called weapon manager https://paste.ofcode.org/kAs9wybiFvXB2dTBL674Uk
code for the weapons https://paste.ofcode.org/XYZ4GUVHNDSfy8URF8y2Zb this is the first one
and this is the second one https://paste.ofcode.org/32SR5s8nbEj5NrwSX4QrJwf
if anyone is able to help me they get a free drawing
@rich adder
why is the player nested in the camera holder
lol you tell me
you literally dragged it there in the video
lol i have no uidea why he was there
probably BY accident LMAO
either way
i dragged it out
its still the same issue
are the pivot where they supposed to be though
i have no idea how to check that could you tell me ?
click each object and make sure the arrows are where they need to be, eg not offset
if the change during animation, you messed up somewhere there. are you using a humanoid rig ?
iyeah im using a humanoid rig
alright so ist the animation?
if its fine without animation, I'm going to assume thats pretty much culprit
unity is pretty pick with that
damn its centered in blender i think thanks for the help 🐱
make sure you set the Root baked and all that jazz
I'm not very good with animations but I'd start checking the bake modes
oh yeah i could try that
yeah afaik those keep the object in its place when not using root motion you want those on
alright thanks
this guy explains this pretty good iirc this video back in the day
https://youtu.be/9bV0K-pifXE
Root motion project repository:
https://github.com/RoundBearChoi/RootMotionExperiment
I'm using humanoid in this project. If you want generic, check out this project (it's the same idea):
https://github.com/RoundBearChoi/GenericRootMotionExperiment
Check out my 2.5D platformer:
https://www.youtube.com/playlist?list=PLWYGofN_jX5CNMI6tqlxNtTc7v9...
hey guys i provided alot of information , can anyone help please ?
oh shit thanks
tbh i dont got the time rn
i tried changing the code but it didnt work , i just dont know what to do
" tried changing the code"
need to know atleast why ur changing code
thats not debugging
just throwing stuff at the wall isnt the best way to progress
Debugging is trying to narrow down the issue
trial by elimination
Debug values, make sure they are what you expect them to and if not, narrow where they are going wrong
hi. i have a problem with my script with scene teleport to second teleport scene. After make this SetActive false its not working again if make SetActive true : / i trying fix it but i dont know how
show code and relevant screenshots, cause this explanation doesn't help much
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class escape : MonoBehaviour
{
public void FixedUpdate()
{
if (Input.GetKey(KeyCode.Escape))
{
SceneManager.LoadScene("startmenu");
}
}
}
what is SetActive false and hows that relate to this code
after SetActive true from false its not working ;-;
there is no SetActive here
this is not working script after setactive false
set what active?
from where
how
also never good idea to put inputs in FixedUpdate
public GameObject fPlayer;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
fPlayer.SetActive(true);
}
this only set to active = true. where is the false and hows that relate it
if u disable the object and the script is on that object the script stops also
not sure if that fits in the puzzle here just saying
you havent explained exactly where does False come in
why the SetActive(false)?
public GameObject fPlayer;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
fPlayer.SetActive(true);
}
if (Input.GetKeyDown(KeyCode.Space))
{
fPlayer.SetActive(false);
}
```} okey now?
so you are setting it to false in the inspetor?
that should work..
just note that the ESC key also unfocuses the game window
breaks out ur mouse..
na
u have to reclick the game window to retrieve inputs again..
this will just set it to inactive
what are you trying to do here?
which script?
because the gameobject is not active
explain more detail
Update doesnt run on disabled gameobject
I'm guessing he disabled the object with the code dx
assuming so yes
anyway gotta go, goodluck with this one guys
this script not working after make this from off to on ;/
if u disable a gameobject all the components on it are just as disabled
what is fPlayer
it isnt the same gamebject as this script is it?
@willow shoal are you just trying to load a new scene when esc is pressed or are you trying to do something different?
this
better yet explain
what ur trying to do:
what ur expecting to happen:
what actually happens:
and more than just IT doesnt do the thing
i have a option menu and exit and if i open option some how exit form off to on not working
what? If your only loading a new Scene put that into Update and remove all the SetActive stuff
but I dont quite get it
if u load a new scene all thats gonna go away anyway..
exit button after make this on not working
the script doesn't transfer over unless u make it..
if theres the same script in the new scene thats a different instance of that script
and starts fresh w/ default settings
is fPlayer the Exit button?
show inspector.. show what u have assigned.. show what object has the script ur referencing..
which object is hte fPlayer..
yes
yes show video
wait
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class escape : MonoBehaviour
{
public void FixedUpdate()
{
if (Input.GetKey(KeyCode.Escape))
{
SceneManager.LoadScene("startmenu");
}
}
}```
so far we know this script is on the `exit` gameobject correct?
why do u need this many objects on one thing tho?
xy problem
I feel like we're just going in circles rn
So did i get this right @willow shoal :
- You load the start Menu with the Exit Button on it by pressing Esc
- Your Exit Button is Disabled for some reason and your waiting for another Esc Press to enable the Exit button (fPlayer)
- And with Space you disable the Exit button??
^ a description/explaination like this would be HUGELY benificial
until we get one i agree with @proud fossil
if i pres exit i have still open option and "on" exit
but after space and then again press exit its not working
i cant record because somethink with computer is wrong i sorry ;/
for show i need instal a program
Ok wait so your in your Game (Main Scene) and then you press Esc to get to the Main Menu. The Exit Button is on the Main Menu right? What is the Space pressing for?
two exit should change scene
put debug.logs in ur code..
becasue open option and then quit
u have to re-click the scene window to refocus
oh
u cant press two exits w/o having to click the window between
Get your input code outta fixed update whose ever code this is
BECAUSE as i said earlier ESC is a hotkey for editor to Unfocus the window (so u can move ur mouse around)
u should use different keys to test ur system
and then swap over to esc before the build
okey
Input needs to go in update not fixed update
they've already been notified about that lol
man that felt like a whole puzzle game
i personally use the ~ key for escape menus
so aggravating to lose focus
w/held, fixed update is fine but if you plan on using it as a tap you're def gonna have a bad time
probably could just change the hotkey to that insted
lol.. input be like missed me! im over here! now im over here! 🎯
I remember doing that once lol
Good ol days of OnTriggerStay also
some people still put their rigidbody inputs in fixed..
why is my E key brokenn
gives me soo much anxiety
you mean OnTriggerEnter? gotta time it juuust right
Oh OnTriggerEnter is even worse you gotta be quicksilver
i need some more help for some reason my players center of gravity is somewhere else how can i fix this
dont mind me falling through the ground i can fix that later
Set PlayerObj Position to (0, 0, 0) @dreamy rose
u can also do it via code
also.. u could do urself a favor and move the player to match its transform..
no reason to have the pivot way out there in outter space
uh that doesnt work
Set PlayerObj Position to (0, 0, 0) @dreamy rose
move ur children and stuff to the pivot.. and then move the entire thing back to where it should be
okay illt ry that
how???
yeah
yes move your children to (0, 0, 0) and then move your Player to the middle
u want ur ROOT object to have its pivot at 0,0,0
with a scale of 1:1:1
always and forever lol
the graphics and everything else should be children
thats so stupid wow
thats the objects that u re-arrange
tysm guys
luckly u had ur pivot mode set to "Pivot" and we could see
if u had it on Center.. it would be a problem someppl might not notice
and it def just complicates things (especially with a rigidbody involved)
well everything that makes sense.. ur camera would probably be like 0, (theHeightOfYourPlayer), 0
with correct pivots u shouldnt even need to worry about the rigidbody's COM
hey guys, i'm trying to do a parallax background that scrolls towards a direction, but i'm not too sure on how to approach it.
after some googling i have encountered some tutorials, but none of them tackle both independently scrolling towards a direction and being parallax at the same time.
after trying it out for myself i have gotten 2 different scripts:
use !code external paste websites for code that lengthy from now on if u could thankyou 🙏
📃 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.
not u matiego
oh i miss sorry wait
ah, my bad, sorry
1 sec
A tool for sharing your source code with the world!
here
hi again. i learn and testing somethink.. where i should add
SceneManager.LoadScene("startmenu");```
for
```cs
private float delayTime = 1f;
private bool holdDelay = false;
IEnumerator DelayTimer()
{
holdDelay = false;
yield return new WaitForSeconds(delayTime);
if (Input.GetKey(KeyCode.F))
{
holdDelay = true;
}
}
Alright
I learnt the basics of C# n am ready to try the engine
Any tips on how I should begin or any tutorials to follow??
thankyou
much cleaner for big code blocks
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
i dont know how to make this work with my scene manager
the current setup:
the main background asset being the parent of 2 other copies of itself, placed both the right and left of itself.
the idea is that the background images would move left constantly, and update accordingly to make itself look seamless.
u should have in mind what u wanna attempt
just jump in the deep end and roll w/ it
whats the issue again?
here
posting a video in a sec
can u describe the parallax affect? theres different types
is this for background/ landscape for a side scroller?
yes, similar to thishttps://www.youtube.com/watch?v=AoRBZh6HvIk
but i need the background to scroll independently in 1 direction, while also being affected slightly by parallax.
We're going to add parallax to our 2D scene's background layers, then make it endlessly scroll!
This is a complete tutorial - from adding player, setting up the camera - to a beautifully scrolling background! Basically make a whole endless runner / side scroller in 7 minutes :o
FREE Player Package: https://www.patreon.com/posts/102090173
FULL P...
but what's happening is that the background asset (the train tracks in this example) keeps in place instead of moving towards the left
the video you linked has a section called jitter fix
there's that, but then again it doesn't move at all which is not intended
also FixedUpdate was already applied
any of you guys know how to approach this problem? should i use animations instead? i do not need the background assets to be interactable.
Hi all, I'm having such a weird brain fart at the moment.
I've got this spawner script (basically when the c130 hits the trigger, I want to 'start' the spawn countdown that lives in update, but for the life of me I can't figure out how to do it. I tried a simple boolean in the OnTrigger (spawnThings = true), but when I put the boolean check in my update it breaks the countdown timer. Would anyone have any ideas please?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Define break
Sorry, the timer gets to 0 once, but on the second run through it stops before hitting 0
Sokay, I think I fixed it by changing my approach slightly.
I'm using Debian 12 and when add sprites in Tile Pallet Unity slows down considerably
It looks this way
When I delete folder Tiles it works fine
I've attached the video as an example
As I understand that's an optimization issue
The amout of tiles is big
no clue, you can profile the editor and check what happens
um ik this is a dumb question but for some reason i cant figure it out, but why are two of my gameobjects passing through eachother instead of colliding? they both have colliders, and neither of them have "is Trigger" on. my game is 2d and they are both on the same z axis
very strange seeing as the tile pallette isnt even open 🤔
Does this keep happening if you close and re open the editor?
I've made .assets using Tile pallete and then when I open folder with those files it slows down
There's a lot of them
i wonder if its trying to make thumbnails and its super slow
Does at least one have a rigidbody?
no
it also depends on how you move these objects..
for physics to work, iirc at least one of the objects need a rigid body
if ur translating.. "teleporting" transform.position = something.. etc then the oclliders wont respect collisions
also should be using a rigidbody on them if they intend on colliding with other objects
ahhh it works now thank you, sorry again, i forgot about that rule
rigidbody says it intends on being used by the physics system
a collider only doesn't do anything but define the shape (defines shape and boundary of an object for collision detection)
Your screenshot doesn't show thumbnails for the tiles so I presume its trying to make them and its causing the lag
Oh thanks for explanation now it's clear
When I've loaded for the first time it showed something but I didn't notice
are unity tilemaps actually used in bigger projects or are they more a kind of beginner/accessibility thing? i have one that works fine but it seems pretty limited in terms of detecting collisions and auto tiling when there are lots of different tile types
I always get this error no matter which file path I choose
{
// Goes to Sources folder and checks if it exists
if (!Directory.Exists(filePath))
{
UnityEngine.Debug.LogWarning($"Source folder not found! Creating: {filePath}");
Directory.CreateDirectory(filePath);
}
string json = SerializeToJson(source);
File.WriteAllText(filePath, json);
Debug.Log($"Saved Source to {filePath}");
}```
check the permissions for this folder, if its admin only then that explains it
It's the same for any folder path i choose
this is some random folder in C which may not have user write permissons on it, try a folder in your user or use the persistent data path https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Application-persistentDataPath.html
BTW you can call CreateDirectory without the Exists check. It does that check internally anyway
don't crosspost. also !collab 👇
:loudspeaker: Collaborating and Job Posting
We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
• Collaboration & Jobs
Same problem in both instances
I'm thinking either somehow weird permissions are being applied, unity is executed under another user or antivirus weirdness
did you give your file a name?
sorry my anger but im just stuck , i dont know what to do , i remade the scripts i need 3 times by now and none of them work how they should
am i just stupid ?
Yeah you seem to be trying to write the file data to the folder path @tulip stag
ohhhhhhhhhh 😵💫
Honestly, my code was pure spaghetti. I deleted my entire save system (wasnt much) and am starting from the beginning
and yeah. Methinks that's what the problem was
is working now?
Just so I know for when I hit that same obstacle— what's the right syntax for specifying folder and file name in File.WriteAllText?
No, I still need to re-do my code 😔
public static void SaveToFile(Source source, string filePath, string fileName)
{
Directory.CreateDirectory(filePath);
filePath = Path.Combine(filePath, fileName);
string json = SerializeToJson(source);
File.WriteAllText(filePath, json);
Debug.Log($"Saved Source to {filePath}");
}```
ugfhhhhhhhHhHHhhhh my code is getting too complicated and I'm losing sight of all the moving pieces 😭
Trying to spot my error there was a nightmare because I kept jumping from file to file. Too many references!
should be okay as long as each file ideally is responsible for only 1 thing
if you want to ease spaghetti you can try observer pattern, avoids a lot of two way spaghetti
Ha i didn't realise it was that simple 😐 , glad its fixed
Whats the best learn to start off doing as a complete beginner to Unity?
I literally just posted this
https://learn.unity.com/pathways
Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.
this will give you all the lessons to get your foot in the door
Thank you!
does anyone know how to fix my animation from looping? I am making a game over screen and want "game over" to pop up, but the animation keeps replaying (loop is unchecked) i want game over to stay on the screen, not disappear and reapper over and over
show code
it just instantiates a prefab with an animator component, the animation isnt ran through code
should i still show code?
show anything that is relevant to making the animation show up
{
public AudioSource gameOver;
public Text gameOverText;
public Button tryAgain;
[SerializeField] GameObject parent;
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Enemy"))
{
EndGame();
Debug.Log("Collision Detected!");
}
}
void EndGame()
{
gameOver.Play();
Instantiate(gameOverText, parent.transform);
Instantiate(tryAgain, parent.transform);
}```
the object spawns and the animation is instantly played because its a component
which one is the animation
neither, those are the gameObjects
so I'm following a blackthornprod tutorial on making a card game and someone pointed out in the comments section that doing this
public void Update()
{
deckSizeText.text = deck.Count.ToString();
discardSizeText.text = discardPile.Count.ToString();
}
is a bad idea because it updates way too often, however I'm struggling a little to find a good way to make it only update on effect. Anyone have any insight?
thats what i was trying to say, the animation isnt in the code at all, its done through the inspector
of which ? show that
use observer pattern / events avoid polling yes
though i heard text was optimized for TMP as such that only when value updates does it refresh it.
whelp what I'm gonna do is ignore it for now lol
when it becomes a problem I'll deal with it
though its good habit to learn the observe pattern at some point
its pretty powerful and its not that difficult
I definitely will, but I'm trying to prioritize getting things functional before I get them pretty
I mean observer pattern is not just "being pretty" ..but do ya thing..
you can see to the right there is the animator and on the screen is the animation editor
in most cases you don't want to poll every frame for something , you can avoid it w
the observe pattern, helps improve many things , among one of them is not having to poll for changes
I'll take a look at it then, thank you :)
Very very quick question, I have an object that needs several sounds (and therefore several audio sources), assuming I have 2 audio sources what would I write in this overload to select which one? (writing a string gives an error)
make a field for each one in the inspector then give them the appropriate name
the overload isn't for distinguishing which one it is..
Make one audio source, change the clip in the audio source
I wasn't thinking right, got it thanks
sometimes you need multiple audiosources if they go into different mixer tracks for example
or play at same time
in the animator controller
the animation you put it in the controller yes? show that controller
this?
select the gameover state and show the inspector
hmm alright nvm then. only one thing left. select GameOver clip and show the inspector for it
im not sure i understand im sorry, i thought thats what i just did
yes because you lack the fundamentals that you probably should learn beforehand..
the animation CLIP that says GameOver
select it
the Clip Asset with the Triangle
okay i fixed it, i unchecked the loop time earlier, im not sure how it rechecked itself, maybe i was playing the game
and yes i know, thats why im trying to learn right now, i am sorry for the confusion
had a feeling that might've still been checked, need to cover all bases first
no worries but instead of guessing your way check out the !learn site it has things like animator you can search for there
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
it has detailed lessons to learn each tools and also how to control states
sorry for the confusion earlier, i thought the clip asset was called animation or something, thats why i was so confused, sorry about that
thats why i didnt understand
why can i not drag a game object into my prefab inspector? its a button that say try again, and when you click it, it is supposed to restart the game, the code works but i cant put the code into the button (but only when the button is a prefab) if it wasnt a prefab, it works
the code has to be on a gameobject.. and that gameobject is whats referenced within a button component
you cant serialize reference to scene GameObject in to prefab
i added a package to my project by double clicking a .unitypackage. it turned out to be the wrong version, so i grabbed another version, and installed that. apparently now i have both installed. i went to the package manager to remove it but i don't see it in the list. how do i remove one of these packages?
prefab shouldnt matter.. but it needs to be in the scene for the Monobehavours to run
its normally within a folder..u delete that folder
if not its scattered thruout the project most lkely and will have to be manually removed
yes, it doesn't work the same as something from the packagemanager
damn. i have to start over, don't i
where all the files are in deterministic places.. ur unitypackage shoulda had everything within a subfolder
where would i look for this folder
it'd be in the Assets folder
yes i did that but it doesnt accept the game object
is it also within the scene?
would be good to share screnshoots, so we can see what you see
yeah, exactly what i said
you trying to set reference of a scene object to prefab asset, which is not supported
so should i instead keep it as its own game object and the enable/disable it using script?
that way the button will work i think
you can
- have instance of prefab in scene with reference to scene gameObject
- adds by code a reference to that GameObject to spawned instance of that prefab
ohhhh okay that makes morew sense actually, thank you
fixed, thanks
yup.. you'll need to grab those references at runtime..
prefabs need references that either
- in the scene with them
- contained within the prefab themselves
basically needs to know what instance of the prefab has the script
not the actual prefab.. as those don't exist until u spawn them.. or physically drag them into the scene..
scene GameObjects serialization forces this behaviour, if they were serialized by sceneID and some additional data then it would work somehow but it would create infinite dependency in some cases😬
I am getting the null refrence error i tried doing checks even did return; but it still gives me the error
cs 29
did you tag the object correctly?
yes but the object is a prefab
its instance of a prefab or a prefab?
uhm
did i do something wrong here?
Debug.Log("pos2 = " + pos2 + " pos1 = " + pos1 + " Mathf Lerp = " + Mathf.Lerp(pos2 - 0.5f, pos1 - 0.5f, 1f));
shouldnt the result be 1, 0, and 0?
cause 1 - 0.5 = 0.5, 0 - 0.5 = -0.5
and lerp 0.5 and -0.5 = 0??
not the instance
is that the problem?
so if its not an insteance then you mean a prefab which is an asset that its not in the scene
so you cant search in scene for it
but arent i searching for it with a tag
its not in scene, you cant search for it in scene then
instantiate that prefab in scene and search
then you get results other than null
Did you read in the docs what the Lerp method does?
wasnt i using lerp with t = time.deltatime??
in other scripts
i though t = how fast it does it 😭
Mathf.Lerp(a, b, p)
is the same as
a + (b - a) * p
0.5 + (-0.5 - 0.5) * 1 = 0.5 - 1 = -0.5
damn
lerp(a, b, t) gets you the value that is t% of the way between a and b. If the third parameter is 0, it returns a. If it's 1, it returns b. If it's 0.5, it returns halfway between a and b.
how can i find all object of a certain type and then add them into an array at the start of the game?
something like:
POI[] pois;
private void Start()
{
pois = Object.FindObjectsByType<POI>(FindObjectsSortMode.None);
}```
theres also (FindObjectsSortMode.InstanceID) and (.TransformHierarchy)
ihttps://docs.unity3d.com/6000.0/Documentation/ScriptReference/Object.FindObjectsByType.html
How do i learn unity?
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
No I dont believe so
It has something to do with the input assembler
I cant figure out what exactly it does
the only thing i can find about them comes up about bit fields and bit packing structs..
other than named paramaters Car myCar = new Car(make: "Tesla", model: "Model S", year: 2025);
aye that explains it lol
I have what is probably a pretty silly question. I wanted to try learning to use the animation tree. I got this far from a tutorial, however I just don't really know where to go from here. The animator is added as a component to my mannequin model, do I need to write a script where certain inputs change values called x and y? Any help is appreciated.
I've tried setting it as my layer default state, and also tried a transition from my idle when any movement is detected, but im obviously missing something pretty big.
Did you finish the tutorial? What did they do??
It was a super short video that ended as soon as they were done adding the animations as motions. They just said you're ready for the next steps that I'll go over in another video and I cannot find said video on their channel at all so
I'm gonna figure it out eventually, there's just nobody with a breakdown of how to implement this from beginning to end that I have seen.
This looks like a blend tree. There should definitely be videos on how to move a character using a blend tree . . .
Hey can someone help me by finding the problem of my Character is sinking? Am I missing something?
Code: https://pastecord.com/topidexuzi
I mean yeah, there are definitely videos which go over how to use a blend tree. My guess is there's something painfully obvious people aren't bothering to go over that I am missing. I can follow the steps in these videos to a tee and I do not get the same result.
In my code, I have a playercontroller, which handles all player actions.
However, I find it quite cluttered. In the attachement, I have 8 methods that I have to scroll through when working on other parts of the playerController.
What's the correct way to handle this?
I understand that I'm meant to use code blocks, but as this question has nothing to do with the content of the code, I figured a screenshot would do
I have found a solution, just use the #region
There is no correct way. You can hide the method (as you've done) or use regions to enclose code in large groups . . .
hello, i want to make the player move along as the train moves like how it works in real life. Is there a way I can approach this?
I'm thinking of detecting distances between player and each carriage, and see if its 0 or negative then add the train's movement to the player's movement
when I update my game and want to publish it, do I need to Build it again?
Pretty much, but sometimes just changing a few things doesnt seem to do a full recompile
ight thx
if you are debugging your build tho, make sure you select dev build as that'll greatly reduce the time
and provide you with a console to print to
that sounds fine although there isnt a need to check if the distance is 0 or negative (distances cant be negative). this should work as long as the train and player are moving in the same way. If the player is a rigidbody it might get awkward
Mornin' all,
I was just wondering if anyone would be kind enough to take a look at this and see if they can see what I'm missing (why my 'targetting' is off) please?
As you can see on the image the vertical targetting is 'off' (the red are my collision planes, enabled visuals for testing). I'm not really sure what the issue is. 😕
using UnityEngine;
using UnityEngine.UI;
public class UIController : MonoBehaviour
{
[SerializeField] Vector2 cursorHotspot;
[SerializeField] RawImage reticle;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
// Hide System Cursor
}
// Update is called once per frame
void Update()
{
reticle.transform.position = Input.mousePosition;
}
}
This is my reticle code, pretty simple etc.
And this is my turret controller Code (gets rotations based on the raycasthit screen position etc. etc.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Just because it doesn't show up in the screen grab. The system cursor arrows 'point' is dead centre of the reticle.
how do I share my game to another computer? can I just put the whole folder in a drive and send it?
GitHub?
there are a ton of issues here. first, you have no debugs in your code, so of course theres no way u can be sure of where the issue is.
add some way to check that the UI controller is moving the object correctly (its probably not since mousePosition is pixel coordinates)
2nd you shouldnt be modifying the x and z of a quaternion. a quaternion is not euler angles so this doesnt make sense to do
github is a host for git repositories
I do have a habit of removing debugs when posting code, just for ease of reading, sorry. 😕
The UI Controller is moving the reticle object correctly, at least on the X and Y (you can';t see it on the screen grab but the reticle is locked to the 'system' mouse pointer 'arrow point'
But, saying it out loud, it occured to me that it's possibly to do with the Z positon of the reticle.
Thank you, I'll take another look at the turret controller.
I am so out of practice with this stuff. lol.
I'm not too sure on how to fix the issue, but I wonder if it might have something to do with the fact that the camera and turret have different Z positions, the turret being slightly forwards of the camera could indicate why the beam is also offset in a similar way
to check, try moving the turrets position so that it is directly under the camera
I'm curious to see if the beam ends up hittng the reticle when you shoot
I get what you mean, but I don't think that would make a difference, but I'll give it a go. lol.
Oh god. lol. That made it sooooo much worse. lol. So yeah, definitely something going on with my aiming script. Will have a look and rework it 🙂
LMAO
Of all things. I was getting the direction based on localPosition. Shoulda been Position. I'm such an idiot. lol.
Fixed it now 🙂
Thanks for the suggestions folks 🙂
ah! glad its sorted
It's always something really stupid like that. lol.
welcome to programming!
uh huh. Haven't done any Unity stuff for a few months, so still getting back into the swing of things. lol.
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
this was literally just working a few moments ago, what on earth happened
It's possible you added a different namespace which has a "Button" class, or you made a Button class yourself
Hmm, I dont recall making one
Sorry, my event knowledge is not that great since I barely use them
It is probably the fact you can't invoke like this. I think the button is only able to invoke the event. Maybe it has a "RaiseOnClick" method?
assuming it's UnityEngine.UI.Button, onClick is a UnityEvent so it does have an Invoke method and there wouldn't be anything special preventing that method from being called outside of the Button
i have a rotating platform and the player script supports that, but its very jittery when standing o nit, why could that be?
see #854851968446365696 for what to include when asking for help
but i'd bet it's actually your camera updating out of sync with the object it is following
its first person, so not out of sync
how have you confirmed that
because just saying "first person" does not magically make your camera update on the correct timestep in the correct part of the frame
whats UnityEngine.UI.Button? its not showing up on my editor
that would be the button component from unity ui, the one on a canvas
oh ight
is that the kind of Button you are attempting to get with the GetComponent?
from what little information you've provided i'm going to assume you accidentally imported the UIElements namespace instead of the UI namespace, they are completely different. make sure you are using the correct one
yeah earlier my code had Unity.UI but then it didnt work anymore, rn its UIElements
and UIElements is incorrect here. canvas ui types exist in the UnityEngine.UI namespace. UnityEngine.UIElements is for the UI Toolkit stuff which does not exist as individual objects in the scene
yeah I get it now, so, do you know how to fix this?
does the error only appear in visual studio or does it also appear in the unity console?
it does aswell
you haven't done something silly like uninstall the ui package, right?
nope
show the error in the unity console
Ok so wait, I got somethign mixed up, the Console error was because I forgot to put the full line of code buttons[currentPosition].GetComponent<Button>().onClick.Invoke();
but when I put the whole line, UnityEngine.UIElements showed up on my code and the console is now saying this
that first error is just an editor error and is irrelevant. the second means you still haven't bothered removing the UIElements using directive
and if you type out that line and it automatically adds the UIElements namespace then you need to start paying better attention to what you are autocompleting
Yes, but then I removed UIElements, the line still doesnt work, and UnityEngine.UI still doesnt exist
right so when i asked before if it also showed up in the unity console, when you confirmed it did, was that a lie? because i asked that for a specific reason
not a lie, I just misenterpreted what the console was saying
close visual studio, go into the external tools settings in unity, regenerate project files, open visual studio again
ight
Ah, it works now, thanks m8!
!code
also provide info about the error
📃 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.
"does not contain a constructor that takes 4 arguments"
rb.linearVelocity = new Vector3(rb.linearVelocity.x, 0f, rb.linearVelocity, z);
Problem is with "Vector3"
yes, Vector3 only takes 3 arguments, you are passing 4
How to fix it?
uh? why is this what happens if i do?
you currently pass a float, another float, a Vector3, and whatever z is supposed to be. perhaps you meant to pass 3 floats
yes that is clear. however i wanted them to come to that realization their self by reading the code
fairs
oh ok
So, I didn't really understand how to do this correctly, but I'll try
thanks anyway
pay very close attention to what you typed
and if you do not see red underlines in your code indicating an error, then get your !IDE configured 👇
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
can visual studio not render this? i normally use rider so idk
in rider this gets rendered
Well, I fixed it
Rendered? This is just commented code.
no this is a method doc
or whatever its called in c#
Aaah
like it gets rendered in intellij and rider like this
I tried to make a property out of an array and it works except even debuglogs in the setter are not called, how does it work?
its kind of hard to read them when they dont get rendered tbh
Are you using it appropriately?
I have no idea!
Unless you've got some code to share, folks will likely not be able to help you
I have something like
[SerializedField] GameObject[] _stuff;
private GameObject[] stuff
{
set{_stuff = value; Debug.Log("Log");}
}
setting works but I ain't getting logs logged out
yeah wait
here, it was not actual code
Looks fine. How're you calling it?
I realize I do nothing with an array itself, I just expect it to log every time I modify any element
how do i render an outline around a sprite?
in 2D
i couldnt get the outline component to do anything
seems like it's valid that it's not logging anything when I access elements
now my question is how to make something happen every time I modify an element of an array? if it's possible
I retroactively realized that I need some stuff to happen every time I do that
and modifying each line where this array is called sounds like a hassle so can I avoid it?
btw im a beginner so i doubt i can create a shader
because it's for basic text, and even there it works poorly
oh
so then how do i make an outline for a sprite
I am unaware of other solutions but writing a shader 🤷♂️
ok but how hard is a shader?
yes
ye thats what i was worried about
I have no idea honestly, might be not that hard, I am just sure it's not trivial
ok ill try following this tutorial ig
you don't have to write them tho, shader graph exists, but I have almost no experience at neither writing or noding a shader
I double checked and seems like you can also use it on like an image, but all it does is creating 4 copies and shfting them to sides
this is not great but with a bit of tweaking maybe
is that a shader?
...I guess making a wrapper would be more bothersome
i succesfully made the line thicker but now i need to fix the places where its like not rendering
okay so the outline gets cut off because the texture stops there
how do i add padding
there is this extrude edges but it doesnt seem to do anything
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?
see #854851968446365696 for what to include when asking for help
Hey can someone help me by finding the problem of my Character is sinking? Am I missing something?
Code: https://pastecord.com/topidexuzi
Hi guys. So basically, I've watched bro code's tutorial on C# and I'm familiar with the very basics, but I'm wondering if it's a good idea to learn C# alone and then switch to learning the Unity game engine itself, since I imagine it would go much faster and smoother if I did both at the same time but I'm not sure how to go about it.
Yes it's a good idea IMO
I recommend these interactive tutorials: https://learn.microsoft.com/en-us/collections/yz26f8y64n7k07
So I won't have much trouble switching later on?
I knew C# before I learned Unity
it made it significantly easier to learn Unity
Because I didn't struggle with basic C# coding concepts
Alright then, thanks bro
if you are able to fix my project you get a special prize
so here is the link for my project, i got problems with 3 scripts in specific
WeaponManager.cs – Manages weapons, unlocking, switching, and equipping.
WeaponPickup.cs – Handles weapon pickups when the player collides with a weapon.
WeaponCheat.cs – Unlocks all weapons when pressing F12 (cheat feature).
im trying to make a quake like game but these scripts aint working , i have tried debugging all day none of these scripts work as they should, i dont know what im doing wrong, if you are able to fix my problem i will make a drawing for you of your choice
the weapon manager tries to unlock the guns but the player cant equip them, the only gun the player can use right now is the pistol, the gun he starts with, the player also has a all the guns in his inventory but he cant use them because to unlock them he has to walk into a gun on the ground and unlock it with the WeaponPickup script , the WeaponManager takes care of the player inventory and what guns he has unlocked or not. the WeaponCheat is more like a developer feature were the player unlocks all the guns so i can test them all
if you can make these 3 scripts work as they should, send me the result and i can give you the drawing you want
here is the link to the project https://drive.google.com/drive/folders/1oBaAE0wfZ-6hBSVx-ACt0XRo2xG-OzCM?usp=drive_link
Access Google Drive with a Google account (for personal use) or Google Workspace account (for business use).
No one's going to download your project and make it for you. Chances are you're trying to make something beyond your ability too fast, scale down and try again.
guys i was follwoing the How to Make a Slender-like Horror Game in Unity (Part 3) tut by Omogonix and the int and page collect text wasnt working
i can try
Send your error and don't just copy paste scripts learn them instead!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
but this guy make tut
that guy wants to inspire and teach you how those systems work he/she is making work and how you too can do something like that . He/She is not teaching you how to copy paste
ye but that says 750 hours to learn it
this
- That's how many hours are available
- It's going to take way way more than that
and thats why
that's no excuse for not learning
im not saying excuses
If you want to make a game, be prepared to spend thousands of hours learning.
you think the tutorial video is going to shortcut you through 750+ hours that would be needed otherwise?
When you commit to any idea it takes much time to make it work Nobody can know your code as much as you can
this is being useless
it takes literal years, you're in for a long one
I too am making a passion project and encounter many obstacles but I always find a way through it not by any video but through self urgence and passion
same goes for you my friend nobody is going to put in work for a drawing if you want favours you either attempt to solve them or hire someone
If you want help with a problem you're going to have to actually say what it is
the int (the [E]) and the page collect isnt working
hey guys a question;
so im making a main menu, and all the pages like options, customization, etc. i would like to make them as own scenes that i load additively
when two scenes load the canvases of both overlap and i cant press the back to main menu button
am i doing something wrong, is there a way to create layouts better in unity, or should i somehow try to scale the canvases so they dont overlap
I am not watching the video rn where is the code with the error , which line and show the console atleast
I have no idea what "the int", "the page collect", and "not working" means. You'll need to explain what is supposed to be happening, how you're doing it, and what is happening instead
if they're all UI.. why are there separate scenes? that sounds like a lot of unnecessary extra work
the int is where the E is in the middle and where you can collect stuff
show current code + send tutorial link
I can get wanting the whole menu to be a scene you add in, but once that's up you should probably just have your other screens be panels or canvases you toggle on and off
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...
What does an integer have to do with this
thats the tut
i thought to use a similar approach as with web frameworks, but alright, ill just have them in one scene as own panels
yeah switching panels will be so much easier
yeah, i see, thought it would make sense somewhat
Do you know what an int is
ye the E
How is E an integer
that the video not me
that is not an int int stands for integer
@buoyant finch come again?
interaction, perhaps?