#💻┃code-beginner

1 messages · Page 307 of 1

obtuse osprey
#

works thanks, i got some questions
One, how many pixels should i make new sprites im using gimp if that matters
two, i want to start making a map should i still use gimp how big should i make it and how do i make it so the sprites dont go through buildings or be able to enter at the door

deft grail
deft grail
modern oxide
#

I'm trying to make a script that will control the Camera, so would I use transform for that? and for zooming, how would I do that, I just need some pointers. Thanks!

deft grail
spiral narwhal
#
Sample SO:
    public class AmmunitionWeaponAttribute : ScriptableObject, IWeaponAttribute

Interface:
    public interface IWeaponAttribute
    {
    }

SO Reference:
            [SerializeField] private IWeaponAttribute[] _attributes;

For this, I get Redundant 'SerializeField' attribute. This leads me to believe that I can't serialise an interface based SO like that. Does anyone know how I can do that?

slender nymph
modern oxide
#

ummmm....... ok

deft grail
modern oxide
#

um..... what should I use?

rich adder
modern oxide
#

but idk

deft grail
dense walrus
#

i want to upload png images to a panel UI thing in my game but it wont let me drag them into the panel pls help

deft grail
modern oxide
#

uh oh. thats alot of settings

dense walrus
rich adder
#

you probably don't want that

#

just use regular VirtualCamera

modern oxide
#

ok

deft grail
#

which you would drag your sprite to?

dense walrus
#

ok thanks

#

im completely new to this so thank you for your help

deft grail
#

or are you trying to change the actual panel itself?

modern oxide
dense walrus
#

nah im just trying to drag my image to the bg part of the panel

modern oxide
rich adder
#

set up is
GameObject1 : MainCamera | CinemachineBrain
GameObject2: VirtualCamera

dense walrus
#

it still wont let me drag the png

rich adder
deft grail
dense walrus
#

im trying to make a health bar so i made some art for it and put the art in my assest folder, now im trying to assemble the health bar itself and cant drag my frame image into the thing that says source image

rich adder
#

btw this is not code question

dense walrus
#

idk where to ask this

#

it said beginner so i went hey thats me

rich adder
#

it says Code beginner

dense walrus
#

can u just help

#

pls

rich adder
rich adder
dense walrus
#

idk how

rich adder
#

look at the Inspector when you click on the image

#

should probably do the essentials path on the Unity website

dense walrus
#

oh that worked

#

thanks!

queen adder
#

BEHOLD!

buoyant knot
#

why would you want this method

queen adder
#

being able to easily add components using string gives quite some flexibility

buoyant knot
#

…how

#

if you want to add a component, you already have the type itself

#

also, ClassTypeReferences is a thing

queen adder
#

one SO easy to get the components it needs

buoyant knot
#

oh wow

#

that is indeed as terrible as I envisioned

abstract monolith
#

this is gonna be dumb but how do i reopen the heirarchy

buoyant knot
#

go to top menu bar, look at the windows dropdown, i think

queen adder
#

or rightclick any tab

#

or ctrl+4

buoyant knot
#

my man, use ClassTypeReferences

abstract monolith
#

thanks

buoyant knot
#

it’s how you can serialize references to types

queen adder
#

hmm not familiar

buoyant knot
#

and not accidentally type “Protecor” and wonder why the hell nothing works

#

i am telling you the name of the extension

queen adder
#

i am looking at their api, dont think it will work in my unity

buoyant knot
#

it works in unity. it is made for unity

slender nymph
#

Probably doesn't support prehistoric versions of unity

buoyant knot
#

your unity is not a different unity than everyone else’s unity

polar acorn
buoyant knot
#

so I can guarantee there is a version of it that will work

#

the solid alloy fork uses specific dropdowns that are more likely unity-version specific. the older version just makes some dictionaries and shit, and that is it

wet basin
#

I'm playing this game, with basic unity text, the code below is what the image is.

Is there a way to Outline the text with a color?

<i><size=95px><b>R<size=590%>obinson <i><size=95px><b>G<size=590%>ap <size=95px>C<size=590%>oal

buoyant knot
#

because SOs can’t refer to anything in scene

#

and sometimes you just want to tie logic to different SO instances, but not bloat the SO itself with a bunch of crap

#

especially for classes that you want to access without instancing a whole prefab

modern oxide
#

how do I have the camera rotate around this empty game object while still looking at it. (I'm using Cinemachine virtual Cam)

rocky canyon
modern oxide
rocky canyon
#

u dont have the camera parented to the target do u?

modern oxide
#

No not yet I'm fixing a lot of it currently

rocky canyon
#

armed with the knowledge of freelook component u should be able to find a good amount of tutorials to check out

#

even if its just enough to get u started

#

and thanks btw, that songs stuck in my head

modern oxide
#

lmao

queen adder
#

can someone link me a good tutorial on how to use the animation window? i cant really find a good one

eternal falconBOT
#

:teacher: Unity Learn ↗

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

teal viper
#

I bet they cover it properly in one of the beginner pathways

queen adder
#

ill check it out

#

thanks

twin bolt
#

What's the best way for me to create a global sound effect script, that plays a sound when a 3d object is being moved?

#

How could i play a sound when a object is moving?

white void
#

Do you want to play it once?

twin bolt
#

I want it to constantly loop until the player stops moving the object.

white void
#

Alright, be right back

#

Have you used an AudioSource?

twin bolt
#

Yes

eternal needle
#

what is stopping you from doing this

white void
#

It's on your 3d object, right?

twin bolt
white void
#

Nevermind

eternal needle
# twin bolt Its only the code part, i'm not sure how i could code it.

Is this supposed to be with only 1 object, or whenever a player is moving any object? if any object, can these objects play different sounds?
Think about these things, then first thing you can know where this script should be.
Then consider what moving the object means, like a UI object, rigidbody, or manually affecting the position

twin bolt
eternal needle
#

Any object at all? not just rigidbody for example?

white void
#

Alright, I'd go to a folder used for scripts and right click -> Create -> C# Script

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

public AudioClip aud;
private AudioSource audioSource;

void Start()
{
    audioSource = GetComponent<AudioSource>();
    audioSource.clip = aud;
    audioSource.loop = true;
    audioSource.Play();
}

Then, I'd name that script whatever you want, and then add it to your 3d object

#

I think that should work, maybe

twin bolt
#

Just rigidbody

eternal needle
twin bolt
#

I need the audio to be synced with the movements of the 3d object.

eternal needle
#

Since its RB, you can just check the velocity and then do the above logic based on if the object has velocity

twin bolt
#

Ok, so check to see if the velocity is over 0?

safe salmon
#

Can someone push me in the right direction - im attempting to make a grid based inventory system. watched a few youtube vids and still confused, doesnt seem like im getting it right

eternal needle
eternal needle
static cedar
#

What .NET version does Unity 2022 use? UnityChanThink

feral bluff
#

I've made a fps walking system in unity. But i've had this issue with the code. That when the player changes the Y level even for a bit or just goes to another cube that is in the same Y level as the floor it just levitates in the air infinitly. I've tried some things but they dont seem to work. Here's the code.

#

`private void FixedUpdate()
{
float horizontalInput = Input.GetAxisRaw("Horizontal") * Time.deltaTime;
float verticalInput = Input.GetAxisRaw("Vertical") * Time.deltaTime;

    Vector3 cameraForward = Camera.main.transform.forward.normalized;
    Vector3 cameraRight = Camera.main.transform.right.normalized;

    cameraForward.y = 0f;
    cameraRight.y = 0f;

    Vector3 ForwardRelative = verticalInput * cameraForward;
    Vector3 RightRelative = horizontalInput * cameraRight;

    Vector3 MovementDirection = ForwardRelative + RightRelative;

    rb.velocity = new Vector3(MovementDirection.x,  rb.velocity.y , MovementDirection.z).normalized *      MovementSpeed; 
}“`
abstract monolith
#

https://gdl.space/upirivafit.cs
its supposed to be a script for switching guns with scroll wheel
this is the error
The name 'SelectWeapon' does not exist in the current context

deft grail
#

which made it local to Update

#

which means it doesnt exist outside of it

abstract monolith
#

ahhh

#

thanks i fixed it

stuck palm
#

Can you DDOL objects when working with online multiplayer? Might try and consider making a multiplayer component to my game if I can parse over the player input manager and stuff.

summer stump
split dragon
#

Hi. I have a question: I want to make a random value for red in Color Grading through a script, but there I need to convert int to the desired type for Unity. I tried searching the internet and found nothing. How to convert?

split dragon
# deft grail whats the error

Severity Code Description Project File String Suppression Status
Error CS0029 Cannot implicitly convert the type "int" to "UnityEngine.Rendering.Post Processing.Spline". Assembly-CSharp

twin bolt
proven wharf
#

First time with unity and c# My idea is a Tetris-style multiplayer Pacman (each person on their own half of the screen). I took a github with a classic pacman and duplicated everything, the problem is that they use the same scripts and if I want to change something it ends up being a chain of errors and code to change. I think the easiest way is to run 2 instances of the game in each half, is it possible? Each one with its own assets? Or there is a simpler solution and I am drowning in a glass of water.

eternal needle
eternal needle
grizzled zealot
#

It seems my "DynamicManager.asset" got messed up. The collision matrices I set up are still working correctly, but the when I go to Project Settings > Physics and look at the collision setup, it's all messed up. You can even see that the rows and columns don't align.

Also I don't use gravity, but it shows a gravity of -9.81.

acoustic arch
#

anyone got tips for making my objects in a list appear in an inventory, i have the grid fully setup now i just need a way for it to create an object slot and show the image

#

instantiate more cells to a grid

summer stump
grizzled zealot
twin bolt
acoustic arch
summer stump
summer stump
#

Generally just a for loop

#

Then using the i, you can do rows and columns with some math

summer stump
#

Or a for loop inside a for loop with i and j, j being the rows and i being columns

static cedar
#

U guys know how to enable nullable for the entire project in unity?

slender sinew
thorn holly
#

So I'm having a couple issues here. This is a script for a bullet. https://gdl.space/iheralilug.cs My first issue is that it will not bounce off walls. It just sort of hits them, then glides along them. Does anyone know why?

#

i logged it, and the collision is happening

eternal needle
thorn holly
thorn holly
eternal needle
native seal
#

you should just pass in you collider.includeLayers to make sure it is the right layer

native seal
#

in OverlapCircle

#

instead of "filter"

#

get a rerference to the bullets collider and then pass in includeLayers

#

make sure to set the include layer to the thing u want to hit in the inspector

thorn holly
#

i just did the bitmask, that seemed to work

#

thanks

topaz mortar
#

If I have a Class Item and then two classes that inherit item ItemA and ItemB
Can I make a Dictionary<Item> that contains both ItemA and ItemB?

#

Or is there some other solution for this?

cosmic dagger
#

yes, you can . . .

topaz mortar
#

I never really worked with inheritance 😛

charred spoke
#

Thats pretty much the whole point

topaz mortar
#

doesn't seem all that common in most projects

#

what happens to the variables ItemB has that are not in Item?

charred spoke
#

Nothing happens to them

topaz mortar
#

so I can access them from the Dictionary?

charred spoke
#

If you know that the specific item is itemB you can typecast it to B

#

But you should not be designing like that

#

Item should have a virtual method that does the work. B should override that to use its specific variables

topaz mortar
#

it's probably better to define all the fields in Item?

cosmic dagger
#

the reference in the dictionary is that of Item. you can only access fields from that class. as Uri stated, if you know that specific reference is an ItemB, then you can cast it to ItemB in order to access those specific fields . . .

charred spoke
#

The you can go item.DoSomething and it will B,s DoSomething

small mantle
#

Trying to make this worldTimer check if gets passed 10 seconds, and if it does it will increase enemy health. I want this cycle to happen every time worldtimer increases by 10 seconds. cs if (worldTimer % 10f == 0) { EnemyScript.health += 10; } --- This is the code that I am having problem with

charred spoke
topaz mortar
#

So what I'm trying to do is on my server create a list of items to send back to the client.
But different item types have different fields.
I can only send one reply from the server.

charred spoke
#

what do you mean one reply ?

topaz mortar
#

client asks for an item list and the server makes the items and sends them back

cosmic dagger
charred spoke
topaz mortar
#

It's kinda silly, for now I just have scrolls and equippable items,
the equippable items have 2 extra fields

charred spoke
#

then again I would just make it so tha the client already has all the items on his side and server just sends a list of id's like You currently have items 0.4.7,45

topaz mortar
#

the items are generated on the server 😦

#

but yeah I could just serialize them seperately

charred spoke
#

Why should the actual item object be generated on the server ? Have the server just generate what items the client has. You are wasting network trafic sending whole objects back and forth

topaz mortar
#

to prevent cheating?
items have a lot of randomly generated values

#

like damage

charred spoke
#

ah that is different, serializing the values and sending them over will work here then, but just the values, not the whole object. Client can reconstruct it on his side

topaz mortar
#

yeah

#

serialize is just putting them in their own dictionary right?

misty coral
#

When trying to use OnTriggerEnter with rigidbody on both the player and the platform, it is very glitchy, and I fall off the platform alot even when the platform is going across flat ground

#

why does this happen?

topaz mortar
#

OnTriggerEnter only triggers once

cosmic dagger
#

falling through the platform makes sense . . .

misty coral
cosmic dagger
#

you can enter and exit a trigger collider. basically, it's an area that triggers when smth has entered or exited . . .

#

a regular (non-trigger) collider cannot be entered as the object stops when touching it, like, walking into a wall . . .

loud mango
#

i can created a script where it will generate random numbers from 1-5, depending on the output, it will generate an enemy on the number generated. For example if the number generated is 3 then it will spawn an enemy on spawner 3.

It worked completely fine although when i instantiate the enemy model, i have an error in navmesh.

Error : ```"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination (UnityEngine.Vector3)
enemyMain:gotoPlayer () (at Assets/Enemies/enemyMain.cs:46)
enemyMain:Update () (at Assets/Enemies/enemyMain.cs:32)

exotic hazel
#

Will someone help
This code is not running

public class ColorTransition : MonoBehaviour
{
public Material CurrentColor;
public Color[] colors;
public int Index = 0;
public float time;
void Start()
{
StartCoroutine(ChangeColor());
}
void Update()
{
    

ResetIndex();
}
IEnumerator ChangeColor()
{
    yield return new WaitForSeconds(3f);
    CurrentColor.SetColor("_EmissiveColor",  Color.Lerp(CurrentColor.color, colors[Index], time  * Time.deltaTime));
    Index +=1;
}
void ResetIndex()
{
    if(Index >= colors.Length)
    {
        Index = 0;
    }
}

}

Theres no error

#

wait time was set 0

#

It still doesnt work

loud mango
#

umm did u fill all the vars and added the script and stuff

cosmic dagger
exotic hazel
cosmic dagger
#

also, the third parameter for Color.Lerp is used incorrectly . . .

#

it should animate from 0-1 over time . . .

#

in the coroutine, Lerp is only called once and Index is added once . . .

loud mango
#

help me with my problem too

#

i can created a script where it will generate random numbers from 1-5, depending on the output, it will generate an enemy on the number generated. For example if the number generated is 3 then it will spawn an enemy on spawner 3.

It worked completely fine although when i instantiate the enemy model, i have an error in navmesh.

Error : ```"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination (UnityEngine.Vector3)
enemyMain:gotoPlayer () (at Assets/Enemies/enemyMain.cs:46)
enemyMain:Update () (at Assets/Enemies/enemyMain.cs:32)

exotic hazel
#

Share the code too

exotic hazel
whole idol
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Destroyer : MonoBehaviour
{
    public GameObject toBeDestroyed;
    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update

    private void Start()
    {

    }
    private void Update()
    {
        Check();
    }
    private void Check()
    {

        if (toBeDestroyed.transform.position.x <= DestroyWhenReachesThisXPosition)
        {
            Destroy(toBeDestroyed);

        }
        bool condition_for_procreation = ((toBeDestroyed.transform.position.x + 5) <= (DestroyWhenReachesThisXPosition));

        if (condition_for_procreation == true);
        {
            //create one of your kind here
            Instantiate(toBeDestroyed, new Vector3(7.73f, -2.85f, 0), transform.rotation);
            condition_for_procreation = false;
        }
    }
}

Why is this creating an exponential amount of objects in my game?

loud mango
exotic hazel
#

In the error it tells theres a problem in enemymain scripts at line 32 and 46 try seeing those lines

loud mango
#

i saw the script but i dont see any error

rich adder
#

the enemy probably spawning too far from navmesh

loud mango
#

ooo

#

but the thing is

#

when i use enemy as prefab to spawn them, it doesnt work cuz the player needs to be a prefab too and then the prefab doesnt detect the player

#

so i thought of keeping a enemy out of sight outside the map and instantiate it inside the map

modest dust
#

Why not just pass the player instance into them as they spawn.

loud mango
#

idk how to do that

#

like what would the script look like

#

i am trying to make a game without watching any vids

modest dust
#

You spawn them at some point via Instantiate. Make a method, lets say void Init(GameObject player) and call it on the instantiated enemy to pass the player instance.

loud mango
#

ooooooooooo

#

i see, i will try to do that rn

#

thanks

loud mango
rich adder
loud mango
#

yeh

#

i thought of making multiplayer but then it was too complicated

#

so maybe later

rich adder
#

so yeah, either way if you were to spawn player. same concept applies

#

the object is created from the scene

loud mango
#

oo ohki

#

thanks

whole idol
#

Yo guys, check this out why is my game creating so many new obstacles at an exponential rate so fast? it looks as if its creating very fast and my code doesnt slow it down at all.

loud mango
summer stump
whole idol
summer stump
#

Did you really share code in a video... ?

#

!code

eternal falconBOT
summer stump
#

Show the inspectors of everything in the nested pipe

whole idol
#
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 3f;
    

    private void Start()
    {
        cloneInstantiator();

    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;

    }
    private void Check()
    {
        bool condition_for_destruction = (whatIstoBeDestroyed.transform.position.x <= DestroyWhenReachesThisXPosition);
        if (condition_for_destruction == true && _timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            Destroy(whatIstoBeDestroyed);

        }
        bool condition_for_procreation = ((whatIstoBeDestroyed.transform.position.x+0.5) <= (DestroyWhenReachesThisXPosition));

        if (condition_for_procreation == true);
        {
            //create one of your kind here
            cloneInstantiator();
            condition_for_procreation = false;
        }
    }
    void cloneInstantiator()
    {
        Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);

    }
}

loud mango
#

fbruh

summer stump
#

Also, make that a prefab instead of instantiating from the thing you're about to destroyed

rich adder
loud mango
#

the link

summer stump
#

Oh wait. That IS the prefab?
You aren't caching the instance you instantiate

loud mango
rich adder
#

try understand what the code even does

whole idol
#

catch it ? its not a baseball, how am i supposed to catch it?

whole idol
#

oh

#

what do you mean cacheing it?

summer stump
#

GameObject newInstance = Instantiate

#

You store the thing you create

summer stump
cosmic dagger
whole idol
#

erm... acthually it's not a variable, it's stored inside a method

void cloneInstantiator()
    {
        Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
#

this is a method right?

#

or am I crazy?

#

😛

cosmic dagger
#

we're telling you to store it in a variable . . .

summer stump
#

You are not storing the reference that Instantiate RETURNS

whole idol
#

ohhh i gotcha

summer stump
whole idol
#

method is good enough, no?

summer stump
#

No

whole idol
#

oh okay, so if its inside of a method you can't destroy it?

#

wow okay

summer stump
#

You need a reference to the thing you want to destroy

whole idol
summer stump
#

You don't have one

summer stump
cosmic dagger
summer stump
#

WhatIsToBeDestroyed is actually something you should NOT destroy
It is NOT the thing you instantiated

whole idol
modest dust
#

You're destroying a prefab or whatever is stored there

#

Instantiate returns a copy

#

Save that into a separate variable

summer stump
whole idol
summer stump
#

Which explains the super fast spawning

#

And also nothing being destroyed

whole idol
#
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 3f;
    

    private void Start()
    {
        cloneInstantiator();

    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;

    }
    private void Check()
    {
        bool condition_for_destruction = (whatIstoBeDestroyed.transform.position.x <= DestroyWhenReachesThisXPosition);
        if (condition_for_destruction == true && _timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            Destroy(whatIstoBeDestroyed);

        }
        bool condition_for_procreation = ((whatIstoBeDestroyed.transform.position.x+0.5) <= (DestroyWhenReachesThisXPosition));

        if (condition_for_procreation == true);
        {
            //create one of your kind here
            cloneInstantiator();
            condition_for_procreation = false;
        }
    }
    void cloneInstantiator()
    {
        GameObject newclone = (Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation));

    }
}

ok, so I created a new name for that thing I wanna instantiate

#

now you were saying I need to refer to the new clone right?

#

on destroy?

#

ok i gottit

summer stump
#

You wrote GameObject in front of newClone. So it is a local variable you cannot access elsewhere

whole idol
#

imma make it public then

summer stump
#

You need to make it a class variable

whole idol
#

thats easy to fix

summer stump
#

Cannot do accessors in methods

#

Just declare the variable in the class

whole idol
#

how am I gonna make an Instantiate method into a class?

#

I can make cloneInstantiator() into a class

#

that I can do

summer stump
whole idol
#

and then inside of that call the Instantiator

whole idol
summer stump
#

I'm saying make a variable in your class right here
Assign the instantiate return TO that variable

whole idol
#

so make cloneInstantiator() a class

summer stump
young smelt
modest dust
#

Dear Lord almighty

summer stump
modest dust
summer stump
#

Make a variable.

#

Inside your class

#

Not in a method

whole idol
#

you mean this class?

modest dust
# whole idol what do you mean?
private GameObject m_clone;

void cloneInstantiator()
{
  m_clone = Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
}

private void Check()
{
  ...
  Destroy(m_clone);
}```
summer stump
whole idol
#

ok thanks... fun fact, it's still creating millions of objects btw.

summer stump
#

Your condition you are checking

#

It is likely still pointing at the prefab, right?

whole idol
#

yes

summer stump
#

Well yeah, that will always be true

#

I mean, the check should be a timer anyway, not the position check you are doing

#

I gotta go to bed though. Best of luck

young smelt
loud mango
whole idol
# summer stump Well yeah, that will always be true

ok I remove the check for position condition and right now I am only using the timer, so as you said I gotta remove the pointer that always points at the prefab that always returns true right? so that means that I gotta remove the

public GameObject whatIstoBeDestroyed;

and replace it with what exactly? m_clone?

#
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 3f;
    

    private void Start()
    {
        cloneInstantiator();

    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;

    }
    private void Check()
    {
        if (_timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            Destroy(m_clone);

        }
        bool condition_for_procreation = ((whatIstoBeDestroyed.transform.position.x+0.5) <= (DestroyWhenReachesThisXPosition));

        if (condition_for_procreation == true);
        {
            //create one of your kind here
            cloneInstantiator();
            condition_for_procreation = false;
        }
    }
    private GameObject m_clone;
    void cloneInstantiator()
    {
        m_clone = Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
    }
}

m_clone is down there by the way, I just changed that according to the direction that @caesar has provided

modest dust
#

Move m_clone to the top, no reason for it being down there

#

your condition for procreation still uses the whatIstoBeDestroyed prefab

#

Ah yes, the timer

whole idol
#
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    private GameObject m_clone;

    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 3f;
    

    private void Start()
    {
        cloneInstantiator();

    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;

    }
    private void Check()
    {
        if (_timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            Destroy(m_clone);

        }
        bool condition_for_procreation = ((m_clone.transform.position.x+0.5) <= (DestroyWhenReachesThisXPosition));

        if (condition_for_procreation == true);
        {
            //create one of your kind here
            cloneInstantiator();
            condition_for_procreation = false;
        }
    }
    void cloneInstantiator()
    {
        m_clone = Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
    }
}

#

aaaand.... still broken

modest dust
#

Show your current code and if there are any errors

whole idol
#
bool condition_for_procreation = ((m_clone.transform.position.x+0.5) <= (DestroyWhenReachesThisXPosition));

it's no longer pointing to the old prefab thing

modest dust
#

Alright

#

Did you save your script?

whole idol
#

ctrl+s

#

Maybe this public GameObject has to go?

#

but then there will be no initial clones to be cloned after

modest dust
#

A question first, since I wasn't here since the beginning of your issue - should there be only one clone at all times?

whole idol
#

there should be always one clone, yes

last spindle
#

Hello!

modest dust
# whole idol there should be always one clone, yes

Then simply move your spawn logic to the timer check, or the other way around, the destroy logic into the position check, because right now the timer check could possibly destroy the clone when later you want to check its position (it's already destroyed so you're gonna be greeted with an error), thus the instantiation should most likely take place right after destroying the previous clone

last spindle
#

My friends told me to choose unity instead of unreal to begin with, but I don't know where to start

eternal falconBOT
#

:teacher: Unity Learn ↗

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

last spindle
#

I know how to use the Unity interface and all its plugins, but I don't know how to program or anything about the visuals.

charred spoke
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

last spindle
#

Yes, I've already entered, but which one should I select?

languid spire
last spindle
languid spire
whole idol
last spindle
whole idol
#

even tho I literally and very clearly have this cloned at the start

whole idol
#
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    private GameObject m_clone;

    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 3f;
    

    private void Start()
    {
        cloneInstantiator();

    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;

    }
    private void Check()
    {
        if (_timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            cloneInstantiator();


        }
        bool condition_for_procreation = ((m_clone.transform.position.x+0.5) <= (DestroyWhenReachesThisXPosition));

        if (condition_for_procreation == true);
        {
            //create one of your kind here
            condition_for_procreation = false;
            Destroy(m_clone);

        }
    }
    void cloneInstantiator()
    {
        m_clone = Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
    }
}

languid spire
last spindle
whole idol
#

this is one thing that is very sus

#

and not expected this to happen

#

no errors at all

#

at least not being detected on the terminal

modest dust
#

In the Unity console

whole idol
#

oh wait

#

yeah

languid spire
modest dust
#

Yeah, then fix that error

#

If there's an exception in a component, it will deactivate itself if I remember correctly

#

Thus the timer is no longer updated

#

And as I said earlier, you're trying to access a destroyed clone

#

You have two separate checks

whole idol
#

how is it being destroyed if nothing is showing up in the first place?

modest dust
#

(destroyed or null)

#

Either way, instead of doing two separate checks (timer and position), make just one instead

#

If there's supposed to be only one clone at a time then decide whether you want to use the timer or position

loud mango
#

is this the same problem rn?

whole idol
# modest dust If there's supposed to be only one clone at a time then decide whether you want ...
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    private GameObject m_clone;
    
    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 2f;

    private void Start()
    {
        cloneInstantiator();
    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;
    }
    private void Check()
    {
        if (_timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            cloneInstantiator();
            Destroy(whatIstoBeDestroyed);
            Destroy(m_clone);

        }
    }
    void cloneInstantiator()
    {
        m_clone = Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
    }
}
modest dust
# modest dust If there's supposed to be only one clone at a time then decide whether you want ...

Because right now two things can happen.

  1. Your timer reaches when_timer_should_stop and makes a new clone, thus leaving the previous clone to be forgotten for eternity, yet still active in the scene (that's why you had a ton of them earlier)
  2. Your position condition is met and the clone is destroyed. But the timer still didn't reach when_timer_should_stop so there is no new clone and you're greeted by an exception the next time you want to check the position.
modest dust
#

Also the old clone should be destroyed first, and then call cloneInstantiator() to make a new one

cunning rapids
loud mango
#

its 4-5 lines

modest dust
loud mango
#

oo

#

idk the whole issue here, i just read the code and suggested

modest dust
#

No worries

whole idol
loud mango
#

Seisan

loud mango
#

what are u trying to make?

modest dust
#

First fix your code so the error doesn't show up and then show the current code

whole idol
loud mango
#

oo

whole idol
loud mango
#

bruh then why are u doing all this

cunning rapids
loud mango
#

just give ur player a constant velocity in one direction and make him add rb.force at his feets everytime the player presses space

loud mango
#

yeh

whole idol
#

yeah but what about the pipes

#

I want clone pipes

loud mango
cunning rapids
# loud mango yeh

I don't even think you need to animate anything as well since rigidbody rotations handle all of that well

loud mango
#

how are u detecting that the pipe has exited the screen

cunning rapids
whole idol
#

I did add rigidbody on the body of the player

#

and a gravity script

#

thats it

#

but the pipes have no rigidbody

#

I did give them rb 2D but didnt do anything

loud mango
#

then dont need to have one

cunning rapids
#

You don't need a gravity script with rigidbody...

whole idol
#

the player just goes straight through them

#

also tried mesh collider

loud mango
#

dude

#

u are making a 2d game not a 3d

#

mesh colliders are for 3d models

cunning rapids
#

What mesh bro this is a 2d game

whole idol
#

oh okay

loud mango
#

just listen to me

cunning rapids
#

Use 2d box collider

#

Ol reliable

loud mango
#

delete the project, make a new one

#

add a cube

#

make it jump and move in one direction constantly

#

dont add any sprites or something like that

#

it can be done later

#

and try to make different folders for everything so u make it clean and organised

#

something like this

loud mango
#

i get it that its for clear understanding

#

then try writing a new script

#

that does everything

#

dont delete the old script,

#

reference them in ur new script

whole idol
#

by the way

#

my bird does have a sphere collider

#

is that good?

modest dust
#

That's for 3D

whole idol
#

and IsTrigger

loud mango
#

dude

#

thats for 3d

whole idol
#

ok

loud mango
#

just search " collider " and everything that says 2d will work

#

what video are u referencing?

cunning rapids
loud mango
#

dont use IsTrigger,

whole idol
loud mango
#

goto brackeys

#

he is the god

#

idk how to spawn the piller cuz have never made a flappy bird, but the player controller script that u made is really confusing and complex for a simple task

modest dust
#

His current setup is alright, and this has gone far beyond the original problem

swift elbow
modest dust
#

Do not watch brackeys, yes

loud mango
#

why

swift elbow
#

super old and mostly buggy tutorials

loud mango
#

his personal yt for a nice explanation for 3d stuff

modest dust
whole idol
# modest dust Can you show your current code?
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using static UnityEngine.RuleTile.TilingRuleOutput;

public class Destroyer : MonoBehaviour
{
    public GameObject whatIstoBeDestroyed;
    private GameObject m_clone;
    
    public float DestroyWhenReachesThisXPosition = -10f;
    // Start is called before the first frame update
    public Vector3 pipeSpawnVector = new Vector3(7.73f, -2.85f, 0);
    public float _timer = 0; //we need a time slowdown to slow the speed of generating new obstacles in our game
    public float when_timer_should_stop = 2f;

    private void Start()
    {
        cloneInstantiator();
    }
    private void Update()
    {
        Check();
        _timer += Time.deltaTime;
    }
    private void Check()
    {
        if (_timer >= when_timer_should_stop)
        {
            _timer = 0; //reset
            cloneInstantiator();
            Destroy(whatIstoBeDestroyed);
            Destroy(m_clone);

        }
    }
    void cloneInstantiator()
    {
        m_clone = Instantiate(whatIstoBeDestroyed, pipeSpawnVector, transform.rotation);
    }
}

cunning rapids
loud mango
#

!code

eternal falconBOT
modest dust
cunning rapids
loud mango
#

yeh

#

show ur movement code

whole idol
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LeftMove : MonoBehaviour
{
    // Start is called before the first frame update
    public int speed;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.left* Time.deltaTime * speed);
    }
}

#

the movement code is not that scary

loud mango
#

yeh

cunning rapids
modest dust
#

Obviously, but that's another issue

#

First he has to make it at least playable

cunning rapids
#

Fair enough

whole idol
#

oh fuck, it finally works perfectly

loud mango
#

i suggest making a 2d movement showcase if u think the pillars are confusing af

loud mango
modest dust
loud mango
#

ooooooooooooh i remember that

cunning rapids
#

Ah so he's moving the background, not the player

#

Makes sense

#

The player should just have a jump script then

loud mango
#

makes sense

modest dust
loud mango
#

lol

#

same

whole idol
#

This smooth movement feels more satisfying than sex.

#

I love it

#

😄

#

epic

loud mango
#

nice

#

just ping me if u need help,

modest dust
#

Or me, to avoid making a new project as he suggested

loud mango
#

yeh

#

u will just think of quiting making games if u are burnt out thats why

cunning rapids
# whole idol

Do you wanna start with the player movement or the random pillar height?

#

Player movement is really easy for flappy bird btw

#

I can help

whole idol
loud mango
#

me too if u wanna make a 2d platformer

whole idol
#

I can make that on my own btw im just kind of slow

cunning rapids
whole idol
#

okay

cunning rapids
#

It's easier to implement

modest dust
#

Would be good if he tried to figure it out by himself, but do it however you want

#

I'm going back to work, cya

whole idol
#

movement of what exactly?

cunning rapids
loud mango
cunning rapids
cunning rapids
loud mango
cunning rapids
whole idol
#

i got it

#

give me 1 min

cunning rapids
#

Try make something yourself and show it to us

hexed terrace
#

Would be best to make a thread for this now

modest dust
cunning rapids
loud mango
#

flash, what game are u working on?

cunning rapids
cunning rapids
loud mango
modest dust
loud mango
#

i am kinda stuck and not stuck

cunning rapids
loud mango
#

i can find 3d models online but they are either paid or not good enough

cunning rapids
#

Kinda like in 3d modeling, you know how to make a gun hut you need a reference to actually do something

loud mango
#

i have a small list to add today........... farming, wave spawning, new gun

cunning rapids
loud mango
#

lol

modest dust
cunning rapids
#

I work on visuals last personally

loud mango
#

i am focusing on gameplay cuz my graphics are literally beans and cubes

modest dust
#

At work, when making a game in UE5 for most of the time we were using basic placeholder models and the proper visuals came last, just around a month ago. But the gameplay was pretty much done by that point.

loud mango
#

can someone join a vc, i wanna show a problem i am having. i cant understand what's causing it

cunning rapids
loud mango
#

same

#

oh god there are no vc in this server

cunning rapids
loud mango
#

i have some problem

#

when i play the game in unity editor, my gun shoots fine

#

but when i build and play its like it misses the shots even tho there are no features like it

whole idol
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Gravity : MonoBehaviour
{
    public float speed = 4f;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.down * Time.deltaTime * speed);

        if (Input.GetButtonDown("Jump"))
        {
            transform.Translate(Vector2.up * Time.deltaTime * 4);
        }
    }
}

#

no errors

#

but the space key doesnt do anything

#

neither does the up arrow

cunning rapids
#

And...?

whole idol
#

I looked at the edit>input system

loud mango
whole idol
#

and it looks like its already configured so when you use that keyword

#

they are supposed to make it work that way

#

ok

loud mango
modest dust
loud mango
#

i have a problem need help

cunning rapids
loud mango
#

yeh

cunning rapids
#

You don't need to hard-code gravity

loud mango
#

use AddForce

whole idol
#

why squiggly red line?

loud mango
#

error

#

wait let me recheck

#

i wrote that in discord without isense

cunning rapids
loud mango
#

if(Input.GetKeyDown(KeyCode.Space)){
// ur coode here 🙂
}

cunning rapids
#

Unity already takes care of that

#

All you have to do is move the sprite forward

#

And jump when needed to

loud mango
whole idol
#

But rb2d doesn't have velocity?

loud mango
#

its better gameplay and physics

#

bruh can someone help meeeeeeeeeeeeee

cunning rapids
modest dust
modest dust
loud mango
#

anyone who can come in a vc and see my screenshare, i have a confusing problem with no console errors

loud mango
#

yeh

cunning rapids
#

We'd need more context man

loud mango
#

bruh thats why the vc

modest dust
whole idol
# cunning rapids Again, rigidbody is just how unity handles physics, moving the sprite is YOUR jo...
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static System.Runtime.CompilerServices.RuntimeHelpers;

public class Gravity : MonoBehaviour
{
    public float speed = 4f;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.Space))
        {
            transform.Translate(Vector2.up * Time.deltaTime * 4);
        }
        else
        {
            transform.Translate(Vector2.down * Time.deltaTime * speed);
        }
    }
}

and why not just do this?

#

(space doesnt work)

loud mango
#

okei just a saec

modest dust
cunning rapids
modest dust
#

With a rigidbody you'll get a much nicer effect, with much less effort

bold nova
#

Im implementing shooting mechanic with raycasts. I have a camera on the player as a ray cast origin point. Than I shoot a raycast and if it hits anything i interpolate trail renderer from gun to hit.point, pretty simple. The problem is within direction, for some reason if i set a direction with a gun.tramsform.forward on some rotations it shoots wrong direction, but if i set direction as camera.forward it works on all rotation of the player. I don't understand how it works

    public override void Attack()
    {
        if (CanShoot())
        {
            ammo--;
            updateAmmoInterface(ammo);

            PlayShotEffect();

            Vector3 direction = GetDirection();

            RaycastHit hit;
            if (Physics.Raycast(rayCastOrigin.position, direction, out hit, _weaponInfo.Distance))
            {
                var trail = SetUpTrail();

                StartCoroutine(SpawnTrail(trail, hit));

                lastShootTime = Time.time;

                IShootable shootable;
                if(hit.transform.TryGetComponent<IShootable>(out  shootable))
                {
                    shootable.TakeBullet(_weaponInfo.Damage);
                }
            }
        }
    }

    private Vector3 GetDirection()
    {
        var vect = transform.forward;

        if(_weaponInfo.IsSpreadApplied)
        {
            Vector3 spread = _weaponInfo.Spread;

            vect += new Vector3(UnityEngine.Random.Range(-spread.x, spread.x),
            UnityEngine.Random.Range(-spread.y, spread.y),
            UnityEngine.Random.Range(-spread.z, spread.z));
        }

        return vect.normalized;
    }
loud mango
bold nova
#

Like it can shoot perpendicular to the player

loud mango
#

nvm sorry,

#

my aim was just shit

deft apex
#

What factors/fields impact a simple hingejoint object's friction and drag? Like a door consisting of a single cube shaped into a door

loud mango
#

u wanna add drag?

#

to ur door?

deft apex
#

I want to remove it all

#

But for some reason some stays

#

And idk why

loud mango
#

add a rigidbody and set its drag and angular drag to 0 and turn off gravity

#

idk if it will work 100%

#

is there any channel to advertise a small team or something?

bold nova
loud mango
#

oh

#

me too

#

let me check ur error

#

i dont have the spread feature tho

#

so its like

#

idk how to explain it

#

i had the same problem

lunar carbon
#
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class score2 : MonoBehaviour
{

    public TMP_Text highscore;


    // Start is called before the first frame update
    void Start()
    {
        
        if (Timer.elapsedTime > Timer.bestTime || Timer.bestTime == 0)
        {
            Timer.bestTime = Timer.elapsedTime;
        }
        highscore.text = highscore.text.Replace("New Text", "Highscore is" + (Timer.bestTime / 1000) + " sec");   
        


    }

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

        
    }
}```

how do i save the lowest time to timer.BestTime
loud mango
#

!code

eternal falconBOT
modest dust
lunar carbon
burnt vapor
loud mango
#

ooo

#

sorry

lilac hemlock
#

Can anyone help, please?

loud mango
#

go one

#

lemme check

#

nvm its not my piece of cake

#

sorry

topaz mortar
#

@charred spoke this is exactly what you meant right?

Dictionary<int, List<Dictionary<string, object>>> combatLogs = new Dictionary<int, List<Dictionary<string, object>>>();

// Itemlist
Dictionary<int, List<Dictionary<string, object>>> itemList = new Dictionary<int, List<Dictionary<string, object>>>();

// Return dictionary that includes combatlogs and items
Dictionary<string, object> returnDic = new Dictionary<string, object>();

...

returnDic.Add("CombatLogs", combatLogs);
returnDic.Add("Items", itemList);

return returnDic;
#

Hope no one else ever has to touch this code 😅

charred spoke
#

I dont think this is wha I menat at all. Like I siad I would not send an entire dictionary of <string.object> over the network

topaz mortar
#

it gets turned into a json string

bold nova
#

Im implementing shooting mechanic with raycasts. I have a camera on the player as a ray cast origin point. Than I shoot a raycast and if it hits anything i interpolate trail renderer from gun to hit.point, pretty simple. The problem is within direction, for some reason if i set a direction with a gun.tramsform.forward on some rotations it shoots to the right or left instead of forward, but if i set direction as camera.forward it works on all rotation of the player. I don't understand how it works

    public override void Attack()
    {
        if (CanShoot())
        {
            ammo--;
            updateAmmoInterface(ammo);

            PlayShotEffect();

            Vector3 direction = GetDirection();

            RaycastHit hit;
            if (Physics.Raycast(rayCastOrigin.position, direction, out hit, _weaponInfo.Distance))
            {
                var trail = SetUpTrail();

                StartCoroutine(SpawnTrail(trail, hit));

                lastShootTime = Time.time;

                IShootable shootable;
                if(hit.transform.TryGetComponent<IShootable>(out  shootable))
                {
                    shootable.TakeBullet(_weaponInfo.Damage);
                }
            }
        }
    }

    private Vector3 GetDirection()
    {
        var vect = transform.forward;

        if(_weaponInfo.IsSpreadApplied)
        {
            Vector3 spread = _weaponInfo.Spread;

            vect += new Vector3(UnityEngine.Random.Range(-spread.x, spread.x),
            UnityEngine.Random.Range(-spread.y, spread.y),
            UnityEngine.Random.Range(-spread.z, spread.z));
        }

        return vect.normalized;
    }
topaz mortar
#

I think 🤔

bold nova
#

I guess it has something to do with children - parent rotation but Im not sure

topaz mortar
# bold nova Im implementing shooting mechanic with raycasts. I have a camera on the player a...

I think there's a bunch of information missing to solve this problem
We don't know what gun or camera is or how they work.
You've just dumped a big block of code (which you're not supposed to) and expect someone to solve your issue for you.

Track down where in your code it's going wrong and ask for info on a single line, or better, read the docs and figure it out yourself.
Maybe someone can help you, but I doubt anyone will look at this.

charred spoke
bold nova
topaz mortar
topaz mortar
#

making a bullet go in the right direction is VERY basic and there's probably a million tutorials on it on every possible platform (like YouTube)

eternal needle
timid marlin
#

anyone know why i cant find "Whatisground" and "Whatisplayer" layermasks?

strong wren
timid marlin
topaz mortar
timid marlin
eternal needle
# topaz mortar Why does it indicate I'm doing something wrong?

It's an overly complex structure. I cant imagine any case where this would be needed.
You shouldnt really use 'object' much, except for like serialization.
Using this structure is also gonna be a massive pain, and completely unreadable. You'll access something via data[int][index][string]. But then all you'll have is something of type object. Regardless of the types that are being used here, you can always split up your logic into other classes. Like it would be much simpler on the eyes if it was a Dictionary<int, SomeClass>

topaz mortar
#

but then I would still need to send that class over the network?

#

agree that using classes would be better

hollow scroll
#

I'm trying to do a simple skill tree for a coding asignment, but it's telling me an index is out of range. I can't find where though-

buoyant knot
#

the error should specify the line of code

#

look at the stack trace

hollow scroll
#

it's 27, but I'm not setting anything here I think

strong wren
#

i know this is very stupid, but how do i use a slider as a health bar?

#

whats the name of it

#

Public Slider Health; doesnt work

hollow scroll
#

(better image)

swift elbow
#

That's an error

strong wren
#

no

#

its not it

#

it isnt

strong wren
#

thats the line of code

swift elbow
#

S should be capitalized...

strong wren
#

i tried that too 😭

#

same issue

#

public Slider Slime_Health;

#

same issue

languid spire
#

so, are you missing a using directive?

strong wren
swift elbow
#

At the top of your script

strong wren
#

its just a slider that i tweaked a lil

strong wren
#

like using Slider;?

#

oh

#

using unity.ui;

slender nymph
#

make sure that your !IDE is configured so that you can use the quick actions to add the correct using directive automatically

eternal falconBOT
slender nymph
#

your code editor

strong wren
#

i use Visual Studio

slender nymph
#

you could literally just read the bot message and figure that out

strong wren
#

yeah i use Visual Studio

slender nymph
#

so get it configured . . .

strong wren
#

already have it configured

slender nymph
#

screenshot the entire visual studio window

strong wren
slender nymph
#

the entire visual studio window

strong wren
slender nymph
#

not configured

strong wren
slender nymph
#

it's like you didn't even bother reading the bot message

strong wren
#

i clicked on the visual studio automatic thing

#

and i followed the instructions

languid spire
slender nymph
# strong wren i did

so then surely you saw the part about how if your IDE is not autocompleting code or underlining errors then it is not configured, right?

lilac hemlock
#

bump it up

strong wren
slender nymph
#

did you bother reading the words

strong wren
#

i had to restart visual studios

#

wait why cant i say bruh?

#

i just said it alone and it blocked it

strong wren
#

yeah now it went from misc ti Assenbly-CSharp

buoyant knot
strong wren
#

soo i still have the issue

#

😭

slender nymph
#

remove the incorrect using directive and use the quick actions in visual studio to add the correct one

strong wren
#

DAYUM it tells you what to do?

#

bruh i used to programm like 3 years ago and i wanted to learn it again

#

i Never had that

hollow scroll
strong wren
#

the issue is gone btw i forgot to use the Unity Elements thing

slender nymph
#

no, that is wrong too

#

there is a Slider class in UnityEngine.UIElements, but it is not the one you are using

strong wren
languid spire
slender nymph
strong wren
languid spire
strong wren
#

even i am sure thats not that hard to programm

strong wren
languid spire
#

no, of course not

slender nymph
strong wren
languid spire
slender nymph
#

Unity.UI is incorrect

strong wren
slender nymph
#

and that is irrelevant

languid spire
#

true

strong wren
#

doesnt it also need the ui thing?

slender nymph
#

no, the TMP_Text class is in the TMPro namespace which you did have added correctly

supple meteor
#

where can i find a tutorial how to make a car with ignition?

rare basin
supple meteor
#

cant find

strong wren
#

yes i am using TMPro; but i tought i also need to use Unity.UI;

languid spire
slender nymph
rare basin
strong wren
rare basin
#

you should configure your ide first anyway

strong wren
#

bro idk last time i programmed with unity i didnt do half of this stuff

rare basin
#

ok

slender nymph
strong wren
#

ok

#

well is there anything else that i need to add or do or can i now start programming?

rare basin
#

start with configuring your ide

strong wren
#

how are yall so patient tho?

strong wren
slender nymph
strong wren
#

no

strong wren
slender nymph
#

then it is configured

rocky canyon
#

then its already configured

strong wren
#

cooll

#

so im all set

slender nymph
#

yeah just fix your error

strong wren
#

i dont have any errors now

#

i have said it alot

slender nymph
#

do you still have the UIElements namespace added?

rocky canyon
#

unused namespaces will appear greyed out.. w/ a configured IDE u can hover it and it will say its unused and can be removed

slender nymph
# strong wren yes

cool so you only follow instructions when other people give them. good to know

slender nymph
#

can someone else tell this person to remove the UIElements namespace because it is the incorrect one? since when i told them to do it they didn't bother listening

rare basin
#

please remove the UIElements namespace

rocky canyon
#

hey, you need to remove the UIELements namespace b/c its the incorrect one

rare basin
#

they already said

slender nymph
#

i never actually said which one is the correct one

copper lotus
#

You know what. Sebi over here has given me the confidence to move out of the code-beginner channel and into the general one

rare basin
#

learn how to use docs and how to use google properly

#

it'll help you a lot

strong wren
languid spire
rocky canyon
#

aka using UnityEngine.UI; is required

strong wren
#

someone told me to remove it

slender nymph
#

no you weren't

#

you tried Unity.UI which is not the same fucking thing

rocky canyon
#

i just got here ¯_(ツ)_/¯

slender nymph
#

nor is UnityEngine.UIElements

strong wren
#

ah ok

strong wren
#

on like 2 other discord servers

#

but ur the boss

rocky canyon
#

c# is very verbose.. things are exactly how they look..

languid spire
rocky canyon
#

no one competent says docs are unrealiable 😄

strong wren
#

i like everything that way

strong wren
rocky canyon
#

very much so

strong wren
#

do i need to be good at math tho? i heard u also need to be superb there

rocky canyon
#

you need to know basic math... and how to google

strong wren
#

i know programming using math sometimes but u dont need to use quatorians like every second

languid spire
#

yes, you do need to at least have a good grasp of basic math

strong wren
strong wren
languid spire
rare basin
#

just learn, read the docs, use google properly

#

no need to offtopic

void hazel
#

Help please, I recently found out about unity and want to download, I downloaded unity hub and entered, I clicked on "sign in" and I went to "Confirm your email" and then clicked continue, and then nothing happened except that the button turned gray and then green again.

strong wren
#

i keep hearing it in tutorials but i never actually know about them

languid spire
strong wren
copper lotus
rare basin
strong wren
rare basin
#

ok

strong wren
#

Quantity that has both magnitude and direction

void hazel
# rare basin this is a code channel mate

I'm sorry, I didn't understand what you said, and I can't find a regular chat here, if there's one. I just went to where the asset is. I don't know English, so I use a translator, and your words are translated, apparently not correctly, so I didn't understand you.

rocky canyon
#

add unity to ur search

rocky canyon
#

so instead of vectors type unity vectors

#

instead of how to jump.. type unity how to jump

strong wren
#

thats how i always do it

rocky canyon
#

yea sure that'll work

languid spire
# strong wren what are vectors tho?

In this video I tried to cover as much useful information about Vectors in Unity as possible. We start by discussing what Vectors are, what useful properties they have then we go through most useful methods and at the end of the video I am giving 2 examples of solutions that require vectors.

This was until now the most challanging video to make...

▶ Play video
void hazel
rocky canyon
#

vectors are cool af ;D

strong wren
#

pls tell me their not hgard ot learn man

#

bruh, basically the size and location?

rocky canyon
#

can be used as directions too

#

or inputs even

#

2 inputs together could make a Vector2

strong wren
rocky canyon
#

(x,y)

strong wren
#

and Vector 3 is x y z right?

rocky canyon
#

yes, and a vector 3 is (x,y,z)

#

yeap.. ez stuff

fickle plume
#

The tutorial was linked right there, no need to turn public channel into rehashing it

strong wren
#

well ima go try my best to make a easy clicker game

#

cant be that hard?

#

if button pressed ++ 1 bla bla

rare basin
#

jezus just try it

#

and stop spamming the channel with such questions

fickle plume
#

@strong wren Start with Unity !Learn courses and see for yourself

eternal falconBOT
#

:teacher: Unity Learn ↗

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

strong wren
#

idk why but i have a harder time working with 2d games

fickle plume
#

@strong wren There's no off-topic here either

languid spire
strong wren
strong wren
#

alr what are the variables again? i know what they are but i cant find the names

all i know is that string is for letters words numbers for show etc
float is for not whole numbers like 0.4 etc
bool is true or false

#

but there was another one for full numbers

#

what was it calleed again

fickle plume
#

@strong wren If you want a private tutorial session create a thread. You've been provided with tutorial materials

strong wren
#

ima just look more

slender nymph
strong wren
#

int right?

fickle plume
#

@strong wren For the last time. Create a thread if you want to continue or you'll be muted

languid spire
strong wren
#

il just watch the video of the god himself, brackeys

languid spire
rare basin
#

i'd say programming is not for you if you cannot figure it out what is a variable in 2024 using internet. It justs gets "harder", sorry

strong wren
#

i just forgot the names of some

hard lodge
slender nymph
hard lodge
#

Lol

strong wren
strong wren
scarlet skiff
#

I have a bunch of spawners with their own type of spawner script, but i wanna add an interface... how do i implement it? do i make a new script where i define the interface then give that script to all the spawners or?

burnt vapor
slender nymph
rare basin
hard lodge
#

Lol

hollow scroll
#

why are you guys still going on about this 😭

fickle plume
#

@hard lodge This is not a place for random reaction messages

fickle plume
scarlet skiff
slender nymph
#

you probably just want a base class that they all share for that

burnt vapor
#

Yes, so abstract class

scarlet skiff
#

depending on what this SpawnerController wnats to spawn, it would access the spawners script, and find a Spawn() method in there, and run it

rare basin
slender nymph
#

also those nested dictionaries are horrifying

rare basin
#

yeaa

scarlet skiff
#

ugh... i guess one thing at a time

#

so a shared parent class?

rare basin
#

do you know what's inheritance? @scarlet skiff

#

abstract BaseSpawner : MonoBehaviour -> ProjectileSpawner : BaseSpawner

#

and make some kind of Spawn() function which you will override in your classes

ivory bobcat
oblique herald
#

Hi guys...
Currently I have these line of code to detect collision if player goes to a vault, an UI prompting user input will pop up, however my UI doesnt show up, yet it prints Vault UI Activated. Any idea why and how to fix it?

    private void OnCollisionEnter2D(Collision2D collision) {
        if (collision.gameObject.tag == "Player") {
            vaultUI.SetActive(true);
            Time.timeScale = 0;
            print("Vault UI Actived");
        }
    }
slender nymph
#

unrelated to the issue you described, but you should be using the CompareTag method rather than string equality when checking tags

but also are you perhaps doing something like fading your UI in? or literally anything at all that depends on the time scale?

oblique herald
ivory bobcat
oblique herald
ivory bobcat
#

In play mode when you activate the object, is the object activated in the scene hierarchy?

hexed terrace
#

There's nothing there called vaultUI

oblique herald
deft apex
hexed terrace
hexed terrace
#

these icons shouldn't be visible.. unless they're enabled OR the mouse cursor is over this object in the hierarchy

#

but, thinking about it.. that only hides the object in the scene view... ignore

strong wren
#

hey its me again

ivory bobcat
#

Change your print to this cs Debug.Log($"{vaultUI.name}'s active state was set to true", vaultUI);Maybe you're referencing the wrong object.

oblique herald
#

Panel' active state was set to true
UnityEngine.Debug:Log (object,UnityEngine.Object)
vaultTip:OnCollisionEnter2D (UnityEngine.Collision2D) (at Assets/Script/vaultTip.cs:26)

#

wheres the s

strong wren
#
{
    public int DMG = 1;
    public int Coins = 0;
    public TMP_Text CoinCounter;
    public Slider SlimeHealth;
    bool isDead = false;

    public void DmgSlime()
    {
        SlimeHealth.value =- DMG;
        if (SlimeHealth.value == 0)
        {
            isDead = true;
        }
    }

    public void AddMoney()
    {
        if (isDead == true)
        {
            Coins++;
            CoinCounter.text = Coins.ToString ();
            SlimeHealth.value = 5;
        }
    }
}```
ivory bobcat
strong wren
#

which shouldnt happen since i manually set the dmg to 1 which u can see and the health is 5

oblique herald
ivory bobcat
#

Try it again with the updated code and see which object is highlighted

strong wren
oblique herald
#

Panel's active state was set to true
UnityEngine.Debug:Log (object,UnityEngine.Object)
vaultTip:OnCollisionEnter2D (UnityEngine.Collision2D) (at Assets/Script/vaultTip.cs:26)

Now its highlighting Panel

ivory bobcat
#

It should be an object in the scene and not a prefab

oblique herald
strong wren
ivory bobcat
#

Is the panel active?

strong wren