#💻┃code-beginner

1 messages · Page 591 of 1

earnest ginkgo
#

Hey can anyone help me create a code for pressing a button and then that disables a script coz i cant find any totorials

brittle girder
#

I have a question, on this list/array i noticed it added a _0 at the end of both of them. does this have any effect on their position in the list?

brittle girder
#

i'm having a bunch of trouble with this on click event and cant seem to solve it, been googling for 12 hours. just trying to find whats wrong.

#

@void thicket ive changed the name of my sprite and it still seems to show the wrong name also, thats why im trying to figure that out. thanks for your timely response

void thicket
#

Which you can edit in sprite editor instead

#

Though I don't think that'd affect onClick, at all

brittle girder
#

yea, i dont think so. on the click im trying to have it where i click appropriate button, and the sprite changes to the appropriate race. nothing i do seems to work as intended and im shocked that i couldnt find any information on it despite it being so common. havent slept lol

brittle girder
#

man, ive done a bunch of different ways to try so many different angles. at the moment i created a child of the canvas as a text button, then I enabled the onclick() and created a script called racemanager

#

first i tried making it add to an integer and have the sprite go up the list as i clicked one of the buttons and down the list as i clicked another (this isnt what i want but i was trying to get something to work)

#

and that failed

#

at this moment, the last thing i tried to do was make a bool for the race i want to select, and if it was true to change the sprite into the appropriate one by telling the .sprite = list[value]

#
public class RaceManager : MonoBehaviour
{
    public SpriteRenderer sr;
    public List<Sprite> race = new List<Sprite>();
    public bool dwarfpick = false;
    private int selectedRace = 0;
    public GameObject playerrace;



    public void dwarfOption()
    {
        
        if (dwarfpick == true)
        {
            sr.sprite = race[1];
        }


    }
#

this is where im embarassingly sitting at now lol

#

one second ill show you where i started

polar acorn
#

How I might go about doing this would be to have the button have a reference to the Sprite you want to use, then you click the button and it passes that reference to whatever thing draws the sprite

#

So, you'd have a RaceManager, but rather than keeping a list of all possible sprites, it's just receptive to having something else tell it to change, then your buttons can send it a sprite and some sort of enum or whatever you use to keep track in code

brittle girder
#
public class RaceManager : MonoBehaviour
{
    public SpriteRenderer sr;
    public List<Sprite> race = new List<Sprite>();
    public bool dwarfpick = false;
    private int selectedRace = 0;
    public GameObject playerrace;



    public void dwarfOption()
    {

        selectedRace = selectedRace + 1;
        if (selectedRace == race.Count)
        {
            selectedRace = 0;
        }
        sr.sprite = race[selectedRace];


    }
polar acorn
#

Makes it easier to add new ones

brittle girder
#

this is what i had at first

#

digiholic could you give an example?

#

the second one i sent i was just trying to get it to go up in the list

grand snow
#

lol even i did it wrong (what you did is fine)

void thicket
#

Does the callback get called?

polar acorn
brittle girder
#

nothing seems to happen when i do it, honestly i dont know how to check whats happening on the backside

brittle girder
void thicket
#

Does the button get clicked at all

#

Changing colors when hover/click

brittle girder
#

here is button component

#

yeah the button changes colors

#

when i click it

grand snow
#

er whats that visual scripting thing

brittle girder
#

i tried with it off and on

#

the check mark lol

#

i ahve no idea what that is nor do i know what visual scripting is

void thicket
brittle girder
#

im guesing the drag and drop block things

#

yea.

void thicket
#

What gets highlighted if you click that racemanager reference

brittle girder
grand snow
#

haha no you tell us if thats the correct object

void thicket
#

Ok let's log first

#

In the dwarfOption add some Debug.Log so you can see if it is called at all

brittle girder
#

it is indeed saying chicken pot pie

void thicket
brittle girder
#

im assuming the Dwarfpick is just a representation of the bool

void thicket
final kestrel
#

oops.

brittle girder
#

i dragged the object from view port into the slot

#

when i first did it

#

and also tried from the hierarchy

queen adder
#

i need help with GetComponent, GetComponent("string name of my script") works, but GetComponent<name of my script> doesnt, so i cant access the values within the script

polar acorn
queen adder
#

a public class i declared previously

#

that inherits from monobehaviour

polar acorn
queen adder
#

as in the folder or?

naive pawn
queen adder
#

do i just screenshot it

void thicket
polar acorn
#

Show the !code, and how you're determining what it's returning

eternal falconBOT
queen adder
#

its too long it says

rich adder
polar acorn
#

darn if only such a thing existed

swift crag
#

😉

crystal chasm
#

Just copy the line in question

rich adder
polar acorn
queen adder
brittle girder
#

@void thicket yea, sprites not changing at all

queen adder
#

like that?

#

that is the class i inherit from

polar acorn
#

Okay. There are no GetComponents in there

rich adder
#

its meant for exposing private fields, publics are already exposed

queen adder
#

this is the class i inherit tohttps://paste.mod.gg/neghxyxalzoo/0

rich adder
#

(unrelated to your issue)

queen adder
#

and here is where i call it from

void thicket
queen adder
#

specifically ive had trouble in line 130 of that last part

#

ive tried everything i found i nthe forums and absolutely nothing worked

polar acorn
queen adder
#

because its an object within the game

polar acorn
#

Make the variable the type you actually want

queen adder
#

its a script that takes values where to aim from what i remember

#

ill check again

brittle girder
polar acorn
void thicket
queen adder
polar acorn
# queen adder https://paste.mod.gg/qvogwvffovgy/0

Add this line before the if:

Debug.Log($"Collided with {masterhit.collider.gameObject.name}. String GetComponent: {masterhit.collider.gameObject.GetComponent("Compatiblecontrollingchar")}, Correct GetComponent: {masterhit.collider.gameObject.GetComponent<Compatiblecontrollingchar>()}");
polar acorn
queen adder
#

gotcha

#

on it

void thicket
queen adder
#

Collided with droidtrooper. String GetComponent: droidtrooper (DroidControls), Correct GetComponent:

#

thats what it says

polar acorn
#

Can you show the inspector of droidtrooper?

queen adder
#

on it

#

screenshots right=?

polar acorn
#

Yes

brittle girder
queen adder
#

those are all

polar acorn
#

Well, one thing that could cause this, is if you have multiple scripts named Compatiblecontrollingchar. The string version will look for things that match that name, regardless of what namespace they're in. The typed version will look for that implementation of Compatiblecontrollingchar, whichever class it references

queen adder
#

D: is there a way to search if i have multiple of those other than by hand?

brittle girder
#

@void thicket yea its not even switching the bool to true on click

#

i noticed when i turned it off and played again im not getting the debug

polar acorn
#

In the GetComponent with the type parameter, click on the Compatiblecontrollingchar and go to the definition (F12 if you're in Visual Studio. No idea the hotkey in VSC or Rider), and do the same for the one in the type declaration of DroidControls. See if they take you to the same file

queen adder
#

i think i found the little scoundrel

#

fingers crossed

#

i think it worked, ill try getting one of the component variables

#

i think the main mistake was trying to use the sample folder directly on the project

#

like the prefabs from it probably messed with things

#

😦 now i gotta redo 3 days of work

polar acorn
#

Well, while you're redoing it, you can refactor the code to use more precise typings as you go, which will make it much faster to get back to where you were

#

You can still drag in the whole object into a variable of a component type

#

It just means you don't need to GetComponent it

queen adder
#

@polar acorn i think i did try making it into a type but i had a similar problem to this and evaded it somehow by using a game objecrt

#

maybe cause its a cloudgaming game with webrtc and im using instancing that i can get away with things like that, i dont remember exactly what my reasoning was

void thicket
#

Try check the references again UnityChanThink

brittle girder
#

my first time i did that and it deleted everything i never do that again lol

warm raptor
#

Hello, I have two cameras in my project, one that I use for my character and another that I use to make a drone view in the sky. How do I get the second camera to have a custom frame rate, such as 10 fps?

rich adder
warm raptor
swift crag
#

but that would make things like menus feel gross

#

and it's not appropriate if it's a picture-in-picture situation

#

it would also mean that each Update loop covers a very long period of time

#

...this is a bad idea

rich adder
brittle girder
warm raptor
warm raptor
rich adder
warm raptor
# rich adder hehe its pretty simple I had a bit of free time while waiting for my 🍵 https:/...

I made this script that seams to be quit similar but it don't work at all

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

public class LowFpsCamera : MonoBehaviour
{
    public Camera targetCamera;
    public float frameRate = 1f;
    private float nextRenderTime = 0f;

    void LateUpdate()
    {
        if (Time.time >= nextRenderTime)
        {
            targetCamera.Render();
            nextRenderTime = Time.time + (1f / frameRate);
        }
    }
}

#

I think I've understand what's my problem

rich adder
cosmic dagger
warm raptor
rich adder
#

if you dont Render is being called every frame automagically

#

disable the camera component not the gameobject

#

just to be clear

#

the point of manually calling Render is you telling it when to render instead of being called how it is normally every frame

cosmic dagger
swift crag
#

note that being disabled doesn't mean the camera can no longer work

#

disabling a component actually does..basically nothing

#

it just means that it won't have a few messages send to it

#

That was an important thing I learned in my earlier years with Unity

rich adder
#

yup mainly disables the MB messages like Update etc

warm raptor
#

ok I think i've understand, so basically, I have to use a render texture on my drone camera. I also have to completly disable my character camera and to just disable my camera component on my drone camera ?

rich adder
#

but yeah you can just disable component too, but the drone camera should stay disabled even while being used

#

Render texture can be Fullscreened as UI(Raw Image component) or a texture on a quad. up to you

warm raptor
rich adder
rich adder
#

you can also put a camera infront of a quad with the texture, it does more or less the same effect

#

the benefit of UI is scales a bit easier with diff resolutions or you can easier overlay UI indicators

warm raptor
rich adder
warm raptor
#

I love the fact that I wanted to have a bad resolution camera and I'm not sure why, but it's actually really bad

warm raptor
rich adder
#

default value is 256 by 256 thats pretty low rez

warm raptor
rich adder
#

well that explains the low quality lol

warm raptor
rich adder
#

did you make resolution bigger?

warm raptor
rich adder
#

use the resolution of your game

warm raptor
rich adder
#

everything in development has a tradeoff

warm raptor
rich adder
#

if you dont want stretching you might consider using a quad

lethal bolt
rigid silo
#

I have no clue how to code but have decided to learn c# to make a game, this will go well

rich adder
#

you're literally telling the object to go to hit.point every time something is hit with ray

#

think carefully whats happening

wintry quarry
rich adder
#

oh spoiler alert

lethal bolt
#

oh damn

#

Removed the collider🦤 🫡

#

Nvm, i made it so it only cares about the ground, so i can have an collider on the player and other objects

rich adder
#

You can use layers btw

#

idk if you used that before

#

once the cube is picked up you can switch collider to layer the raycast no longer want to pickup

#

disabling collider works too (but might cause other unwanted issues)

main dock
#

hello guys, i am having a problem making my game, can anyone help me, send me a mesage if so

eternal falconBOT
twin bolt
#

Would this be a proper method of checking to see if an objects rotation is withing -2 and +2 of a float? ``` if ((transform.rotation.y <= ClosedROT + 2) && (transform.rotation.y >= ClosedROT - 2)
{

    }```
polar acorn
wintry quarry
#

What you should do is use Vector3.Angle and compare the object's forward direction with the direction you want to compare it to.

twin bolt
# wintry quarry no

Like this: ``` Quaternion closedRotation = Quaternion.Euler(0, ClosedROT, 0);

    float angleDifference = Quaternion.Angle(transform.rotation, closedRotation);``` ?
wintry quarry
twin bolt
wintry quarry
#

that's not exactly what I described above, but that's definitely a decent way to do it

proud escarp
#

Helllo guys, I'm following a Youtube video, and they create a new material and make it green

#

When I do literally the same, choose green as Base Map but it appears purple.. Why that? I didn't have the Shader Universal Render Pipeline / Lift from the options, so I installed it, but still remain Purple

polar acorn
proud escarp
#

If I choose HDRP / Lit (which I think I did HDRP at that point), now appears yellow

#

I mean better then purple but still don't understand that 🤣

slender nymph
#

that means you have HDRP installed in your project, not URP

rich adder
#

project settings => graphics

wintry quarry
#

If you are a Unity beginner I highly recommend using URP not HDRP

wintry quarry
#

yes that's HDRP

polar acorn
#

Also I don't use HDRP but it's possible they have a different color space than built-in and URP use, so the "Green" channel might not map directly to the texture

proud escarp
#

It's not the first time I'm having issues there, considering that I'm learning I think I'm just gonna start again with URP

twin bolt
proud escarp
#

Do I have to start again the project from scratch or can I 'convert' this one to URP?

#

I mean not that there is that much I have done, but if there's a fast way to convert i'd just do that

twin bolt
proud escarp
#

Thanks! I'll try to convert that to URP then

ornate patio
#

bit of a random question but whats the best way to store data/lists etc to call into scripts? for example I want to store a list of names and randomly generate them with a script

naive pawn
#

probably just a static array kept in the relevant script

wintry quarry
#

Theny ou could edit it in the inspector and/or have different such lists for different purposes.

ornate patio
#

Thank you, will take a look at ScriptableObjects

sterile radish
#

hi, im making an incremental game with upgrades in it. here is my shopitem script that is attatched to every shop item that you can buy. is there any way to make this script more efficient? a lot of the code in the last 3 methods is very similar and idk if its a good idea to have this script on every shop item. i had tried using an interface system to base different upgrades off of but im not quite sure thats what i want/need for my game so i tried this approach instead
https://hastebin.skyra.pw/gasokuhiba.pgsql

wintry quarry
#

This seems to be a code organization question

#

It seems like you have put the functionality of all different items onto this one script?

sterile radish
#

yes sorry the performance of the game is fine as it is but the way my code is structured right now is a bit clunky

wintry quarry
#

One option is to use polymorphism

#

e.g. make an abstract Upgrade method on this base class and then have different child classes which implement it differently

inland cobalt
#
        Quaternion roll = Quaternion.AngleAxis(-rollDirection * multiplier, Vector3.forward);      
        transform.localRotation *= roll;

what's the best way to go about smoothing out this roll, so it isn't an instantaneous start stop, but rather a quick acceleration/deceleration to and from the target speed?

sterile radish
#

okay, i'll try that, thank you

wintry quarry
#

or use a Tween library

inland cobalt
inland cobalt
# rich adder https://unity.huh.how/lerp/coroutines but replace it with Slerp

Im doing my movement right now by doing this though:

        Quaternion yaw = Quaternion.AngleAxis(mouseDelta.x * multiplier, Vector3.up);
        Quaternion pitch = Quaternion.AngleAxis(-mouseDelta.y * multiplier, Vector3.right);    
        Quaternion roll = Quaternion.AngleAxis(-rollDirection * multiplier, Vector3.forward);      

        transform.localRotation *= yaw * pitch * roll;```

im not sure how id implement the slerp into that
rich adder
sterile radish
sterile radish
#

no it isn't on a gameobject and Upgrade is of type Upgrade which is a class that ClickAdder derives from

polar acorn
sterile radish
#

yes

rich adder
#

it needs to be on a gameobject then

polar acorn
rich adder
#

what youre trying to drag in is a TextAsset , that wont work for your type

#

put Uprade on a gameobject, then drag gameobject in the slot

#

components are created when they are on a gameobject, right now its just a text file

polar acorn
rich adder
#

ah yes my mistake

sterile radish
#

ohh okay i see now thank you

rotund falcon
#

Even when I set the Rigidbody velocity to zero on my code, the character slides very shortly. Why?

maiden totem
#
        playerCamera.Rotate(Vector3.right * -lookVector.y);
        Vector3 camRotation = playerCamera.eulerAngles;
        camRotation.x = Mathf.Clamp(camRotation.x, -85, 85);
        playerCamera.rotation = Quaternion.Euler(camRotation);

why does this cause the transform to rotate very strangely? im not sure how to describe it, but i cannot look upwards and i can somehow look upside down behind me, but not always?

stone spindle
#

just started getting into unity and needed some help with my player input. my left and right movement are good, but the w and s key move my player vertically (instead of forward and backward). feel like this is an easy fix but not sure how to do it. anyone know how to fix this?

earnest ginkgo
#

so im trying to make it where when i select one gameobject the others are disabled but idk if this is nearly close

#

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

public class ColourRed : MonoBehaviour
{

public void WhenButtonRedClicked()
public void GameObject RedTex;
public void GameObject OrangeTex;
public void GameObject YellowTex;
public void GameObject GreenTex;
public void GameObject LBlueTex;
public void GameObject DBlueTex;
public void GameObject PurpleTex;
public void GameObject PinkTex;
{

    if (RedTex.activeInHierachy == true)
        DBlue.SetActive(false);
        PinkTex.SetActive(false);
        PurpleTex.SetActive(false);
        LBlueTex.SetActive(false);
        GreenTex.SetActive(false);
        OrangeTex.SetActive(false);
        YellowTex.SetActive(false);


}

}

rich ice
#

!code

eternal falconBOT
maiden totem
wintry quarry
earnest ginkgo
maiden relic
#

The code is inside a weapon recoil script attached to pivot point, and when not enabled the gun position is fine but when enabled is not and I copied all values from the other gun that works

maiden totem
maiden relic
stone spindle
#

i switched it to z but that didnt work :/

maiden totem
stone spindle
#

yeah

#

gives me an error

maiden totem
#

or only one?

polar acorn
#

input.y should control moveDirection.z

stone spindle
#

beautiful

#

thanks so much

maiden totem
#

one of them is a Vector2 and another is Vector3

stone spindle
#

ok dope. appreciate the help. probably would have taken me an hour to figure that out

earnest ginkgo
#

anyone see where my mistakes are?

#

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

public class ColourRed : MonoBehaviour
{
public gameObject RedTex;
{
public void Trigger()
if (RedTex.activeInHierachy == false){
{
RedTex.SetActive(true);
}
else
{
RedTex.SetActive(false);
}
}
}

maiden totem
#
        playerCamera.Rotate(Vector3.right * -lookVector.y);
        Vector3 camRotation = playerCamera.eulerAngles;
        camRotation.x = Mathf.Clamp(camRotation.x, -85, 85);
        playerCamera.rotation = Quaternion.Euler(camRotation);

dont entirely understand what im doing wrong here
for some reason when the x rotation goes to 85, it snaps back to 0 instead of -85 (among other confusing issues)? i assume this could be because there is no -85 rotation and it's 275 instead? then how would i properly clamp it?

polar acorn
eternal falconBOT
earnest ginkgo
maiden totem
polar acorn
#

Wait, I think my math is a bit off there I think there should be a modlus somewhere

polar acorn
earnest ginkgo
#

yea i dont rlly get it

maiden totem
#

a modulus would make sense, but im not sure how to do it

polar acorn
#

Might want to make a helper function for that

maiden totem
polar acorn
#

it's just that the value you set it to and the value you get when you read it won't always be the same

#
transform.eulerAngles = new Vector3(0, 400, 0);
Debug.Log(transform.eulerAngles);

Will most likely log 0, 40, 0

maiden totem
#

somehow this is just the opposite of what happened - i cant look down and i can look up behind me
and also for some reason the y and z of the euler angles are also somehow changing? am i using something wrong

#

the camera is a child of the player rigidbody (and that rigidbody has x and z rotation frozen)

polar acorn
#

this is why rotations are stored as a Quaternion internally, by the way. One orientation = one Quaternion. No ambiguity there.

#

The only real solution is to either always write or always read from euler angles, never both. You can try to keep track of your angle internally and use that instead of getting playerCamera.eulerAngles

maiden totem
#

i just dont understand why stackoverflow has solutions that just dont work for me

#

this is also happening in fixedupdate but im not sure if that'd change anything

polar acorn
#

This person just happens to be oriented in a way that it always decides to use the right way to express the angle

maiden totem
maiden totem
polar acorn
final kestrel
#

Can you explain why you said that about clamping angles? I have a problem with my setup. My character rotates weirdly when I clamp my target rotation to my upper and lower look limit. Then when I dont clamp. It works fine.

polar acorn
rich adder
#

never clamp your eulers directly

final kestrel
#

Ah all right. Thanks.

final kestrel
queen adder
#

@polar acorn got the thing working, is it ok to post gameplay videos here?

#

tysm

polar acorn
polar acorn
#

Show the inspector of MushroomSpawnScript

rich adder
#

MushroomSpawner not Mushoom

#

the gameobject its on

polar acorn
#

This is the script file

#

show me the inspector of the one that actually exists

rich adder
quasi notch
#

Hello, I'm a beginner and I just installed unity 6 and then I created a new project but after the project was created I received errors like:
error CS0246: The type or namespace name 'DebugUIHandlerIndirectFloatField' could not be found
I put the whole error message in the attached file.

rich adder
#

that IS technically the inspector for the script not the component UnityChanLOL

#

no. Select the Mushroom Spawner object and show the inspector

polar acorn
#

If you don't have any objects with the script on it then it's not running

#

Okay, so the timer is properly set. If you're getting more than one mushroom in start you probably have more than one MushroomSpawnScript in the scene

#

Components are on objects. Objects are in scenes.

#

MushroomSpawnScript is the name of a component

#

If multiple mushrooms are spawning at start, then you probably have multiple ones in the scene

rich adder
#

you type t:MushroomSpawnScript in the hierarchy exactly like that

#

it will show al the objects with that script

polar acorn
#

Okay, so there's just the one. Maybe it is actually spawning them properly it just takes more than 6 seconds to load?

rich adder
polar acorn
#

You're spawning them every 3 seconds

#

if your game takes 6 seconds to load from when you hit play, two more spawns occur

earnest wind
#

im trying to make my own text system

#

what would be the best aproach?

rich adder
polar acorn
#

Maybe try adding in a debug log where you call it in the timer and see if that's happening?

polar acorn
earnest wind
earnest wind
rich adder
polar acorn
#

TextMeshPro

earnest wind
rich adder
#

so put mesh collider

polar acorn
earnest wind
#

and have it extrude?

polar acorn
#

Log something different, so you can tell them apart

#

Okay good just making sure to mention it

rich adder
#

but you can probably use the vert points and extrude it further

#

I'm surprised there isn't a Probuilder 3D text type thing

earnest wind
#

also texturing would be possible?

#

like it would just be a normal mesh

rich adder
earnest wind
rich adder
#

it will still be flat though

earnest wind
rich adder
#

oh right those wold be as individual letters yes

#

make a dictionary so you can just do a lookup table for each letter for storing their vert

earnest wind
rich adder
earnest wind
#

maybe i could store each letter in a blender prefab?

#

it would be kinda a lot of work writing them all right now 😭

rich adder
# earnest wind

you can but they will be fixed no? unless you then grab that and manipulate it

earnest wind
#

it would work i think

#

i will try

#

see you, and thanks

rocky canyon
earnest wind
#

and complexity

rich adder
#

but yeah you're limited to the font you rendered with

polar acorn
#

So, while the game is running, repeat that search for mushroom spawn scripts

#

Where did you put those logs? Can you share the updated script with the logs in place so I can see where they're being called?

#

Put Initial Mushroom Spawned in start, and put something like Timer Mushroom Spawned where that one currently is

#

Or just post it here, I might be off in Factorio land

lament harness
#

I have a problem where my bullets destroy themselves when not even hitting anything
This happens only when i walk in the same direction as the bullet and shoot

slender nymph
#

sounds like they are hitting your player or each other

lament harness
slender nymph
#

yeah you should print what it hits

rich adder
lament harness
lament harness
#

yea nvm its hitting

#

itself

#

ty

slender nymph
lament harness
#

ok

#

will read

acoustic belfry
#

hey, i tried to make a gizmo for my meele attack but it doesnt show up...why?

#
    {
        Collider2D hitEnemy = Physics2D.OverlapCircle(transform.position, attackRange, demons);

        if (hitEnemy != null)
        {
            if (hitEnemy.TryGetComponent(out EnemyBase enemy))
            {
                enemy.TakeDamage(meleeDamage);
            }
        }
    }

    void OnDrawGizmos()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(transform.position, attackRange);
    }
}```
slender nymph
#

do you have gizmos enabled

rich ice
#

also double check that attackRange isn't 0

acoustic belfry
#

holy wow, thanks

glad gust
#

hello

acoustic belfry
brisk grove
#

Hi, you can set timer in unity in Update() method, repeating one in Start(), the best way to learn is researching the answer, you can get help from chat AI and ...

misty moon
#

!ide

eternal falconBOT
misty moon
#

!code

eternal falconBOT
brave minnow
#

hello anyone have teenpattie game ?

brisk grove
#

Easiest and cleanest way to do it is : creating a SpwanManager or GameManager that controls spawning object, the score and ... . This experience will help you clean your code more than as it was.

last owl
#

Is it possible to rotate a skybox vertically? Does anyone know how?

timber tide
#

I've done that but I can't recall my methods. Probably just copying one of unity's skybox shaders and adding onto it

#

reading some other methods and people just make a skybox camera and rotate that instead, and by not rendering the skybox in the primary camera

#

Lastly, you can make an inward sphere and render onto that with a panorama

last owl
timber tide
#

Clear flag should be there?

#

Oh maybe you need to stack them

blazing ice
#

is there something i'm doing wrong here? i have the exact same code as in the tutorial but this script does not appear in "dontdestroyonload"
was i supposed to place this script anywhere??

slender nymph
#

presumably one of the previous steps told you to put the component on a GameObject in the scene

blazing ice
#

ah yeah that's probably the case

slender nymph
#

yeah, it's step 3 of section 4. you should make sure you actually follow all of the instructions when going through a course

blazing ice
#

very true, i have a habit of skimming over the tutorials, especially since they are no longer in video form from now on

rapid laurel
#

hii, anyone could help me?, changed the spawnPoint of a bullet from a 2d object to a 3d and now it doesnt appears in game, it creates the object but i dont see the image

#

it only shows when i activate the prefab O.o

#

dw i found a solution thx ❤️

cursive ruin
#

guys why does the oxygen decrementor has no serialize field and the healing item has a serialize field

grand snow
#

save the file...

cursive ruin
#

ohh

#

tyyy\

#

sorry noob question haha

grand snow
# cursive ruin

If the variable doesn't need to be public (accessible by other classes) you should instead do:

[SerializeField]
float blah;
brittle pivot
#

where do I begin(I'm completely new to coding)

rapid laurel
#

does anyone how do i make my character not turning when shooting?? Its a 2d Sprite i just want him to face the camera

brittle pivot
#

I'm tryna move away from scratch

#

how should I start

dusty geode
dusty geode
rapid laurel
#

i made him shoot to mouse position and it turns when i shoot in x directions

rapid laurel
dusty geode
#

!code

eternal falconBOT
dusty geode
# rapid laurel

If this is 2D, you should probably be using a RigidBody2D instead

#

Also is the collider on the bullet controller set to be a trigger?

toxic tiger
#
public abstract class Upgrade : MonoBehaviour
{
    new public string name;
    public string description;
    public int cost;
    public abstract void Apply();
}

public class UpgradesGeneral : MonoBehaviour
{
    [HideInInspector] public int tokensWater;

    public List<Upgrade> upgradeList;

    void Start()
    {
        //Add to list
        upgradeList = new List<Upgrade>(GetComponents<Upgrade>());
    }
}

public class UpgradeFireRate : Upgrade
{
    new public string name = "Fire Rate";
    public string description = "Decreases fire rate by 25 percent";
    public int cost = 20;
    public override void Apply()
    {
        PlayerShooting.playerShootCooldown *= 0.75f;
    }
}

public class UpgradeDamage : Upgrade
{
    new public string name = "Damage";
    public string description = "Increases damage by 1";
    public int cost = 30;
    public override void Apply()
    {
        PlayerShooting.playerDamage += 1;
    }
}
#

I have no idea what I'm doing, is this the right way to do an upgrade system?

dusty geode
#

@rapid laurel Bullet colliders are usually set to triggers so they do not actually apply forces when hit

rapid laurel
#

thats it yeah...

#

and me trying to code lines for nothing to make him not turn

#

thanks so much men

dusty geode
rapid laurel
#

instead of collision

#

thanks men

dense tartan
#

Hi, i'm currently trying to flip a sprite based on it's angle relative to the character(left or right). Basically i just want to check if the transform.foward is facing the left side or the right side of my screen. I've tried using eulerangles, transform.forward and dot product but my methods of implementing it just suck. Any help?

tulip stag
#

If you saw the last message, no you didn't. Overnight coding had me asking the silliest things 😔

fervent abyss
#

super random jump in conversation but same

#

why doesnt this server have just 1 offtopic channel 😔

tulip stag
#

I sent a screenshot saying oh my godddddd why isn't my public variable showing up in the inspector

#

It was.

#

I just didnt see it but it was right on my face

fervent abyss
#

LMFAO

dusty geode
dense tartan
# dusty geode `if (transform.forward == Vector3.left)`

it does not register and i don't get the logs either, any idea whats wrong with my code

void Update()
 {
     transform.position = _player.transform.position;
     transform.right = _cursor.transform.position - transform.position;
     if (transform.forward == Vector3.left)
     {
         Debug.Log("flip left");
         flip = true;
     }

     if (transform.forward == Vector3.right)
     {
         Debug.Log("flip right");
         flip = false;
     }
     Flip();
 }

 private void Flip()
 {
     if (flip == false)
     {
         transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z);
     }
     else if (flip == true)
     {
         transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
     }
 }

dusty geode
#

In 2D, I don't think you should be using transform.forward

#

I think you should be using transform.right

dense tartan
#

yes i've tried replacing it with that

#

it doesnt work either

#

transform.right does work when i use it to rotate the weapon though

dusty geode
#

Give me a few minutes and I can experiment

dense tartan
#

tysm

dusty geode
#

I mainly work in 3D so I don't want to give you the wrong answer

fervent abyss
#

how can i make so an object doesnt overlap with others? so like it renders first
i have an interface that player can see through camera, and obviously it overlaps with other objects when too close

cosmic dagger
rapid laurel
#

Guys I have another problem with my game, I made it shoot where I have my cursor, but the bullet doesn't go exactly there, but close.
Can it be a camera thing?

dusty geode
# dense tartan it does not register and i don't get the logs either, any idea whats wrong with...

This should be what you want, I'm not sure what you were trying to do with the cursor position. You might need to flip the directions depending on how your character is oriented in the sprite. Let me know if you have any questions.

void Update()
{
    Vector2 playerPos = _player.transform.position;
    Vector2 myPos = transform.position;

    // set the y component to match the players so
    // calculations are done at the same height
    myPos.y = playerPos.y;

    Vector2 horizontalDirToPlayer = playerPos - myPos;

    // normalize so length is 1
    dirToPlayer.Normalize();

    Flip(horizontalDirToPlayer);
}

private void Flip(Vector2 flipDir)
{        
    Vector3 tempScale = transform.localScale;

    // assume positive
    tempScale.x = Mathf.Abs(tempScale.x);

    if (flipDir == Vector2.right)
    {
        tempScale.x = -tempScale.x;
    }

    transform.localScale = tempScale;
}
soft creek
#

Hello, how i can do for wait 1 second between the actions of my code, thanks

dusty geode
soft creek
#

ok, i will search information about that

dusty geode
soft creek
#

I want it to destroy an item when pass x seconds

dense tartan
west radish
#

what a wonderful username

#

(not sarcasm)

dense tartan
dense tartan
dusty geode
#

Lol I didn't know Destroy has a time overload

#

just use that

rapid laurel
soft creek
dusty geode
soft creek
#

and now how i can recover this item some seconds later?

dusty geode
soft creek
#

but if i destroy a prefab of this item i can instantiate another, no?

dusty geode
soft creek
dense tartan
dusty geode
soft creek
#

ok

dusty geode
#

I guess activate and deactivate are the more appropriate terms when referring to game objects

rapid laurel
rapid laurel
cosmic dagger
dusty geode
soft creek
#

And how i can do this? I'm new and I know practically nothing

rapid laurel
#

my character is a 2D sprite, but i wanted to move in all directions

#

and shoot in all directions too

dusty geode
soft creek
dusty geode
#

you technically could do it in update with bool flags and timers, but it could get ugly

dusty geode
dusty geode
# soft creek I sould copy this, but changing things, no?

Something like this could work.

private async void DisableAndReEnableWall(GameObject wallObject, float deactivateDelay, float reactivateDelay)
{
    await Awaitable.WaitForSecondsAsync(deactivateDelay);

    wallObject.SetActive(false);

    await Awaitable.WaitForSecondsAsync(reactivateDelay);

    wallObject.SetActive(true);
}
dusty geode
dusty geode
soft creek
#

2022.3.27f1

dusty geode
# soft creek 2022.3.27f1

Awaitables were introduced in Unity 2023, so if you are stuck on 2022 then you'll have to use Coroutines

soft creek
#

oh

#

i can prove of changing my version

#

Unity 6(6000.0.36f1) is a good version?

dusty geode
#

you can also use a 3rd party library UniTask which are better than Awaitable and behave very similar

#

yes

red igloo
#

Hey so I want to learn more about C# mostly for 3D game development I know how to use unity editor itself but coding wise I have no clue. I want to learn about the basics of player movement, input, physics etc. The videos I find either don't really explain it well. Any advice on how I can build up my C# knowledge?

dusty geode
cosmic dagger
eternal falconBOT
#

:teacher: Unity Learn ↗

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

dusty geode
ivory bobcat
#

You can get non Unity cs help in the !csds

eternal falconBOT
cosmic dagger
dusty geode
red igloo
#

Thank you I will be checking them out !!!!

gritty glade
#

Hello, I am following a tutorial for unity, and am stuck on a part. Basically what I am making is a flappy bird type of game and I basically used the same line of script as the tutor, but it doesn't work the same for me.

transform.position = transform.position + (Vector3.left * MoveSpeed) * Time.deltaTime;

This is supposed to be the line of script for the pipes moving past the bird. I looked up what ''Time.deltaTime'' does, since that was supposed to fix the exact problem i am facing currently. Can anyone help me? Oh and the problem basically is that the pipe moves to the left way too quick. Apperantly the extra "Time.deltaTime" was supposed to fix it.

cosmic dagger
gritty glade
#

Okay wait its this small of a number and the pipes aren't even visible are the pipes just gone?

#

could it it be that the pipes fall out of the scene even before the whole scene plays?

verbal dome
gritty glade
#

they moved slightly

#

maybe the pipes are behindthe blue screen

#

yup it

#

is

#

how can i move where the blue screen is?

#

cuz it is im front of the pipes

#

nvm

#

i fixed it

cosmic dagger
gritty glade
#

finally figured it out so yea

alpine nexus
verbal dome
#

What defines "cheap"? Do you need dozens/hundreds of those running at once?

#

The easiest way to fake a softbody is to put physics joints and colliders in the bones of the skinned mesh

#

PhysX has no soft body physics built in tho

alpine nexus
#

thinking of supporting as many mobile devices as i can

acoustic belfry
#

Hi, well, i have a problem, the meele collision have to be in fron of the player...But is on its middle...what i have to do for make it work on the right, or left if the character is facing left?

{
    Collider2D hitEnemy = Physics2D.OverlapCircle(transform.position, attackRange, demons);
    if (hitEnemy != null)
    {
        if (hitEnemy.TryGetComponent(out EnemyBase enemy))
        {
            enemy.TakeDamage(meleeDamage);
        }
    }
verbal dome
#

You can make an empty transform and use its position instead

#

If you use localScale.x to flip the character, this transform will flip with it

#

As long as it's a child

acoustic belfry
#

oh, thanks :3

acoustic belfry
#
    {
        Collider2D hitEnemy = Physics2D.OverlapCircle(machetepos.transform.position, attackRange, demons);

        if (hitEnemy != null)
        {
            if (hitEnemy.TryGetComponent(out EnemyBase enemy))
            {
                enemy.TakeDamage(meleeDamage);
            }
        }```
verbal dome
#

I don't know where machetepos is but that's where it overlaps

sterile radish
wintry quarry
acoustic belfry
verbal dome
acoustic belfry
#

it should be in the front of the player

verbal dome
#

How do you draw it

acoustic belfry
#

wat

#

like this

#
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(transform.position, attackRange);
    }
}```
#

wait

verbal dome
#

And what is transform

acoustic belfry
#

oh, you mean it should say

    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(machetepos.transform.position, attackRange);
    }
}```
acoustic belfry
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#

now it works

#

thanks

rich adder
fervent abyss
#

i want the text to be above all the object

rich adder
#

which objects? they're all objects

#

texts are objects too

#

is this a screen space canvas? it should already be drawn above everything else by default

fervent abyss
#

do i set that up?

rich adder
rich adder
proper yacht
#

How to set Panel not visible by default?

#

For Settings

#

as example

swift crag
#

the "Panel" object is just a game object with an Image component on it

#

You can disable the Image component or deactivate the entire game object

#

The latter will cause all of its children to be deactivated

proper yacht
#

But I can't find out how to deactivate it by default

#

in spectator

swift crag
#

you can deactivate game objects in the inspector

rich adder
swift crag
#

e.g. it's the checkbox here

proper yacht
#

Thanks a lot

swift crag
#

You have to capitalize it correctly.

#

Your code editor should be showing you an error right now. If it's not doing that and not providing any completions, see !ide

eternal falconBOT
wintry quarry
#

your VSCode is not configured properly

snow warren
#

Hi

pure drift
#

!code

eternal falconBOT
pure drift
#

does anybody know why my turrets arent spawning properly in my game when i stop playing it and i try to replay it'

rich adder
#

whats happening vs what do you expect to happen

pure drift
#

it shows up as invisble like the first 3 show up properly but then the rest are invisble

buoyant shoal
#

Yo can someone help with the scene manager i'm starting to tweak

verbal dome
#

FYI this does nothing cs turretinst.transform.Rotate(0f, 0f, 0f);
Rotate adds to the rotation, it doesn't set it

wintry quarry
#

Are they showing in the inspector?

rich adder
pure drift
#

it shows up in the scene and inspector

wintry quarry
#

or it's behind another object

#

sopmething along those lines

naive pawn
#

or mightve been culled

wintry quarry
#

Note that even 2D games use the Z axis

#

very well could be behind your camera

buoyant shoal
pure drift
rich adder
wintry quarry
# pure drift it shows up in the scene and inspector

You're also rotating them 90 degrees on the Y axis. Isn't this a 2D game?

            GameObject turretinst = GameObject.Instantiate(turretPrefab, spawnArea.position, Quaternion.identity);
            turretinst.transform.Rotate(0f, 90f, 0f);```
You're probably "paper mario"ing them
buoyant shoal
rich adder
buoyant shoal
#

The log or my code?

rich adder
pure drift
wintry quarry
#
  • Make sure you save your code
  • Make sure you don't have any compile errors in your console.
rich adder
#

you probably have compile errors?

#

jeezus

#

!code

eternal falconBOT
rich adder
#

not only a photo but a side angle

buoyant shoal
rich adder
#

what about Unity ?

wintry quarry
#

Like i said, check your Unity console

#

your code editor is probably not set up properly

#

Show screenshots

#

of the full unity window, with console, with the script selected too

rich adder
wintry quarry
#

console window is not being shown here

crystal fulcrum
#

win shift s >

wintry quarry
rich adder
#

ah they're hidden

wintry quarry
#

You have two compile errors

#

make sure you press that button so you can actually see your errors

#

you have them hidden

heavy fulcrum
#

you will have a script that allows you to move with an azerty keyboard ??

wintry quarry
#

Should probably get around to fixing them 😉

rich adder
wintry quarry
#

Well we can't help you if you don't share with the class

pure drift
#

i have like 15 in here, but only some spawn for some reason

buoyant shoal
#

@rich adder ```cs
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneSwitcher : MonoBehaviour
{
public void LoadMainScreen()
{
SceneManager.LoadScene("Mainscreen");
}
public void LoadCameraScreen()
{
SceneManager.LoadScene("CameraScreen");
}

public void LoadSettingsScreen()
{
SceneManager.LoadScene("SettingsScreen");
}
}

#

Like this?

rich adder
wintry quarry
#

and again if they're not visible, it's because they're not in view of your camera, or they're rotated weirdly

rich adder
heavy fulcrum
wintry quarry
#

Very simple you're trying to use some class called PlayerCam which doesn't exist in your project.

naive pawn
#

so where have you defined PlayerCam?

wintry quarry
#

Either create such a class or get rid of those parts where you're using it

rich adder
pure drift
#

i think it might be because of rotation any suggestions on how to fix that bit

wintry quarry
heavy fulcrum
wintry quarry
#

You have a GameObject named PlayerCam. Your code is talking about a class named PlayerCam, which you don't have

naive pawn
#

classes are anything that are declared like class X

pure drift
#

ill try that thank you

wintry quarry
#

A class is anything you define with the class keyword. e.g. public class MyClass {}

buoyant shoal
rich adder
wintry quarry
#

You're kinda just guessing it sounds like.

If you're following a tutorial, you should just follow the tutorial exactly

#

The point of a tutorial is to learn the concepts they are teaching

rich adder
buoyant shoal
#

@rich adder

#

Srry it took a while

#

The blue is the camera background btw

sterile radish
rich adder
buoyant shoal
#

I already scaled the canvas to screen size

rich adder
swift crag
#

using >= instead of > makes the condition true one row earlier

#

as does subtracting 1 from height

buoyant shoal
sterile radish
rich adder
buoyant shoal
#

I find it odd because it works with my main menu but not the other scene's

#

Omg i'm so dumb

#

I set my camera sceen to display 2

naive pawn
sterile radish
#

sorry, what is a parity?

gritty glade
#

question, how do i find this script from another? I tried:

public GameObject birdScript;

birdscript = GameObject.FindGameObjectWithTag("Bird").GetComponent<BirdScript>();

Please help.

#

OMG

#

WAIT

#

nvm

#

still need help

#

i put the tag on bird now but it still doesnt work the way i need it to

#

error:

short hazel
#

You misspelled your variable name

#

Compare the names between the two lines

gritty glade
#

oh

short hazel
#

Your variable is of the wrong type. It's a GameObject but GetComponent gives you a BirdScript here

#

If your code editor is not highlighting these errors for you, or that it's not showing suggestions as you type, you need to configure it before doing anything else

#

!ide

eternal falconBOT
gritty glade
#

do u also know how i can get those suggestions

short hazel
#

Read bot message above

gritty glade
#

cuz i basically dont get no info from vs

#

okay

#

i have vs

#

though

short hazel
#

Right-click where it says "unloaded" on the right, and select "Reload with dependencies"

#

If it does not work, follow the guide and skip the steps you've already done

short hazel
#

Solution Explorer on the right of this very screenshot

#

On the Assembly-CSharp project

gritty glade
#

so this correct?

short hazel
#

What did you click?

gritty glade
#

reload project with dependencies

short hazel
#

Okay so you don't have the Unity workoad installed

#

Scroll up and follow the install guide for the "Visual Studio - Installed manually"
Your VS install is not complete enough to open Unity projects

sand swift
#

HEY i am in really big trouble and i cant understand

#

my character cant move when its paralel with world z axis

#

forget i saw.... v2 insted of v3...

#

sry

gritty glade
slate elm
#

Okay so how do I start 😭 I started with the Microsoft Learn tutorial which had me re-learning the most BASIC of concepts but they use completely different syntax in C# (This is coming from someone who uses Python but not at a high level) and then eventually it just got long and confusing so I stepped back

gritty glade
short hazel
#

Yes

#

Just like you did a few minutes ago

gritty glade
#

alright well i did

#

wow it shows red highlights

#

never thought how much i missed them

ruby drift
#

guys i need help, every time i open anything it says "failed to resolve project template: failed to descompress"

short hazel
ruby drift
#

okay

#

but i already did

gritty glade
#

so is the "Bird" part incorrect?

short hazel
short hazel
gritty glade
#

yes just found out

#

so i cant use Getcomponent

short hazel
#

You can, by changing the type of the variable

gritty glade
#

so how i find BirdScript

#

alright well i think i fixed it

short hazel
#

It will find a BirdScript just fine, C# just refuses right now because you're trying to put a square block (BirdScript) into a round hole (GameObject)

gritty glade
#

the flaw wasnt in the line we are talkign about

short hazel
#

Yes that is correct

gritty glade
#

basically i had
public GameObject birdScript;
for some odd reason

wintry quarry
silver forge
#

ohh ty

solemn grotto
#

anyone know how to fix

#

error CS0006: Metadata file 'Library/PackageCache/com.unity.collab-proxy@2.6.0/Lib/Editor/PlasticSCM/log4netPlastic.dll' could not be found
error CS0006: Metadata file 'Library/PackageCache/com.unity.collab-proxy@2.6.0/Lib/Editor/PlasticSCM/Unity.Plastic.Antlr3.Runtime.dll' could not be found
error CS0006: Metadata file 'Library/PackageCache/com.unity.collab-proxy@2.6.0/Lib/Editor/PlasticSCM/Unity.Plastic.Newtonsoft.Json.dll' could not be found

#

i been watching over hours of tutorials for the fix and theres nothing

grand snow
#

did you remove a package like unity collab?

solemn grotto
#

i am new to unity

grand snow
# solemn grotto what

try closing unity, going to your project folder, deleting the Library/PackageCache folder then re open unity.

burnt vapor
#

Can also just remove the library folder as a whole. Unity regenerates it.

grand snow
#

yea true but that will be slower for em to reimport everything

gritty glade
#

How do i refer to an audioclip within an audio source in unity

woeful carbon
#

does anyone here have a lot of experience with coding procedural generation

gritty glade
gritty glade
#

i copied what they were doing and well for me it errors

slender nymph
# gritty glade

there are beginner c# courses pinned in this channel, you should probably start there

slender nymph
#

read the example more carefully. if you think you wrote valid c# then you need to learn the basics

wintry quarry
gritty glade
slender nymph
#

then learn the basics

gritty glade
wintry quarry
#

not even close

gritty glade
slender nymph
gritty glade
slender nymph
#

you clearly did not learn the actual fundamentals of c# if you think what you wrote is valid in any way

gritty glade
slender nymph
#

and if you cannot recognize why it is invalid then you need to go learn the actual fundamentals of the language

slender nymph
#

then why did you write it if you did not think it was valid?

gritty glade
slender nymph
polar acorn
gritty glade
#

thats what im tryna say

polar acorn
#

The things you've changed are the things that are wrong

gritty glade
#

i wrote literally this line

wintry quarry
polar acorn
wintry quarry
#

it is different

gritty glade
#

wow i dont know how i didnt see that

#

that was a whoopsie mistake

fervent escarp
#

[unity 3D]
what can i do to make the player not slide off the edge of for example a cube
im currently using capsule collider for the player and i cant really use the cube collider because of no round edges and there is no collider that i can really use
the collider i would want would have a spherical top and flat bottom with rounded edges on the sides as in capsule collider but there is nothing like that unfortunately

dusty geode
dusty geode
#

Place the capsule collider like normal and place the box collider on the lower half

#

they can overlap each other

fervent escarp
dusty geode
#

Isn't that what you want?

fervent escarp
#

wait a sec
i need to make a very professional representation of it in paint

dusty geode
#

the other way is to create a mesh of the shape you want and use a mesh collider

bitter minnow
#

defenseSquares[i].button.onClick.AddListener(OnDefense);

So this works fine but how would I pass i to the OnDefense function without using anonymous functions (need to keep a reference to remove this listener at some point)

dusty geode
fervent escarp
bitter minnow
grand snow
#

have a new component that has its own event so it can pass i

#

public event Action<int> myCoolEvent;

#

I 99% of the time do this even for just button clicks as i dont think its good design to expose the button publicly

dusty geode
# bitter minnow Store it how?
Action onDefense = () =>
{
    // do something with i
};

defenseSquares[i].button.onClick.AddListener(onDefense);

// sometime later

defenseSquares[i].button.onClick.RemoveListener(onDefense);
grand snow
#

plz no 😆

bitter minnow
dusty geode
fervent escarp
grand snow
# bitter minnow `defenseSquares[i].button.onClick.AddListener(OnDefense);` So this works fine b...
public class DefenseSquare : MonoBehaviour
{
    public event Action<int> OnClick;

    public int index {get; set;}

    [SerializeField]
    Button button;

    private void Awake()
    {
        button.onClick.AddListener(() => OnClick?.Invoke(index));
    }
}

do the event yourself and store the index. Or the click event can pass itself as an arg via this so you dont even need the index to access it later:

public event Action<DefenseSquare> OnClick;
//elsewhere...
button.onClick.AddListener(() => OnClick?.Invoke(this));
fervent escarp
bitter minnow
# grand snow ```cs public class DefenseSquare : MonoBehaviour { public event Action<int> ...

I'm talking about providing the logic directly in the class for the OnClick when setting it up. If it's not convenient to do so the next best option might be to just have dedicated method for each attack and direction (attackLeft, attackCenter) etc. Was hoping I could make use of the direction enum (left, center, right) to iteratively set each one and then unset each one. It's all looking like "voodoo" however so the direct methods might be my best bet.

grand snow
fervent escarp
grand snow
dusty geode
fervent escarp
#

also is it possible to bind a key to minimalize the window?

#

for example use the KeyCode.LeftMeta

dusty geode
solemn grotto
#

anyone know how to fix my character falling through the map when i play

fervent escarp
solemn grotto
solemn grotto
#

i keep falling

fervent escarp
#

does the ground and player have collider?

dusty geode
solemn grotto
#

when i do that its not on the platform fully

#

but if i do it a little high or medium i just fall

dusty geode
#

Like wickend said, does the player and platform have a collider?

solemn grotto
#

where do find that?

#

i started today and it worked fine

#

but now it keeps making me fall

dusty geode
#

On the player and platform objects, there should be a collider component on both

solemn grotto
#

yeah

#

which button is it to enable

dusty geode
solemn grotto
#

you know how to fix that?

rich ice
#

y'know, considering the channel is called "code-beginner", it might be a good idea to send the !code

eternal falconBOT
heavy fulcrum
#

qui parle francais??

sterile radish
#

hi, im want to make a circle move along a grid in a pattern like the ones below. i have made it so that the the circle moves along the grid like the red arrow just fine. however, after it's done moving and reaches the top right corner, i'd like to make it retrace its steps and move along the grid similar to the blue arrow. how can i achieve this?
https://hastebin.skyra.pw/axigevikef.csharp

grand snow
frosty hound
#

Iterate through the tiles in reverse?

solemn grotto
#

anyone know how to fix my character falling through the map when i play

sterile radish
solemn grotto
patent verge
#

how can I make this climable ?

rich ice
patent verge
#

how so

rich ice
#

depends on how you're currently moving your character. are you using a rigidbody? character controller? transform.translate?

patent verge
#

player controller

grand snow
maiden totem
#

I'm unsure if this is more of a math question but, i have a directional vector and a point. How would I select a random point on a circle (plane), perpendicular to that directional vector?

rich ice
# patent verge player controller

just add a trigger to the ladder. in the code check if the player has entered a ladder trigger and then have them move up. there's a lot of ways of doing ladders and it compeltely depends on how you're movement works

frosty hound
void thicket
maiden totem
sterile radish
# frosty hound How did you achieve the path in the forward direction?

i linked my script in my original statement but basically i made the circle go right until it reached the right border of the grid. if it did, i made it go up by one tile then set the movement direction to left. it then goes all the way left until it reaches the left border, then it goes up by one and sets the movement direction to right and it repeats until it reaches the end

i add the moveDirection to it's starting position every turn and lerp its position to that for it to actually move

wintry quarry
frosty hound
#

So can you not just to the opposite? Move to the left until it hits the border, then go down one tile and reverse?

void thicket
maiden totem
sterile radish
frosty hound
#

Have a bool IsReversed that you use to determine if you should go up or down when you're at the border.

opal kernel
#

Hi. Im new to unity and should i learn all of c# or no?

void thicket
#

You'll need to learn C#

opal kernel
#

All of it?

rich ice
void thicket
#

All of C# just doesn't make sense

opal kernel
#

Can someone give a tutorial just so i know?

polar acorn
eternal falconBOT
#

:teacher: Unity Learn ↗

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

sick valve
#

sorry to interrupt, but im having an issue on one part of my hw-

I cant get the input part to show up- and im a bit stumped on how to make it appear

polar acorn
sick valve
void thicket
#

Show your Touch Raycaster code

sick valve
#

one sec

polar acorn
rich ice
sick valve
polar acorn
sick valve
#
using UnityEngine;

public class LevelInputTester : MonoBehaviour
{
    [SerializeField] private InputHandler _input;
    private void OnEnable()
    {
        _input.TouchStarted += OnTouchStarted;
        _input.TouchEnded += OnTouchEnded;
    }

    private void OnDisable()
    {
        _input.TouchStarted -= OnTouchStarted;
        _input.TouchEnded -= OnTouchEnded;
    }

    private void OnTouchStarted(Vector2 position)
    {
        Debug.Log("TouchRaycast: Started: " + position);
    }

    private void OnTouchEnded(Vector2 position)
    {
        Debug.Log("TouchRaycast: Ended: " + position);
    }
}
polar acorn
rich ice
sick valve
void thicket
polar acorn
sick valve
void thicket
#

Your class name

sick valve
#

... im an idiot- let me swap that rq

polar acorn
#

Unless it's Unity 6, in which case that's no longer necessary

sick valve
polar acorn
#

Still, you should match the class name to the file name

#

But also show your console

sick valve
sick valve
polar acorn
sick valve
#

dammit 6

#

im gonna go fight a number now

solemn grotto
#

anyonebody knows how to fix going through the map after spawning

wintry quarry
#

presumably you need to double check your physics setup

#

and make sure you're not spawning below the map

solemn grotto
#

i am not

#

i am on the map for like a second and then i just fall down to the abbys

#

it didnt happenn last time when i played

#

but now it does

wintry quarry
#

You need to share details

solemn grotto
#

can i show video?

wintry quarry
#

Sure but it would also be more valuable to share the details of how your physics are set up and your movement script