#๐Ÿ’ปโ”ƒcode-beginner

1 messages ยท Page 559 of 1

acoustic belfry
#

well, i think it was obvious, xd

#

cuz it worked

#

thanks :3

rich adder
late burrow
#

whats the exact reason of why binary files break themself when saved as string

mighty compass
#

AI = trash, apparently its replacing us programmers

rocky canyon
#

lmao.. who told you that?

#

whose gonna program the AI?

steep rose
#

That code had a comment every other line

rocky canyon
#

ya, i just had to scroll up to see ๐Ÿ‘€

steep rose
#

That's wild, looks like a dictionary

mystic lark
#

Ah never mind

#

im stupid

polar acorn
late burrow
#

no like

#

binary containing strings

#

if i were to edit it in notepad it would break

#

but in hex editor it wont

#

why is that

polar acorn
#

Because binary isn't strings

late burrow
#

but they in fact can hold invalid ones

#

so why not save it

#

actually it could be also beacuse of loading it

polar acorn
#

Binary is not a string. If it were encoded into a readable format, it would in fact no longer be binary, it would be a string

late burrow
#

oh so i can for example read it as string and write it as bytes and it will still work?

hot laurel
#

he thinks its strimg because he opened it in notepad

late burrow
#

it kinda would be easier if encoding was more universal

#

like it cant hold emoji and such

late burrow
#

i dont know at which part encoding applies reading string dont need one but writing does

polar acorn
#

Encoding is what decides what the binary data means

hot laurel
#

encodes the binary akhem

frosty hound
#

At this point, just change your name to "StringObsessed", it seems that's all you seem to ask about in the weirdest use cases.

polar acorn
#

For real

#

stop trying to turn every piece of data in the universe into a string and back

#

and just learn proper serialization

frosty hound
#

Something something VRChat won't let me something something

late burrow
#

i just wondered as i always had that issue of data disappearing when using notepad and how to avoid that

polar acorn
#

If you want to turn every piece of data into a single universal data type, guess what, there is one it's called byte and you that's what serialization is

late burrow
#

and string is in fact still superior

hot laurel
#

in which world

polar acorn
frosty hound
#

This is the same user who went on far too long about script length having a noticeable impact on their games performance. It's not worth getting into it.

hot laurel
#

there only bytes in memory, if you use strings to serialize (edit binary files?) the first is slow and require processing it in both ways

#

the 2nd in parentheses, well lets skip this part

hot laurel
frosty hound
#

It wasn't really, unfortunately

timber tide
#

human readable serialization is highly superior ;)

#

makes fixing merge conflicts actually doable

swift crag
#

i do enjoy being able to easily edit serialized data

#

it's much less efficient to use delimiters and to limit yourself to just printable characters

#

however, comma,

mystic lark
#

YALL MADE MY FIRT EVER GAME WITHOUT A TUTORIAL and a bit of dicord help

#

but still this is progrres

eager spindle
#

๐ŸŽŠ

compact stag
#

hey guys! i need a pointer, i'm recreating the slenderman game and as most people know whenever he is close static appears on your screen, whats the best way to recreate that in unity? should i use transform.distance? or should i do it some other way?

cosmic dagger
compact stag
#

so pretty much just make a variable that stores the player's transform then enemy.distance - player.distance?

cosmic dagger
compact stag
#

oh! not distance, sorry, i forgot the term right now, but i think i'd be able to calculate their distance by subtracting both of their transforms, so like, player.transform - enemy.transform

#

i dont know exactly, i gotta write up the code, just looking for some pointers and to confirm if this is the best way to go about it

cosmic dagger
compact stag
swift elbow
compact stag
swift elbow
rocky canyon
cosmic dagger
compact stag
rocky canyon
#

the volume controls the fade/ the distance/ all that stuff

rocky canyon
#

thats if the noise profiles are good enuff for what u want to do

swift elbow
#

thats the easiest method i can recommend

cosmic dagger
compact stag
compact stag
swift elbow
#

omg i just reread your message and i understood it completely wrong mb ๐Ÿ˜… @compact stag

rocky canyon
wispy coral
#

hey yall just wanted to know the difference between lists and arrays and when is best to use them

compact stag
swift elbow
wispy coral
#

thanks!

rocky canyon
#

film grain -> set the settings u want.. (this will be max settings)
and then its all about ur fade..
once u've left the trigger its automatically transparent..

#

in -> full effect
out <- no effect

#

and any fidelity inbetween by changing the parameters

compact stag
#

because i was planning on using a static video and putting it over the screen

#

but using this idea might be better

rocky canyon
#

film grain is the noisy stuff over the top... u can change its intensity

#

but its not really opaque or transparent

compact stag
compact stag
#

i'll take a look at it! thanks a ton

rocky canyon
#

theres also a custom setting

#

but i dont know how that works yet

compact stag
#

i like the italic in it

rocky canyon
compact stag
#

gives a bit of suspense

rocky canyon
#

so it could be placed on top of a video..

compact stag
rocky canyon
#

jsut not UI.. (unless its worldspace or overlay UI)

compact stag
#

so, question

#

if film grain adds static to the screen, can i change the static's pattern someway?

nocturne kayak
#

static is by definition random noise , so no

rocky canyon
nocturne kayak
#

(that's my best guess)

rocky canyon
#

but again.. i dont know how to use it. so maybe search it up and see..

nocturne kayak
#

actually that depends

rocky canyon
#

i know u can w/ shadergraph pretty easily

compact stag
#

shadergraph? whats that?

nocturne kayak
#

what exactly do you want to do? do you wanna display an image on the static? do you wanna change the contrast?

compact stag
rocky canyon
#

It's time for not just one shader, but 10! In this video, you'll learn about 10 different shader effects, what they are useful for, and how to make them in Shader Graph!

๐Ÿ‘‡ Download the project on GitHub: https://github.com/daniel-ilett/10-shaders
๐Ÿ’– Huge thanks to my Patreon supporters for March 2022, especially: Jeremy Gooch, Morrie...

โ–ถ Play video
#

a tool to make shaders

compact stag
compact stag
cosmic dagger
wispy coral
#

nice thanks!

rocky canyon
#

Array: Menu Items
List: Customer Reservations

nocturne kayak
#

Hey, i need some help with with Vector 3 projection which doesn't seem to be working [

#

(here's the code before anything else)

#

So, the red sphere is representing a point on a plane

#

the green one is supposed to be the red point, projected onto the green line

#

however, as you can see, it's on the floor for some godforsaken reason

#

It looks like it's projecting at an offset

proper pier
#

Does anyone know where to find resources on making a turn based game. I see some frameworks but I have no experience with turn based stuff. I was looking into a fire emblem style game

#

or more like Fell seal and FF tactics

nocturne kayak
compact stag
#

oh right! sorry

nocturne kayak
#

NP

nocturne kayak
finite chasm
tawny grove
#

Hello, I am going to start randomly generated rooms for my game soon (2d), and I was wondering how I am able to add terrain through my tilemap through code.

sorry if this is confusing through words (which is why i am having trouble search for an answer), but currently I have a grid object with a tilemap object inside. the tilemap object has terrain i built. how can i build terrain in the tilemap through code (which ill be using for random generation)

any help or links to related stuff is appreciated !

rotund forum
#

I don't know if anyone has any recommendations for how to troubleshoot this, but recently I came back to my project, and, I'm not sure if this was there before, but I'm only just noticing now that my character will stutter when moving. (I'm using the character controller along with the input system)

I checked the input system debugger and all I'm seeing is the key for movement being, seemingly, randomly triggered multiple times. All I am doing is leaving my finger on that key ('A', in this instance.). If I let my mouse trigger movement this doesn't happen. I don't know what to make of this. My keyboard functions fine, and yet it seems to be the issue...(?)

proper pier
finite chasm
cloud matrix
#
{
    textTomato.color = Color.yellow;
}

if (amountTomato == 200)
{
    textTomato.color = Color.yellow;
}```

is there a way to fit both of these into one if statement
finite chasm
cloud matrix
#

thank u

finite chasm
#

that shoudl be right anyway since they both end up doing the same thing

#

your welcome

cloud matrix
#

so basically the || is to do more than one?

finite chasm
#

|| is OR in programming

cloud matrix
#

good to know thank yu

finite chasm
#

like if this = that OR = that

#

np

cloud matrix
#

is therea way to just straight up make it if its a multiple of 100? or do i have to type them all like that

finite chasm
#

modulus operator? %

so like if amountTomato % 100 equals 0 the number is a multiple of 100

#

should work

finite chasm
cloud matrix
#

ill try now ty

finite chasm
#

np

#

need anymore help lmk dms are also always open for longer stuff

cloud matrix
#

it works but i only want the number '100', '200', etc to be yellow, the ones after that are also yellow

cosmic dagger
cloud matrix
#

yeyeye

#

sorry if the multiple thing didnt make sense

finite chasm
# cloud matrix yeyeye
{
    textTomato.color = Color.yellow;
}```

this is rough cause im tired but that should make it to where it makes sure its a multiple of 100 and that its greater than 100. so 200 should work but 201 shouldn't
#

if you need me to break it down further i can

cloud matrix
#

the other numbers are still yellow

proper pier
finite chasm
cosmic dagger
finite chasm
cloud matrix
finite chasm
#

well its supposed to say else at the top

cosmic dagger
finite chasm
#

add that after the other code i sent

finite chasm
cosmic dagger
#

If it's a multiple of 100, turn yellow; else, turn default . . .

cloud matrix
#
{
    textTomato.color = Color.yellow;
}

textTomato.color = Color.white; // default color``` outside like this?
finite chasm
cloud matrix
#

ohh right, im slow ๐Ÿคฆโ€โ™€๏ธ

finite chasm
#
{
    textTomato.color = Color.yellow;
}
else
{
    textTomato.color = Color.white; // default
}```
#

all good ๐Ÿ‘

cloud matrix
#

works like a charm tysm

finite chasm
#

np

cloud matrix
#

one last thing would there be a more efficient way of doing this

#
{
    textTomato.text = "1K";
}

if(amountTomato >= 1100)
{
    textTomato.text = "1.1K";
}```
finite chasm
#

one sec

cloud matrix
#

oo okay

finite chasm
#
{
    float displayValue = amountTomato / 1000f; // convert
    textTomato.text = displayValue.ToString("0.#") + "K"; // format
}```

should be like this so if amountTomato = 1000 its 1K, 1100 = 1.1K, etc etc
cloud matrix
#

ill tset it now, might tatke a while for me to get to 1000 tho ๐Ÿ˜ญ

finite chasm
#

sorry im so used to adding comments when i make code its just habit lol

cloud matrix
#

nah it helps me i like it

finite chasm
#

why did my discord just crash when i clicked on your profile wtf

naive pawn
#

!collab

eternal falconBOT
#

: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

finite chasm
#

make a secret button on a keyboard that you dont specify that actually makes it go up by like value ^ 5 or something instead of doing whatever the game mechanic is

#

fun easter egg

cosmic dagger
cloud matrix
#

wait the one for the yellow just randomly stopped working

finite chasm
#

welcome to the wonders of game development

cloud matrix
#

ohh wait

#

i think i know why

finite chasm
#

worked 5 min ago changed nothing now it doesnt work

cloud matrix
#

๐Ÿ˜ญ

#

EXACTLYY

finite chasm
#

normally breaking something then restarting unity fixes it, for me at least

cloud matrix
#

i fixed it, it was because i tried adding the same tex tcolor thing but for 1000 but i forgot that the else statement said keep the color to white

#

if that makes sense

finite chasm
#

brain said its too late to process that but my eyes understood what you said

cloud matrix
#

LMFAO

#

idk how to explain it its confusing

finite chasm
#

๐Ÿคท

cloud matrix
#
{
    textTomato.color = Color.yellow;
}
else
{
    textTomato.color = Color.white; // default
}```

tried adding this but this 

```textTomato.color = Color.white; // default```

stopped the 100 text from turning yellow
naive pawn
naive pawn
#

100 % 1000 is 100

cloud matrix
#

im failing math

naive pawn
#

you don't need to make a separate thing for multiples of 1000 if you're going for the same result

cloud matrix
#

oh

naive pawn
#

all multiples of 1000 are also multiples of 100

cloud matrix
#

yeah im definetly failing maths

finite chasm
#

at least i dont think it does

cloud matrix
#

how do i constantly update a text to be the same amount as an int

proper pier
# cosmic dagger Google/YouTube search . . .

Ive seen many of these. I was hoping for something with more reading involved. Reading kinda helps explain some more of the advanced stuff better. Appreciate the search tho, thanks.

cloud matrix
#

ohh right thnaku

finite chasm
#

textTomato.text = amountTomato.ToString();

#

in Update()

#

if your referring to those same variables that is idk

cloud matrix
#

im learning more from the people in discord than youtube tutorials help

cloud matrix
naive pawn
cloud matrix
naive pawn
#

also like, that's the point of format strings, to see your value in context

finite chasm
#

sure

finite chasm
cloud matrix
#

i dont thin kso

finite chasm
#

wait

#

i thought you only wanted multiples of 100 to be yellow?

#

so 1132 is not

cloud matrix
#

yeah

#

that part is right

finite chasm
#

so it SHOULD be white, no?

cloud matrix
#

im talking abt the 1.1k thing

finite chasm
#

oh

#

did it work when you were at exactly 1100?

cloud matrix
naive pawn
#

the ToString("0.#K")

finite chasm
#
{
    float displayValue = amountTomato / 1000f;
    textTomato.text = string.Format("{0:0.#}K", displayValue);
}
else
{
    textTomato.text = amountTomato.ToString();
}```
?
cloud matrix
#

sorry im back

cloud matrix
#

it still shows the number

cosmic dagger
finite chasm
#

debug time?

#

already answered that question btw.

cloud matrix
naive pawn
#

make sure you've saved and restarted

cloud matrix
#

ill restart unity gimme a sec

#

still the same

finite chasm
tawny grove
#

why do i have to set my tile anchors to 0.5 instead of 0 or 1? did i mess something up? (when i dont, the tiles arnt aligned properly

finite chasm
cloud matrix
#

alright thanks for the help btw i learnt alot

rancid badger
burnt vapor
#

The UI logic should probably be seperated in general from the actual behaviour

cloud matrix
#

is there a way to make a rawimages size expand when hovering over it
im guessing it would be done with an event trigger?

naive pawn
tawny grove
#

how can i create a prefab of a structure in a tilemap (like a box) and be able to paste those boxes through code into the same tile map?

#

right now i am able to create tiles through the tilemap.settile function, but is there ways to paste entire structures into the tilemap without creating the structure in code?

eager spindle
#

you can store your structure's tiles in an array and use SetTiles with it

queen adder
#

there is no 3D Perlin noise in Unity. I am wondering if it's possible to achieve it using something like this:

val = (perlin2d(x, y) + perlin2d(x, z) + perlin2d(y, z)) / 3๐Ÿค”

west radish
#

as its 2d those lines wont point up into the 3rd dimension. so its not able to understand what values are above or below

gilded canyon
#

how do i make my circle overlap all only affect the player only once per animation

#

private void FixedUpdate()
{
Collider2D[] colliders = Physics2D.OverlapCircleAll(posHit.position, 1f, lm);
if (colliders.Length > 0&&en.anim.GetBool("attack")==true)
{
c.health--;
}
}

west radish
burnt vapor
gilded canyon
gilded canyon
burnt vapor
#

Sorry, not sure what your problem is from the question

#

Just wanted to point out the performance issue

gilded canyon
#

c.health-- is called repeatedly in one animation play. i only want it to affect the player once per animation

burnt vapor
#

Sounds like you need invisibility frames?

#

I'd say add a timestamp when the hit happened using Time.time and check if a certain amount of time passed before deducting health again

#

The example does the same, but instead delays firing

gilded canyon
#

ill have a look

#

oh

gilded canyon
west radish
#
bool PlayerIsHurt = false;

update() {
  Collider2d[] colliders = ...;
  
  bool enemyValidAttack = colliders.Length > 0;
  //this condition must be true when the enemy is currently 
  //attacking the player, and that the attack will definitely
  //cause the player to lose health
  //i.e player has a sword through them right now
   
  if(PlayerIsHurt == false && enemyValidAttack == true) {
    //player is not currently hurt, but the enemy has attacked
    
    health--;
    PlayerIsHurt = true;
  }

  if(PlayerIsHurt == true && enemyValidAttack == false) {
      //the player has been hurt in the past few moments
      //but now the enemy is not currently attacking
      //so reset the hurt bool, this will allow the player to be attacked again
      PlayerIsHurt = false;
  }    
}```
burnt vapor
#

Only if you were incrementing some timer manually, but a timestamp is set once when hurt

#

And Time.time is frame-independent

gilded canyon
#

i see

west radish
#

@burnt vapor I wouldnt suggest they use the code, just as a way to see how you'd cancel something from occurring multiple times

burnt vapor
#

Sure, but your code allows the player to basically hug an enemy without it ever registering twice

#

Or better yet, basically any collideable object that hurts. As long as you hug at least one, the player is invincible

west radish
#

no it would mean if you get hit by a sword, only the first time the sword enters the collider, is when the first if statement gets called. next frame when the sword is still inside, the player wont get hurt, as the health-- conditon cant be entered again

#

only when the sword then leaves the player, would that open the second if statement up to be entered, allowing the first if statement to be entered once again

gilded canyon
burnt vapor
#

It would not, there is no proper way to handle the colliders like this

west radish
#

@gilded canyon actually you know what? why not disable the collider when the hurt animation is active

gilded canyon
burnt vapor
#

Games have always enforces invincibility frames

west radish
#

no collider means no more valid hits

burnt vapor
gilded canyon
burnt vapor
#

Why would you make it more complicated with juggling colliders when you can literally just make the player invincible for a frame

#

Constant damage is bad feedback anyway

burnt vapor
#

No I get it, just want to point out that it's a pretty basic feature

west radish
burnt vapor
#

I can understand that maybe you can also disable the sword from hurting the player, but in that case I would advice you do a reference check or an instance id check on the weapon against a player

#

Don't disable anything, because you limit yourself in what is possible (example, you can't hit multiple objects with the sword)

gilded canyon
burnt vapor
#

I guess it also depends on the actual game you make

ivory saffron
#

i want to make an ability (3D) that creates an expanding spherical AOE. But i dont know what it should do on the ground or in corners. i guess i'm looking for something like flood fill, but the result should resemble a sphere or a cylinder.

naive pawn
#

should it pass through walls?

#

if yes then you could just ignore the whole issue of collision

ripe shard
#

typically, 3D games that donโ€™t use a grid ignore that kind of thing and make walls thick and rooms rather spaced out

west radish
#
[Header("Bounding Box")]
[field: SerializeField] public Vector3 BB_Origin { get; private set; }```I understand how to resolve the error (removing `get;set;`), but why is it an error to begin with? Without the attribute, the property shows up in the inspector just fine
minor radish
#

Does this script have IDE in it ?

north kiln
burnt vapor
west radish
#

oh, interesting!

burnt vapor
#

Also, your !ide is not configured. Please configure it

eternal falconBOT
minor radish
burnt vapor
#

This is Visual Studio Code, not Visual Studio

north kiln
burnt vapor
#

An IDE is an editor like Visual Studio

#

So that makes no sense

west radish
burnt vapor
#

I assume they are asking if they have it configured from their phrasing, in which case it's not

west radish
#

yeah, but the usage of "IDE" is causing some miscommunication here

burnt vapor
#

Hence the phrasing

west radish
#

@minor radish do you mean, "will I be able to open up this file inside an IDE"?

minor radish
#

No what I mean is that "is there something which guide to do my script ?" since as far as I know about IDE it's something that makes the task easier to do in a script but it looks like I don't understand it at all.

frail hawk
#

intellisense

#

is what you are looking for

tough tartan
#

hi im currently trying to get an enemy to move around the map and ive got all the code and followed this tutorial up to the part where he talks about baking which for some reason isnt allowing me to bake properly and therefore not allowing the enemy to move around https://www.youtube.com/watch?v=UjkSFoLxeswv

burnt vapor
eternal falconBOT
burnt vapor
#

In your case for VS Code, though I advice you download Visual Studio or Rider manually as it is not as clunky

frail hawk
#

iwas wondering, how did you determine that his IDE is not set up correctly

burnt vapor
#

Lack of syntax highlighting

tough tartan
#

baking is about 4:40

frail hawk
#

in VS it is obviusly though in VS code not sure.

burnt vapor
#

In VSCode's case it does a good job on trying to do it right, but it's clear it's not configured when enums like KeyCode and Vector2 remain bland because it doesn't know wether it works with a variable or an actual enum

#

In the case of VS you can often see misconfiguration because it simply doesn't know what MonoBehaviour is, but VSCode can support any language so it doesn't error as quick and it makes a lot of assumptions, hence why it knows Monobehaviour and RigidBody2D are probably classes somewhere

frail hawk
#

oh okay

lucid quiver
lucid quiver
minor radish
#

I'm downloading it currently I hope it will work

frail hawk
#

so you switched to VS from VS Code

lucid quiver
lucid quiver
frail hawk
#

he was using vs code before when he posted the screen shot

lucid quiver
#

ya but he hadnt set it up properly

#

u need intellisense extension unity debugger and unity extension, and then u need to regernerate project files from unity project

burnt vapor
tiny vault
#

is there a maximum to how much code you can sent in here at once ? Like is it against the guidelines if i send 100 lines of code?

burnt vapor
burnt vapor
lucid quiver
burnt vapor
#

Also for mobile users because Discord formatting sucks on mobile

burnt vapor
plush chasm
#

When you subscribe to public event Action testEvent; like this.. testEvent += VoidMethodCalled is the method VoidMethodCalled that subscribes to the testEvent an Action itself?

ripe shard
plush chasm
cloud matrix
#
{
    anim.SetTrigger("Walk");
}``` any reason why this wont work?
#

it says something about the || but idk what else to use

#

or do i have to do them all seperate

plush chasm
cloud matrix
cloud matrix
burnt vapor
#

Seriously, if you can't see why this is invalid syntax I strongly recommend you try some basic C# projects first

tawdry quest
#

Yep ari go relearn C#

cloud matrix
#

damn bro mb

burnt vapor
#

There's something that comes close called pattern matching, but it won't work with Input.GetKeyDown anyway

cloud matrix
#

didnt know ur life depended on my code ๐Ÿ˜ญ

ripe shard
tawdry quest
burnt vapor
night raptor
brave compass
burnt vapor
#

I feel like any attempt to explain the problem just ends up making it even more confusing

cloud matrix
#

it works now

ripe shard
burnt vapor
night raptor
tawdry quest
cloud matrix
#

i just did them all seperately

#

bc he explained why they wouldnt work

night raptor
#

sounds right

tawdry quest
#

Not the correct apporoach, but should work

plush chasm
#

What I am really trying to do is simply wrap the event += MethodToCall and wondering if this is incorrect.. it seems to work

public void AddListener(Action d ){
      notification += d;
      //extra code here
  }
night raptor
#

Sure you could use input mappings but getting things to work should be the first step when learning to code

tawdry quest
#

@cloud matrix please watch more C# tutorials, before you get more issues like this, there are webtools, YouTube Vids, etc for C# learning

tawdry quest
#

Prolly a horrible out of date tutorial

burnt vapor
#

TBH Unity's old input system is very limited and horrible so checking multiple keys will never look good

ripe shard
brave compass
plush chasm
#

thanks I think I got it now

tiny vault
#

does anyone have any ideas how to make sure that if this return true, OnPuzzleCompleted is called ?
// If the puzzle is complete and not already flagged, call OnPuzzleCompleted.
if (!isPuzzleComplete) {
isPuzzleComplete = true; // Mark the puzzle as complete to prevent multiple triggers
OnPuzzleCompleted(); // Trigger the completion logic
}

return true;

} i have tried this, but it just makes the game constantly load between different scenes

orchid kite
#

Guys Iโ€™m making 2d platformer and when I jump on a platform my character is always rolling and bouncing around and the jumping is very glitchy pls help

tiny vault
#

CheckCompletion

lucid quiver
orchid kite
lucid quiver
cloud matrix
burnt vapor
#

If it's guaranteed to be an integer, why not use an integer?

minor radish
#

Does it work now is the phrasing here

lucid quiver
lucid quiver
lucid quiver
torn dome
#

HEy
Where do i get help

lucid quiver
torn dome
#

Bro i will not read all this

torn dome
#

i took 5min reading ruels

minor radish
lucid quiver
burnt vapor
lucid quiver
#

type awake and if it suggest a snippet then snippets are on

torn dome
#

i want to use the new input system to move the char

austere pond
#

what's the best way to start learning unity ?

burnt vapor
eternal falconBOT
#

:thinking: Asking Questions

:mag: Search the internet for your question!
:book: Use the API Scripting Reference and User Manual and this troubleshooting site for commonly posted issues.
:wrench: Attempt to debug your issue.
:thought_balloon: Find an appropriate channel by reading the name and description in #๐Ÿ”Žโ”ƒfind-a-channel
:grey_question: And don't ask to ask, ask a full question illustrating with screenshots if needed.
-# For more posting guidelines, go to #854851968446365696

burnt vapor
eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

austere pond
#

!learn

eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

minor radish
lucid quiver
torn dome
short hazel
#

But the answer is not that simple

burnt vapor
torn dome
#

How to make the char move

burnt vapor
#

This is something you can just look up. Right now you probably haven't even tried it

torn dome
#

i did but the tutorials was for top down movement or full 3d movement

lucid quiver
# torn dome i did but the tutorials was for top down movement or full 3d movement

Learn how to use Cinemachine and the new input system to make a First Person Controller in Unity!

แ…Get the full Source Code Bundle to my Unity Tutorials ๐Ÿค“
https://sam-yam.itch.io/samyam-full-source-code-to-all-videos

**DO THIS โ–บ There is an easier way to override the old input system values in cinemachine using the Cinemachine Input Provider (...

โ–ถ Play video
torn dome
#

and iam not that good at english

lucid quiver
#

do this is is for fps pov

short hazel
#

If your player moves side by side, it's better to have Left/Right (A/D) as one axis, and the jump (Up or Z) as another, instead of a single 2D Vector for the full WASD

#

From your screenshot it seems that you're in 3D, but always using a fixed perspective, like in 2D

lucid quiver
short hazel
#

That has no link to using Cinemachine

#

You can make games without using that

torn dome
short hazel
#

Yeah so 3D but viewed from the side

torn dome
#

So i just use 2d input system

lucid quiver
#

if u only need a single set of controls u could just use unity's old input system, it would be simpler

burnt vapor
#

No, you should not use old deprecated legacy features just because it's easier

lucid quiver
short hazel
#

Plus the new one is enabled by default IIRC, so it's more hassle to re-enable the old one

burnt vapor
#

I know, I already modified my message to clarify it's not actually deprecated before yours

#

It's legacy, like the old text system. Just like with that, you should not use it

#

It just remains for backwards compatibility

lucid quiver
orchid kite
#

Alr

lucid quiver
#

also learn to screen record dude

orchid kite
#

Iโ€™m on my phone sry

lucid quiver
#

its fine for now

balmy hearth
#

So i have the Problem that when i shoot at the player he is losing damage but i see his health and mine at the same time

hot laurel
#

if there was one you would have one

orchid kite
lucid quiver
eternal falconBOT
orchid kite
#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class MonkeyScript : MonoBehaviour
{
    public float speed;
    private float move;
    public float jump;
    private Rigidbody2D z;
    public bool isJumping;

    //scale values of monkey
    float zy = 0.56f;
    float zx = 0.53f;

    // Start is called before the first frame update
    void Start()
    {
        z = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {

        //movement
        move = Input.GetAxis("Horizontal");
        z.velocity = new Vector2(speed * move, z.velocity.y);

        //jump
        if (Input.GetButtonDown("Jump") && isJumping == false)
        {
            z.AddForce(new Vector2(z.velocity.x, jump)); 
        }

        //change directions
        if (move > 0.01f)
            transform.localScale = new Vector3(zx, zy, 0);
        else if (move < -0.01f)
            transform.localScale = new Vector3(-zx, zy, 0);
    }

    private void OnCollisionEnter2D(Collision2D other)
    {
        //ground check
        if (other.gameObject.CompareTag("Ground"))
        {
            isJumping = false;
        }
    }

    private void OnCollisionExit2D(Collision2D other)
    {
        //ground check
        if (other.gameObject.CompareTag("Ground"))
        {
            isJumping = true;
        }

    }

    //attack

    public bool canAttack()
    {
        return move == 0;
    }

}

#

here it is

lucid quiver
#

gimme a sec

orchid kite
#

alr thanks man

languid spire
orchid kite
#

i formatted the code

languid spire
#

Large Blocks should use a paste site, yours is a large block

orchid kite
#

sry

#

ill do it next time

lucid quiver
orchid kite
#

alr

#

thx

lucid quiver
orchid kite
#

ok i am gonna eat and then try thanks

#

also do u know how i can split up my monkey character to animate later by chance

lucid quiver
orchid kite
#

like split arm and legs for example

lucid quiver
orchid kite
#

yes

cloud matrix
#
{
    anim.SetBool("Walk", false);
    anim.SetTrigger("MoveShoot");
}```

any reason why this doesnt work?

basically tryna make it so if ur moving and shooting the shooting anim plays instead of the moving one
lucid quiver
# orchid kite yes

then just make them different sprites and put them under a empty gameobject

orchid kite
#

okkk

torn dome
#

I used code at the end and it worked

cloud matrix
#

im still tryna learn raycasts tbh

burnt vapor
#

Does it call the code?

#

Does SetBool work? Does SetTrigger work? More context please

#

If it's the wrong animation then it's probably pointing to the wrong animation?

#

This code is valid so idk what else to say

cloud matrix
cloud matrix
#

okay wtf nevermind it just decides to work now ๐Ÿ˜ญ

lucid quiver
cloud matrix
lucid quiver
# burnt vapor What doesn't work?

i am a bit confused about the working of it thats why i stopped using the old system
the documentation says that getmousedown is only supposed to return true on the instance that the mouse was clicked but most of the time it still returns true as long as mousbutton is pressed down

cloud matrix
#

imma learn how to add gun cooldown brb

shell dagger
#

why that box just on air?

short hazel
shell dagger
#

scene box is working

#

how i search this one

lucid quiver
lucid quiver
shell dagger
lucid quiver
#

try restarting the project

shell dagger
#

work in main scene

#

how i fix this box in subscene?

scarlet hull
#

can i somehow drag this into this? they are in diffrent scenes

hot laurel
#

GameObjects are bound to scene they are instantiated in, you cant cross reference. You can use prefab or on scene load look for given gameobject in other scenes. So you can store gameObject name and look for it later, there are other solutions too.

burnt vapor
#

Is this some save object you want to save or something?

kind cave
#

How to set frame rate to unlimited?

#

Android

#

Is it Application.targetFrameRate = -1; ?

frail hawk
#

even if that is possible i would not do that, it is recommended to limit the fps on mobile to save battery

kind cave
#

30, 60 and unlimited

#

Default will be 60

swift crag
#

on mobile, a target frame rate of -1 winds up giving you 30 fps

kind cave
swift crag
#

you must pick a specific framerate if you want anything higher

swift crag
#

You should figure out the display's refresh rate and use that

kind cave
#

You, there is no unlimited

swift crag
#

I think that's what Pokemon Go does, for example

#

the default is 30, and there's a setting to use the native refresh rate

kind cave
#

Thanks

grand snow
#

I set the frame rate to the device refresh rate as otherwise it will be 30 by default

kind cave
grand snow
lapis veldt
#

Hello. How can I make my jump script synchronize with the jump animation? I am using the unity input system for character movement

swift crag
#

You can use animation events to get a callback at a certain point in the animation

misty pecan
#

void Flip() { facingRight = !facingRight; Vector3 Scaler = transform.localScale; Scaler.x *= -1; transform.localScale = Scaler; }

#

if (facingRight == false && moveInput > 0) {Flip();} if (facingRight == true && moveInput < 0) {Flip();}

#

this code is doing nothing for some reason

#

it started doing this after adding animations to do with scale does anyone know a fix

verbal dome
swift crag
#

Perhaps your animations are controlling the scale of the player

verbal dome
#

Do you have an animator that could be modifying the scale?

misty pecan
#

yes i do but i dont know the way around this sorry im a beginner

#

ive been stuck on this for a while ive searched everywhere for solutions

misty pecan
swift crag
#

You can check if this is happening by trying to change the player's scale while the game is running

#

just go in the inspector and type something in

#

if the value immediately resets, then the animator is controlling it

misty pecan
#

yes youre right

#

so what do i do?

verbal dome
#

Remove the scale keyframes from the animations that your character uses, i suppose

misty pecan
#

i want to keep the animation though i just want it to play flipped when character is flipped this must be possible?

verbal dome
#

I didnt say remove the whole animation, just remove the keyframes that modify your scale

#

Could just remove the X scale and keep Y if you want

misty pecan
#

ok i will try this

swift crag
#

You can set a sprite renderer to flip on the X axis using the flipX property

#

This wouldn't cause all of your child objects to flip, though

misty pecan
swift crag
#

alternatively, consider setting up your character like this

swift crag
#
  • Character
    • Body <-- animator, sprite renderer
      • Hitbox
    • Whatever
#

you can freely manipulate the Character object

swift crag
#

Body (and all of its children) will be affected by whatever the animator does to its scale

misty pecan
#

perfect thank you for this

swift crag
#

This is how I set up most of my prefabs

misty pecan
#

nevermind hes teleporting to the mirrored side of the screen wtf

swift crag
#

Your body is probably positioned far away from the root right now

#

make sure its local position is zero

misty pecan
#

should the rigidbody be on the parent object or still on the body

misty pecan
swift crag
#

along with, say, the character movement component

nocturne kayak
#

Hey, i think i'm understanding vector3.project incorrectly

#

Can someone give me a hand here?

#

i'm trying to project the green sphere onto the green line based on the red sphere's movement

#

it seems to be projecting correctly, just at an offset, i suppose

swift crag
#

You're getting a direction, but you're missing an origin

#

Subtract the origin of that green line, do the projection, and then add the origin back

nocturne kayak
swift crag
#

It doesn't make sense to project a position

#

A position is a point in space. It doesn't have a direction, really

nocturne kayak
#

That i understand (which honestly makes Vector3 confusing to me sometimes)

swift crag
#

The problem would be more obvious if we were using homogeneous coordinates, actually

#

they're 4D points

#

the 4th component is 1 for a position and 0 for a direction

#

it winds up neatly making sense

#

[3,0,0,1] - [1,0,0,1] = [2,0,0,0]

#

you can add directions to each other, and you can add a direction to a point

#

but you can't add two points together, for example

nocturne kayak
#

I get there are direction vectors and positional vectors

#

position is easy to get, simple coordinates in space

#

but direction is a bit tougher to visualize

swift crag
#

but yes -- if you're using 3-vectors in 3D space, positions and directions aren't distinct

#

you can interpret the same value as both a position and a direction

swift crag
#

If we just do the projection naively, we throw out the X component completely

#

the result is a position of [0,1,0]

#

By subtracting the origin before projecting, we get just the direction between the origin and the point

#

which makes sense to project

#

and then we add the origin back to get a position again

#

[10,1,0] - [10,0,0] = [0,1,0]
projecting [0,1,0] onto [0,1,0] does nothing
[0,1,0] + [10,0,0] = [10,1,0]

and that's the result we actually wanted

naive pawn
#

in 3d, same with a plane instead of a line, no?

swift crag
#

You can do it, but does it make sense?

naive pawn
#

yes?

#

if you look through the plane orthogonally, where does the point end up on the plane

swift crag
#

yes, and you can also multiply the point by 3 trillion, but does that make sense? (:

naive pawn
#

if you need to, yeah

swift crag
#

The goal is to find a point on the line based on the position of the red sphere

naive pawn
#

are you talking about "making sense" for the actual problem, or just the operation?

swift crag
#

The former.

naive pawn
#

ah, ok. mb then, thought you meant the latter

swift crag
swift crag
#

(because in that case, subtracting the line's origin does nothing anyway)

#

the green line

naive pawn
#

you wouldn't project onto the direction of the line, you'd project onto the line

#

doesn't have to be from the origin

swift crag
#

well, sure, but you do that by subtracting the origin of the ray from your position, then projecting that onto the direction of the ray

#

(and then adding the ray's origin back in)

#
Vector3 projectedPointOnNormal = Vector3.Project(pointOnPlane, axisHandler.transform.up);

This is what the problem code did.

#

The correct code would be...

Vector3 result = pointOnPlane - axisHandler.transform.position;
result = Vector3.Project(result, axisHandler.transform.up);
result += axisHandler.transform.position;
naive pawn
#

you're just reassigning result there?

swift crag
#

oopsie

#

I changed the name and didn't update one of the uses

#

๐Ÿคซ

naive pawn
#

i think i missed too much context to really think about the situation lol

nocturne kayak
#

Gizmos.color = Color.red; Vector3 pointOnPlane = ray.GetPoint(enter); Gizmos.DrawWireSphere(pointOnPlane, 0.1f); Gizmos.color = Color.green; Vector3 projectedPointOnNormal = Vector3.Project(pointOnPlane - axisHandler.transform.position, axisHandler.transform.up ); Gizmos.DrawWireSphere( projectedPointOnNormal + axisHandler.transform.position , 0.2f);

#

This seemed to work

#

i dont get why id want a result += there

naive pawn
#

it's offseting by axisHandler.transform.position

swift crag
#

oh, you did the same thing as I did, just without modifying projectedPointOnNormal

#
Something(foo + bar)

is identical to

foo += bar;
Something(foo);
#

it's just that your code winds up with a misleadingly-named variable

#

projectedPointOnNormal contains the projected vector -- which tells you how far away from the axis handler's position your point should be

#

The proper name would be projectedVector or offset or something like that

#
Vector3 rayOrigin = axisHandler.transform.position;
Vector3 rayDirection = axisHandler.transform.up;

Vector3 originalOffset = pointOnPlane - rayOrigin;
Vector3 projectedOffset = Vector3.Project(originalOffset, rayDirection);
Vector3 finalPosition = projectedOffset + rayOrigin;
#

Perhaps that makes it more clear?

lucid quiver
errant rock
#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Example : MonoBehaviour
{
private CharacterController controller;
private Vector3 playerVelocity;
private bool groundedPlayer;
private float playerSpeed = 2.0f;
private float jumpHeight = 1.0f;
private float gravityValue = -9.81f;

private void Start()
{
    controller = gameObject.AddComponent<CharacterController>();
}

void Update()
{
    groundedPlayer = controller.isGrounded;
    if (groundedPlayer && playerVelocity.y < 0)
    {
        playerVelocity.y = 0f;
    }

    Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    controller.Move(move * Time.deltaTime * playerSpeed);

    if (move != Vector3.zero)
    {
        gameObject.transform.forward = move;
    }

    // Makes the player jump
    if (Input.GetButtonDown("Jump") && groundedPlayer)
    {
        playerVelocity.y += Mathf.Sqrt(jumpHeight * -2.0f * gravityValue);
    }

    playerVelocity.y += gravityValue * Time.deltaTime;
    controller.Move(playerVelocity * Time.deltaTime);
}

}

What do I need to change here to make my character move? I just need a simple wasp jump control

naive pawn
#

seems like the movement should work fine, but this just makes no sense

gameObject.transform.forward = move;

naive pawn
#

oh wait yeah i see what that's doing

#

there's no mouse movement there

#

so what's not working with it

errant rock
#

well the character just doesn't move at all

naive pawn
#

have you set the input axes

errant rock
#

gravity and all the collision boxes work, just doesn't move

naive pawn
#

and make sure you've saved and set everything

errant rock
#

no? idk? I legit just created a new monoscript, pasted that, saved and tried to run the game to see if the character moves

naive pawn
#

did you add the script to your player object

eternal falconBOT
errant rock
#

yes i think

naive pawn
#

ok so start debugging, try logging out move for example

errant rock
#

what does that mean?

naive pawn
#

Debug.Log(move)

errant rock
#

huh?

#

where do i run that?

naive pawn
#

in the Update function, after you've set move

errant rock
#

uh there are these errors when i run the game

errant rock
naive pawn
#

yes that's called a function

naive pawn
lucid quiver
errant rock
lucid quiver
errant rock
#

ok

naive pawn
lucid quiver
#

ur editor should already have lines numbered

short hazel
#

Line 21 is the line labeled "21" in your code editor

errant rock
#

line 21 is

groundedPlayer = controller.isGrounded;

errant rock
short hazel
#

ouch

#

Download an IDE, it is better and aditionally required to get help here

#

!ide

eternal falconBOT
lucid quiver
lucid quiver
errant rock
#

The most experience in coding I have is editing a few lines of lua for my fivem server lmfao

naive pawn
#

oh wait

#

oh you shouldn't have one since Start is adding one

errant rock
short hazel
#

Community, the other editions are paid

naive pawn
#

are you enterprise/pro? no? then community

lucid quiver
#

private void Start()
{
controller = gameObject.AddComponent<CharacterController>();
} Make this controller =GetComponent<CharacterController>();

#

add component in editor not in script

errant rock
#

where? how?

lucid quiver
errant rock
#

I'm not good at this unity stuff ๐Ÿ˜ญ

lucid quiver
lucid quiver
errant rock
#

just 1 min pls while I install this IDE thing

lucid quiver
lucid quiver
#
private void Start()
    {
        controller =GetComponent<CharacterController>();
    }
#

replace the start with this when ur done

errant rock
#

ok got the IDE

#

is this correct

lucid quiver
# errant rock

well u still need to configure the ide to add intellisense and autorcomplete and stuff.. but for now just try running ur project and see if it works

#

or if atleast the errors are gone

errant rock
#

okay ๐Ÿ™‚

errant rock
lucid quiver
#

no other way

#

if u have obs its quite easy

errant rock
#

ok

rocky canyon
#

mkv formats wont embed

#

use mp4

lucid quiver
#

tons of convertor from mkv to mp4 online

rocky canyon
errant rock
#

as you can see the character does like a break dance when I don't press anything, and it moves like a compass, w = north.ect I need a movement system where, where ever the the camera is facing is forward and well to be able to move the camera. I need a gta style movement system ygm?

rocky canyon
#

can just mask off part of ur screen to record as well

#

we actually cant see

errant rock
#

1 sec i'm converting it

lucid quiver
lucid quiver
# errant rock

click on the player and in the rigidbody of the player under contraint rotation check the X and Z axis

rocky canyon
errant rock
#

ok

#

awesome breakdance fixed, does anyone know where I can find a camera control script so it moves with my mouse, and how to make forward be where the camera is facing so movement is less compass like

naive pawn
#

you should not have both a rigidbody and a charactercontroller on the same object, they will compete to control transform

naive pawn
eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

errant rock
#

really? 2 days ago I was told I needed both because I kept falling thru the ground

naive pawn
#

the example given in the charactercontroller docs is just that: an example
it probably does not do what you want it to

lucid quiver
errant rock
lucid quiver
#

make an input manager script and refference from there

naive pawn
#

you don't need both, no

lucid quiver
swift crag
#

by..using the character controller

naive pawn
#

there's a ground check in the charactercontroller example code

swift crag
#

the character controller will already stop you from moving through colliders

lucid quiver
#

huh

#

it also gives gravity?

swift crag
#

no, you have to calculate that yourself

#

(unless you're using SimpleMove)

lucid quiver
#

isnt it easier to have a rigigdbody on the player and then character controller on its empty parent?

swift crag
#

that sounds very weird

#

the player would...fall down, away from the parent

#

so you'd have this player object rattling around like a loose screw in your PC case

errant rock
naive pawn
eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

lucid quiver
lucid quiver
#

look up cinermachine doc

errant rock
#

but it's only compatible up to 3.1.2

swift crag
#

3.1.2 is the latest version of the package

#

that version is available in unity 2022.3 onwards

lucid quiver
errant rock
#

ah

naive pawn
rocky canyon
#

u can add smoothing to it if u want

lucid quiver
lucid quiver
#

and implemented cinemachine

languid spire
#

No, LookAt says 'None'

errant rock
#

nvm noticed my mistake

errant rock
languid spire
#

I'm guessing you want your Camera to LookAt your Character

lucid quiver
#

post an ss

loud vault
#

Something about my game's resolution is off. In windowed mode the game looks good, but in full screen the edges are jagged
Another thing is that to take a pic of the jagged graphics I had to take a pic with my phone, because if I take a screenshot it looks like in the windowed version
Maybe it has something to do with the monitor resolution settings?

wintry quarry
errant rock
naive pawn
loud vault
wintry quarry
lucid quiver
loud vault
#

If the monitor is 2560 ร— 1440 shouldnt it return 2560?

errant rock
lucid quiver
errant rock
#

regular

#

I fixed the zooming issue, somehow

#

not sure what I did tho lmfao

steep rose
errant rock
#

unfortunatly the camera script isn't moving with my mouse

lucid quiver
lucid quiver
errant rock
#

below player move in the character's inspector

lucid quiver
#

need to see the code

errant rock
#

oh

#

how do yall do that black box thing for the code

steep rose
#

!code

eternal falconBOT
rocky canyon
#
       Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed * Time.deltaTime);
        transform.position = smoothedPosition; // basic smoothing using `Lerp`
rocky canyon
#

triple tick for block.. single tick for single line of code

errant rock
#

'''cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMove : MonoBehaviour
{

private const float YMin = -50.0f;
private const float YMax = 50.0f;

public Transform lookAt;

public Transform Player;

public float distance = 10.0f;
private float currentX = 0.0f;
private float currentY = 0.0f;
public float sensivity = 4.0f;


// Start is called before the first frame update
void Start()
{
  

}

// Update is called once per frame
void LateUpdate()
{

    currentX += Input.GetAxis("Mouse X") * sensivity * Time.deltaTime;
    currentY += Input.GetAxis("Mouse Y") * sensivity * Time.deltaTime;

    currentY = Mathf.Clamp(currentY, YMin, YMax);

    Vector3 Direction = new Vector3(0, 0, -distance);
    Quaternion rotation = Quaternion.Euler(currentY, currentX, 0);
    transform.position = lookAt.position + rotation * Direction;

    transform.LookAt(lookAt.position);

 

}

}

'''

#

damn

wintry quarry
#

` not '

rocky canyon
#

nope, wrong key.. its the one above ur Tab key ๐Ÿ‘‡

errant rock
#

ohhh

verbal dome
#

Depends on your keyboard layout

errant rock
#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMove : MonoBehaviour
{

    private const float YMin = -50.0f;
    private const float YMax = 50.0f;

    public Transform lookAt;

    public Transform Player;

    public float distance = 10.0f;
    private float currentX = 0.0f;
    private float currentY = 0.0f;
    public float sensivity = 4.0f;


    // Start is called before the first frame update
    void Start()
    {
      

    }

    // Update is called once per frame
    void LateUpdate()
    {

        currentX += Input.GetAxis("Mouse X") * sensivity * Time.deltaTime;
        currentY += Input.GetAxis("Mouse Y") * sensivity * Time.deltaTime;

        currentY = Mathf.Clamp(currentY, YMin, YMax);

        Vector3 Direction = new Vector3(0, 0, -distance);
        Quaternion rotation = Quaternion.Euler(currentY, currentX, 0);
        transform.position = lookAt.position + rotation * Direction;

        transform.LookAt(lookAt.position);

     

    }
}
#

yay

rocky canyon
#

true.. i just assume no one has different keyboard layouts than me.. ๐Ÿคช

errant rock
#

ty guys!

steep rose
#

I believe most people have qwerty

rocky canyon
#

ur mouse inputs dont need scaling

verbal dome
#

Special characters are in different places

steep rose
#

okay

steady phoenix
#

Yo

rocky canyon
#

for example

#

still qwerty.. but no tilde key

errant rock
steep rose
#

well of course if you are using a custom keyboard

rocky canyon
errant rock
#

yea i get that, just saying idk any of this yet. I'm gonna get on that !,learn thing soon

lucid quiver
rocky canyon
#

time.deltaTime ...

lucid quiver
#

yes thats unnecesary

rocky canyon
#

altho** in his case.. since he's +=

lucid quiver
rocky canyon
#

but either way... just something to remember.. mouse delta's work all on their own

#

with any reasonable code

verbal dome
#

It's not just that it's unnecessary, it's problematic

#

It makes your mouse FPS dependent again

lucid quiver
rocky canyon
#

plus u then need to use tiny values..

#

i dont like

errant rock
#

well the camera just isn't moving when I move the mouse, which is obvs what I want it to do

rocky canyon
#

what type of camera movement u working on?
i missed that part

lucid quiver
steady phoenix
#

Can anyone suggest me a unity c# free course that is useful?
I watched a lot of them but they just write cods fast and the only thing that you can do is copying them, afterward you will learn nothing and cant even write a single line of code by your own.

errant rock
#

pov i think? like GTA's camera and movement style

slender nymph
eternal falconBOT
#

:teacher: Unity Learn โ†—

Over 750 hours of free live and on-demand learning content for all levels of experience!

lucid quiver
rocky canyon
#

if ur doing first person then a setup like this is usually the simplest

errant rock
#

I'm doing 3rd person

#

well trying too

rocky canyon
#

ahh okay.. Cinemachine ๐Ÿซ 

lucid quiver
#

needs much less script as well

rocky canyon
#

mmhmm definitely for OTS or Third Person

#

i wouldnt even attempt a ThirdPerson camera script w/o cinemachine

#

mainly b/c of camera clipping/collisions

lucid quiver
steep rose
rocky canyon
#

this is what a cinemachine third person setup would look

#

each ring being an orbit

#

and it'll shift between them

steep rose
#

although cinemachine makes it a lot easier

lucid quiver
#

like 10x easier

bitter canyon
#

public class SkillConnectionComponent : MonoBehaviour
{
    public Skill SkillA;  // The first skill this connector is connected to
    public Skill SkillB;  // The second skill this connector is connected to

    private void Update()
    {
        // Ensure that both SkillA and SkillB are not null
        if (SkillA != null && SkillB != null)
        {
            // Always check if both skills are visible
            bool bothVisible = SkillA.visible && SkillB.visible;

            // Log for debugging purposes
            Debug.Log($"SkillA visible: {SkillA.visible}, SkillB visible: {SkillB.visible}, BothVisible: {bothVisible}");

            // Set the connector's visibility based on the visibility of both skills
            gameObject.SetActive(bothVisible);
        }
        else
        {
            // If one or both skills are null, the connector shouldn't be visible
            gameObject.SetActive(false);
        }
    }
}

any idea why update is not being called repeatedly? this script is attached to a prefab which is instantiated when the game starts

rocky canyon
#

In this tutorial, learn how to use Cinemachine in Unity for creating Orbital and free look camera in your 3D game projects, with step-by-step instructions and practical tips to enhance your game development skills.

Cinemachine basics tutorial: https://youtu.be/nWGfDsWu5Yc?si=ss5VJrg3RZ-sauGB
-----------------------------------------------------...

โ–ถ Play video
#

heres a video.. he even uses a car and mentions GTA

#

might be something helpful

lucid quiver
bitter canyon
#

the debugs are only being run once in my console

wintry quarry
rocky canyon
#

they're probably collapsed

lucid quiver
rocky canyon
verbal dome
#

I think they might be collapsed

lucid quiver
#

ya

rocky canyon
#

at the far right it'll tell how many of that same error is logged

bitter canyon
#

oh crap you might be right hold on my pc just turned off

rocky canyon
#

usually 999+ in update

bitter canyon
#

this appears on start and doestn add any more

#

this is uncollapsed

verbal dome
#

Place a log inside the else block

bitter canyon
#

same thing

#
        {
            Debug.Log("elsetest");
            // If one or both skills are null, the connector shouldn't be visible
            gameObject.SetActive(false);
        }

wintry quarry
#

since bothVisible is false, you are deactivating the object

#

once you deactivate it, Update will stop running.

bitter canyon
#

oh

#

that is true

#

i just need it to not be visible

wintry quarry
#

don't Deactivate the whole GameObject

bitter canyon
#

would this line work?

gameObject.GetComponent<Renderer>().enabled = false;

wintry quarry
#

get a reference to it in all the normal ways to get references.

bitter canyon
#
using UnityEngine;

public class SkillConnectionComponent : MonoBehaviour
{
    public Skill SkillA;  // The first skill this connector is connected to
    public Skill SkillB;  // The second skill this connector is connected to

    private Renderer myRenderer;  // Reference to the Renderer component

    private void Awake()
    {
        // Get the Renderer component attached to this GameObject
        myRenderer = GetComponent<Renderer>();
    }

    private void Update()
    {
        // Ensure that both SkillA and SkillB are not null
        if (SkillA != null && SkillB != null)
        {
            // Always check if both skills are visible
            bool bothVisible = SkillA.visible && SkillB.visible;

            // Log for debugging purposes
            Debug.Log($"SkillA visible: {SkillA.visible}, SkillB visible: {SkillB.visible}, BothVisible: {bothVisible}");

            // Set the connector's visibility based on the visibility of both skills
            myRenderer.enabled = bothVisible;
        }
        else
        {
            Debug.Log("One or both skills are null, hiding connector.");
            // If one or both skills are null, the connector shouldn't be visible
            myRenderer.enabled = false;
        }
    }
}

ok so i have this working but the connectors are visible even though bothVisible = false

errant rock
#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraMove : MonoBehaviour
{

    private const float YMin = -50.0f;
    private const float YMax = 50.0f;

    public Transform lookAt;

    public Transform Player;

    public float distance = 10.0f;
    private float currentX = 0.0f;
    private float currentY = 0.0f;
    public float sensivity = 4.0f;


    // Start is called before the first frame update
    void Start()
    {


    }

    // Update is called once per frame
    void LateUpdate()
    {

        currentX += Input.GetAxis("Mouse X") * sensivity * Time.deltaTime;
        currentY += Input.GetAxis("Mouse Y") * sensivity * Time.deltaTime;

        currentY = Mathf.Clamp(currentY, YMin, YMax);

        Vector3 Direction = new Vector3(0, 0, -distance);
        Quaternion rotation = Quaternion.Euler(currentY, currentX, 0);
        transform.position = lookAt.position + rotation * Direction;

        transform.LookAt(lookAt.position);



    }
}

Something is wrong here coz the camera isn't moving at all when I move my mouse, at this time I was not to use cinemachine, could someone pls take a look at this script and elaborate to me why it own't work and how to fix it please.

lucid quiver
#

what are u looking at?

rocky canyon
#
        transform.position = lookAt.position + rotation * Direction;
        transform.LookAt(lookAt.position);``` its a bit weird that you set the things position to and *then* look at it?
#

idk if im reading that right

#

wouldnt it be like

Vector3 positionToLookAt;
positionToLookAt = lookAt.position + rotation * Direction;
transform.LookAt(positionToLookAt);```
errant rock
lucid quiver
#

if lookAt is player's tranform then ofc camera doesnt follow mouse

errant rock
#

oh?

lucid quiver
rocky canyon
#

the position for the camera to aim at should be out in front of the character no?

errant rock
#

thats a good point, so I need it to follow the cursor and then have the character do the same

rocky canyon
#

u need to raycast into the world.. from teh camera -> thru the cursor

lucid quiver
rocky canyon
#

and look at that

#

or ^ that

#

debug the values ur using too..

errant rock
#

ok umm how do i do that

rocky canyon
#

can help visualize it

errant rock
#

lol

lucid quiver
#

dude all this would be like a piece of cake with cinemachine u sure u dont wanna use it?

errant rock
#

well yall keep pointing me to it but not explaining what exactly it is, so atm no not really. I have the main cam set to the angle I want, and it's attached to the character's mesh

lucid quiver
#

all u woud need to do is set up a empty object to where u want the camera to be and tell the camera to follow that and clamp the rotation

rocky canyon
errant rock
rocky canyon
#

you would be getting errors if they're not assigned.. but lots of newer guys dont even check their console for errors

bitter canyon
# bitter canyon

could this have to do with the fact this uses an image to visualize it and not a sprite

lucid quiver
errant rock
#

tbf the camera already follows the player, so I just need to make the camera move with the mouse and have the character follow that point

lucid quiver
#

and remove the Time.deltaTime from mouse inputs

#

oh wait

#

ur using look at

#

wait

errant rock
#

ok i'll wait ๐Ÿ™‚

errant rock
#

ok

lucid quiver
#

i dont use the lookAt method much while using regular cam so i am not that used to it

errant rock
lucid quiver
errant rock
#

well I've changed the line, what do I tell look at to well look at now?

lucid quiver
#

just try running the project after u changed the line