#💻┃code-beginner

1 messages · Page 648 of 1

rocky wyvern
#

What’s the other error

runic shore
#

@rocky wyvern

runic lance
#

those special characters in the directory path seem likely to cause issues

runic shore
#

really?

runic shore
#

but we will try

rocky wyvern
runic shore
#

just for him

rocky wyvern
#

Have him try to update .net

runic shore
#

what is that mean

rocky wyvern
#

.net is a software framework for Microsoft

#

It’s what unity projects use

#

The error you’re getting failed to resolve assembly is an error from .net

#

It could be caused by something in your project, or it could be something in his .net installation

#

Just look up update .net and there should be a official Microsoft document for it

runic shore
#

maybe the other guy is right?

twin pivot
#

go test out both theories

#

then come back

rocky wyvern
#

I mean, maybe, but i feel like that would be something that would have been fixed fairly rapidly

#

Just have him reimport the project to somewhere on c drive not under his user

#

If you think that might be an issue

runic lance
#

I would recommend never having non-ascii characters in your directories anyway

#

I even had problems with whitespaces in the past

rocky wyvern
#

I mean if it’s bros name it’s kind of understandable

green copper
#

just wanted to confirm something is going to behave as expected

if I have an object like indicatorLight

and I give it the property

public static CommsManager commsManager

the static keyword means that if I give one indicator light the commsManager in inspector, all will be able to read it?

they need to be able to run, essentially,

if (commsManager.messageQueue[0].address == this.address)
then turnSelfOn()```

Operative question is, will the static keyword mean I can have many indicator lights without having to manually assign the comms manager to all of them to get them to listen for whether they should turn on
proper pasture
#

ok I just fixed it by replacing the entire if statement with a single equation and it works... its a cosine function that drops to 0 when close to 0 and 1
it works perfectly now

rocky wyvern
rocky wyvern
#

Lookup a ‘singleton’

green copper
#

oh, duh, I forgot I did that exact thing to check story flags for something else it's even already set up for that

#

thank you lol!

runic shore
#

i fucking love u

sand field
#

What's the easiest way to accurately bounce an object off of a wall? I have this but it obviously isn't giving the desired effect

private void OnTriggerEnter(Collider other)
{
    changeAngle = transform.eulerAngles;
    transform.Rotate(changeAngle);
}
#

All 3 walls have a collider

rocky wyvern
cosmic dagger
rocky wyvern
#

(I would argue better but it’s a new can of worms if you have no idea)

green copper
cosmic dagger
cosmic dagger
rocky wyvern
#

And a singleton when you need to access data or functions from many scripts

rocky wyvern
#

When message received, turn on light x
When message read turn off light x

rocky wyvern
#

Which unless you need to you’d rather not do

green copper
#

I was actually going to have that line of code run in a function like

onMessageQueueChange()

triggered in CommsManager

#

but an event system sounds like something build for that

#

so I'll look into it thank you

rocky wyvern
#

Purpose built for conveying when things happen to many instances of scripts that need it

hushed ridge
#

yes..?

green copper
# rocky wyvern Purpose built for conveying when things happen to many instances of scripts that...

gist of my usecase from my rough GDD is here


CommsManager will store all conversations with active incoming messages in a list of conversations called QueueIncoming

CommsManager will store a list of conversations that can be responded to in a list of conversations called QueueOutgoing


playerActiveDevice will keep track of whether the player has the radio or wireboard plugged in

playerActiveAddress will keep track of what address is selected, either which switchboard plug or what radio coordinates

playerActiveDirection will keep track of whether the player is in sending or receiving mode

if the method and address match an incoming message and the active direction is receiving, set the comms equipment to decode mode to begin displaying the data

if the method and address match a conversation with a reply available and the active direction is sending, display the player’s dialogue options and allow them to key a response

if the method and address do not match anything in either queue, or the wrong PlayerActiveDirection is set, comms devices should remain dormant

Every address with a matching conversation in QueueIncoming should have some form of indicator, either an indicator light for the switchboard or radio distortion minigame for radio
hushed ridge
#

why does ui appear in my scene

slender nymph
#

not a code question, but that is how the screen space overlay canvas works

rocky wyvern
#

How else would you position things on a canvas

hushed ridge
#

use imagination

rocky wyvern
#

If it’s on overlay mode it won’t be rendered while in game

wintry quarry
#

well it will, just - overlaid on the screen not like this.

cosmic dagger
rocky wyvern
sand field
#

All the examples I see online for getting the normal off the other object say to use thing.contacts.normal; but that doesn't seem to exist

wintry quarry
#

You only get one of those in OnCollisionEnter

#

You don't get that in OnTriggerEnter

sand field
#

Ah... I see

#

Thanks

wintry quarry
# sand field Thanks

The other way generally to get a normal is from a raycast (or similar things like boxcast etc)

#

the RaycastHit will have a normal

#

for OnTriggerEnter - a common approach is to do a raycast from where your object used to be last frame to where it is now for example, and get a normal from that

#

Or just do the raycast/boxcast/etc in FixedUpdate before a collision actually happens

sand field
#

I think I'm almost there, doesn't actually effect the object upon collision yet

private void OnCollisionEnter(Collision other)
{
    Rigidbody rb = GetComponent<Rigidbody>();
    Debug.Log(rb);
    Vector3 v3Velocity = rb.linearVelocity;
    Debug.Log(v3Velocity);
    transform.Rotate(Vector3.Reflect(v3Velocity, other.contacts[0].normal));
    Debug.Log("Rotated");
}
rocky wyvern
#

Cache the rb btw don’t want to get component when you don’t have to

cinder crag
#

so i got a small problem with my sound , sometimes when i slam and then jump afterwards , when i land , the slam sound plays again for some reason and im not sure what causes it

golden notch
#

is it possible to have images and stuff in a input box?

rocky wyvern
#

Won’t break anything

golden notch
#

like will it be inline with the text?

rocky wyvern
#

Depends where you put it

#

What do you mean by have images in an input box you just want to display an image there right?

golden notch
#

i'll keep working and see if i have a better question

#

actually i have one, how do i clip a sibling, like for a scrollable container?

rocky wyvern
rocky wyvern
cinder crag
rocky wyvern
#

Well, calculate the slam strength on anything

#

If it’s closer than the floor

sand field
#

Okay, now at least the balls react to the collision, but they keep trying to go the same direction

private void OnCollisionEnter(Collision other)
{
    Debug.Log("tforward" + transform.forward);
    transform.Rotate(Vector3.Reflect(transform.forward, other.contacts[0].normal));
    Debug.Log("normal: " + other.contacts[0].normal);
    //Debug.Log("Rotated");
}
wintry quarry
#

Rotate takes an euler angles vector

#

And it's also additive

#

Perhaps you want transform.forward = Vector3.Reflect(....)

sand field
#

Thanks a bunch

#

Literally all that I found on google was like 20 lines long

rocky wyvern
#

It’s normally something you’d probably just use physics for so

cinder crag
#

im trying to make the slam knockback objects with a rigidbody but for some reason , it doesnt knock back anything which is weird i guess

sterile radish
#

how can i make an audiosource play a sound on collision without it playing the sound a lot of times due to collisions triggering multiple times

tall delta
# sterile radish how can i make an audiosource play a sound on collision without it playing the s...

you have to add some type of 'gate', there are many ways to do it, but a bool probably be the easiest if you need it to play once and only once

eg.

bool hasPlayedSound = false;

void OnCollision() {
  if(hasPlayedSound == false) {
    sound.Play();
    hasPlayedSound = true;
  }
}

or a timer

float waitTime = 5f;
float counter = 0;

void Update() {
  counter -= Time.deltaTime;
}

void OnCollision() {
  if(counter <= 0) {
    sound.Play();
    counter = waitTime;
  }
}
rocky wyvern
#

But your last raycast is weird

#

Is it meant to be a not?

#

I assume you’re trying to check for los?

tall delta
rocky wyvern
#

Ah I got it the wrong way round

tall delta
rocky wyvern
tall delta
rocky wyvern
#

He has maxhits field so

tall delta
teal viper
# hushed ridge yes..?

No. They often bounce off(depending on the hit angle and the surface material). The only case where they might stop immediately is if they break the surface and get stuck somewhere inside.
The latter is not a common feature in game engines, so all you have is bouncing.

tall delta
# hushed ridge yes..?

to address the question, seem like you just have to increase the linear and angular damping on the bullet rigidbody.

cinder crag
#

i forgot

golden notch
#

i randomly started getting this error

UnityEngine.Input.get_mousePosition () (at <0b0249d5e61a446b913cd2910a5a40f5>:0)
UnityEngine.UI.MultipleDisplayUtilities.GetMousePositionRelativeToMainDisplayResolution () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/MultipleDisplayUtilities.cs:40)
UnityEngine.EventSystems.BaseInput.get_mousePosition () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/BaseInput.cs:75)
UnityEngine.EventSystems.StandaloneInputModule.UpdateModule () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/InputModules/StandaloneInputModule.cs:183)
UnityEngine.EventSystems.EventSystem.TickModules () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:331)
UnityEngine.EventSystems.EventSystem.Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:344)
polar acorn
golden notch
#

i mean i have a UnityEngine.InputSystem but i don't know where this issue is happening at

polar acorn
#

Looks like the EventSystem

golden notch
#

oh

#

ok so when i made the 2d Canvas it made an EventSystem object

#

do i delete it or something?

polar acorn
#

Are you intending to ever interact with anything on that canvas or is it purely visual

golden notch
#

intend to interact

polar acorn
#

Then deleting the thing that lets you interact with the canvases would probably be a bad idea. If you select it there should be a button that lets you add the Input System module to it

golden notch
#

i see it now

#

thanks

#

is it possible for canvas mode to snap to a grid?

#

i can't set the text anymore of any of my input components

#

i can set the placeholder though

polar acorn
#

Is the variable of type Text or TMP_Text, and are you trying to drag in a TextMeshPro object or a Legacy Text object

golden notch
#

Text, and no

polar acorn
#

Text is Legacy Text. What object are you trying to drag in

golden notch
#

not dragging anything in i just used the input ui object

#

and it was working and now it's not

#

no errors

polar acorn
#

Ah, so when you say "can't set the text" you mean you can't change it in-game?

golden notch
#

i can't change it in the editor

polar acorn
#

Is it just frozen at a specific value or is it getting reset when you hit play?

golden notch
#

it just doesn't do anything, when i defocus from the field in the inspector, the text just vanishes, and it never shows on the scene editor

polar acorn
#

Show a screenshot of the inspector of the object you're editing

rocky wyvern
#

Are you sure ur editing the placeholder text and not the text that’s meant to change when the user types in it

golden notch
#

im trying to edit the text text

polar acorn
golden notch
#

it's read only but selectable

#

restarted and it still doesn't work

polar acorn
# golden notch

Yeah don't change that one. That's going to get set by the input field

#

Change the text on the input field

rocky wyvern
#

Yeah you are editing the one that the player is meant to type in

#

Btw do yourself a favour and just import tmpro

golden notch
#

what's that?

polar acorn
#

TextMeshPro - the thing you should be using whenever you're doing anything with UI

rocky wyvern
#

Text mesh pro package

polar acorn
#

there is no reason to use Legacy Text any more

rocky wyvern
#

It’s standard

#

Just better text component

golden notch
#

this one?

polar acorn
#

Yes, use that one

golden notch
#

aight

polar acorn
#

Use the TextMeshPro versions of everything when it's an option

golden notch
#

including images?

polar acorn
#

Do you see an Image - TextMeshPro option?

golden notch
#

oh

#

now it's happening with those

#

one time it worked

#

and now it just refuses to allow me to manually change the "Text" area

polar acorn
#

Edit the text value on the input component

#

not the text object

golden notch
#

oh i see now

#

(Slams face on desk)

#

what's Multiline Submit?

golden notch
#

is there a way i can mask out the inner portion of a panel so it is transparent and have rounded borders?

polar acorn
#

Use a sprite that looks like that

golden notch
#

i think i found a bug

#

emojis do not show up at all (not even the black outlined emojis for regular text style) in a text area in the inspector

#

they do show in the editor though

sour fulcrum
#

Your chosen font might not support them (?)

golden notch
#

the font of the Unity editor itself?

prime cobalt
#

Hey how could I get ui elements tied to locations in the world working with splitscreen? Normally I just use world to screen but that doesn't really work with there being two smaller render textures.

nimble apex
#

legacy UI is meh , if i ever have textmeshpro i would ensure its tmp

twin pivot
#

but also i am still a beginner so theres probably a better solution

teal viper
prime cobalt
#

Ok I may be dumb but what math? Like it makes sense on the surface for it to be like dividing it by the size of the render texture and then offsetting it by the distance of the render texture from the center of the screen but the screen itself isn't the same size as the splitscreen areas

teal viper
#

The top screen should work as is

#

Unless I'm missing something. Need to test and see the numbers. Debugging

prime cobalt
#

The screen itself, at least in this example, is 3440 x 1440 but the splitscreen segments are actually a slightly different ratio since they're 2000 x 700 so I think the resolution ratio wouldn't translate right to the UI.

teal viper
#

Otherwise you're gonna get blurry image.

#

Or other artefacts, like aliasing.

prime cobalt
#

I had them at that resolution but it absolutely killed the framerate. Probably since there's 3 cameras in total all rendering at once. c_suisad

teal viper
#

Then, when you use world to screen, it should return the position in that render texture space. The x should align with the full screen. The only difference is the y.

prime cobalt
#

Hmm ok.

teal viper
#

What you're doing now is basically a primitive version of "upscaling" and there are various techniques for that, like FSR or DLSS. I think unity implements some of them.

stark oasis
#

Hey y'all, still learning C#. Found my way to Microsoft's modules.

I have a simple script here that isn't making sense to me.

int fahrenheit = 94;

fahrenheit = fahrenheit - 32;
decimal result = fahrenheit * (5 / 9);

Console.WriteLine("The temperature is " + result);

The console is reading 0, any advice?

#

Ah duh, I'm missing the m. lol

somber radish
stark oasis
#

For the (5 / 9)

#

should be (5m / 9) or (5 / 9m)

#

for decimal.

somber radish
stark oasis
#

It's a data type.

#

Like for example, you have floats, doubles, decimals.

somber radish
#

but f - is float
what is m?

stark oasis
#

decimal.

somber radish
#

ah got it, thanks

stark oasis
#

It's more precise double, not usually talked about it seems

#

since this is the first time ive heard of it through the MOS modules

somber radish
#

if you dont add m, the result is main part from division

#

and its 0 for 5/9

stark oasis
#

Yeah, and it can't express a decimal because I'm trying to divide integers

#

Just an oversight haha

nimble apex
#

in C# or C++ , adding an alphabet behind numbers have meanings

stark oasis
#

Yes, ik, it was just an oversight that I forgot to add and I was scratching my head wondering why console was giving 0

#

like a missed semicolon xd

nimble apex
#

but i dont think u need decimal level of accuracy lol

#

thats even stronger than float

#

or double

stark oasis
#

No, but for this particular module it asks for the end result of the script to be: 34.444444444444444444444444447

#

and instead of counting the repeating decimal, I just played it safe so it was satisfactory

nimble apex
stark oasis
#

lol

somber radish
nimble apex
#

the only font i will use is arial lol

#

if it involves chinese i will use notosans, cuz arial cant process that well

somber radish
nimble apex
#

cuz it works and widely accepted

#

thats all

somber radish
nimble apex
#

good question, idk

#

default fonts for rider?

somber radish
nimble apex
#

i just use it as it is bruh

rotund crown
#

hm, getcomponent<> is fine because it's retrieving a component on the object right
but gameobject.find() is searching through all (sibling?) objects for one with that exact name right? isn't that resource intensive

teal viper
sour fulcrum
#

Can I define a constructor for an enum or will I need a little base class to wrap around it

nimble apex
rotund crown
#

hooyea i'm just surprised the tutorials are saying to use .find() so frequently and without disclaimer
glad my intuition is good

nimble apex
#

using .Find is just easy and lazy

#

tutorial expects u to follow every steps, so if u named ur objects the same way .Find will work and tutorial itself will work

rotund crown
#

so no object.direction_to(object) function or anything like that huh
hehe i'm gonna be launching projectiles backwards so often

sour fulcrum
#

transform.LookAt() ?

nimble apex
#

lookat

rotund crown
#

so coroutines are declared like a function, but with IEnumerator instead of private/public void
i assume yield tells it to wait for the WaitForSeconds to finish, but what is the return doing?

keen owl
rotund crown
#

what does returning a new instance of waitforseconds do here?
i assume the purpose of this coroutine is just to delay the toggle of hasPowerup by 7 seconds, is returning a waitforseconds necessary to achieve this?

teal viper
rotund crown
#

or could you just like call start on

void powerupCountdownRoutine(){
   new WaitForSeconds(7):
   X = false;}```
nimble apex
#

void Awake is private void Awake

rotund crown
teal viper
#

You can also use timers in update to implement the logic

rotund crown
#

so i guess how i'd want to do it, declare a new timer, and have that timer call a function once it's done

teal viper
rotund crown
#

hehe seems like i cant do what i did in godot, i had a dozen tiny await's that let me fine tune the timings of attacks for the best gamefeel

nimble apex
#

intrinsic functions like invoke/coroutine is easier to setup, u can also do custom timer function

rotund crown
#

which was bad practice admittedly

nimble apex
#

and yeah, unity uses C#

teal viper
#

Or in an async method

nimble apex
#

wait async is upgraded in unity 6?

rotund crown
#

okay so the yield return is just standard practice for coroutines i suppose

nimble apex
#

yes

rotund crown
#

still dont entirely wrap my brain around it but it doesnt matter to me immediately, and hopefully once it becomes relevant i'll figure it out

rotund crown
#

what is torque?

#

like resistance to friction and gravity torque?

slender nymph
#

torque is rotational force

rotund crown
#

oh okay

#

how would the while (true) be set to false?

slender nymph
#

it wouldn't

rotund crown
#

ah they updated it two lessons later

#

is OnMouseDown() a special unity function that detects when mousedown is pressed while hovering over the gameobject?

slender nymph
#

you know google exists, right?

rotund crown
#

hom fair point, i think i started figuring it out mid ask
i was thinking of onInputDown and thinking that this would just trigger on every mouse press

#

but it's a function

#

hm, i went to the unity docs and saw that it's a special event that's added to any gameobject with a collider

#

but when i went to the collider page on the docs, i didnt see it mention OnMouseDown()

slender nymph
#

because it is not a method on the Collider class, it is a method on MonoBehaviour

rotund crown
#

ah okay time to go search for useful events and methods yay

mental rock
#

What is the typical method for doing auto-stepping with 2d kinematic rigidbodies?

I've been trying an algorithm that fires a raycast ahead of the player and if it detects an obstacle, it'll fire a raycast above, if it detects an obstacle again, the cycle repeat. If it doesn't find an obstacle then it places the player there.

The issue is that this always feels very staggered and janky, and also suffers from the problem of the player getting stuck on miniscule heights as the initial detection raycast has to be judt above the ground or else it'll keep detecting the ground, so I was wondering if there was a standard way of implementing this.

tired garden
#

Hello, I'm a beginner on unity and I wanted to know if velocity and linearVelocity are the same thing? For example, when I write rb.velocity, the software modifies it directly to rb.linearVelocity (whereas on the tutorials I'm looking at it's rb.velocity).

charred spoke
#

linearVelocity is the new name yea

tired garden
proper tree
#

hey there, a cousin of mine wants to start learning game making in unity and I am not really the best teacher, so will any of you guys gimme good recommendations for him?
Thanks Again!

eternal falconBOT
#

:teacher: Unity Learn ↗

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

proper tree
naive pawn
#

well can't really help with that

#

gamedev is a skill you have to build up over time

proper tree
#

I personally believe that he wont have the dedication and will to do so:)

naive pawn
#

consider suggesting something simpler then

proper tree
proper tree
#

tysm man

twin pivot
#

Not sure if this is the right channel but how do you get the transform of the camera

#

Wait i can just use tmp nvm

queen adder
rocky wyvern
lapis yew
rocky wyvern
#

If you want to implement yourself I would recommend just raycast forward to find obstacle

#

Than raycast down to find height

#

Don’t really need to recur

#

If by staggered and janky you mean the teleporting is bad then just use ramps

#

So many games use it for a reason

mental rock
mental rock
rocky wyvern
#

Then your raycast is too high

mental rock
#

Unless you mean cast forward, and then downwards and then check for the obstacle?

rocky wyvern
#

Does your character controller have physics

#

Or is it kinematic

mental rock
mental rock
mental rock
rocky wyvern
#

If it hits something

#

Anything

#

Doesn’t matter if it’s the floor

#

Your char is MEANT to autostep

lapis yew
#

raycast in the direction youre moving,
set its height via a variable
set its length to the step length
if the raycast detects nothing then youre good, otherwise move up

rocky wyvern
#

What do you mean false flag

mental rock
rocky wyvern
#

Is it really important to your game that your character move up 0.01 units when he walks on a grain of sand?

mental rock
serene cosmos
#

hii on line 55, i have an error where it says i need a } but i have one already, i have another issue where my Destroy(gameObject) does not work as it says theres no reference and was wondering how i could fix this

rocky wyvern
#

Is there a reason you aren’t using physics

mental rock
mental rock
#

It was unsightly since its on a small scale

rocky wyvern
mental rock
#

I know you can change it but it stopped working properly

north kiln
eternal falconBOT
mental rock
#

I think casting a ray forward from the max step height and then casting down to detect an obstacle will work, right

#

Sounds like it would

rocky wyvern
#

Would but you don’t want to raycast if you don’t have to

mental rock
#

Is it really that expensive

rocky wyvern
#

Trust me it isn’t worth it

#

If it bothers you you can increase the visual size of your char by the skin width

mental rock
#

Not sure what you mean but I'm having (decent) success with kinematic as of now except this smoothstep lol

#

The biggest issue tight now is that the players velocity keeps getting zeroed when autostepping since they technically collide with a wall and slow down as a result so the movement on steps is very staggered

rocky wyvern
#

Just make sure to use nonalloc

rocky wyvern
#

Colliding with the side of a floor or the top of a wall is your worst nightmare

#

If you will have any sharp edged verticality

serene cosmos
serene cosmos
nimble apex
#

and do configure it

#

by the look of it , seems like rider

queen adder
#

I'm following a tutorial on Unity's page. The code seems easy now. : )

twin pivot
#

ignore the fact that leftClick is y

twin pivot
sharp bloom
#

Does anyone know why this line always returns 0 on Android build?

#

It works as expected in simulator and Unity remote

wraith shuttle
#

Is it ok to not use player controller script and use transform.translate(yk the horizontal and vertical after )

verbal dome
sharp bloom
#

Depends. I wouldn't use transform.translate with physics

wraith shuttle
#

I would probably learn the player controller cuz yk unity learn make only transform.translate for some reason

#

In the pathway

polar acorn
#

Physics based movement probably comes later

wraith shuttle
polar acorn
#

Hence why they don't cover it.

wraith shuttle
#

I can be wrong but till now and after searching in the future units they don't cover it

polar acorn
#

To be more precise - I believe they intentionally picked projects that don't require physics so that they don't have to introduce physics based movement too early

wraith shuttle
#

But there is a good tut that learnt me AI and stuff (roll the ball )

wraith shuttle
#

Like tbh roll the ball tut made me learn alot on how to build and how to use nav map and how to make a count system and using TxPro smth like that

tawny ermine
lean pelican
#

I want to have a tile smoothly rotate 90° around the z-axis over a set duration (0.5 seconds) when clicked. How do I do that? (I know it has to be a Coroutine, but I can't wrap my head around Quaternions and Euler angles.)

wintry quarry
#

One option is to use a tween library
Otherwise you would use Slerp or RotateTowards in a loop in a coroutine

#

or just set a target rotation and rotate towards it in update

#

for example:

float rotateSpeed;
Quaternion targetRotation;

// You need to call this somehow when it's clicked
public void WhenClicked() {
  float amountToRotate = 90;
  float duration = 0.5f;
  targetRotation = transform.rotation * Quaternion.Euler(0, 0, amountToRotate);
  float rotateSpeed = amountToRotate / duration;
}

void Update() {
  transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotateSpeed * Time.deltaTime);
}```
#

There are ultimately many ways to do it

#

the exact right thing to use depends on your project and your existing code

grand snow
#

looks good to me bar the rotation being applied always in update even if done

wintry quarry
#

It's also not clear exactly what a "tile" is in this context

lean pelican
wintry quarry
#

if it's a GameObject, this is fine.
If it's a tile in a TileMap, things are a little different

lean pelican
#

A GameObject.

wintry quarry
#

If there are a huge number of these things, it indeed might be better to go with a coroutine rather than using Update.

#

or a tweener

lean pelican
#

There's a 2-digit amount, but only one can be clicked and rotate at the same time.

#

It's for a puzzle game of correctly aligning pipe pieces.

wary glade
#

Has anyone worked with the quest 2 that can help me?

wintry quarry
# lean pelican There's a 2-digit amount, but only one can be clicked and rotate at the same tim...

a coroutine version would look something like:

void DoRotation() {
  StartCoroutine(RotateOverTime(90, 0.5f));
}

IEnumerator RotateOverTime(float amountToRotate, float duration) {
  Quaternion targetRot = transform.rotation * Quaternion.Euler(0, 0, amountToRotate);
  Quaternion startRot = transform.rotation;
  float timer = 0;
  while (timer < duration) {
    timer += Time.deltaTime;
    float t = timer / duration;
    transform.rotation = Quaternion.Slerp(startRot, targetRot, t);
    yield return null;
  }
}```
rapid thunder
#

guys i need help with the movement code

rapid thunder
#

and when i paste the script for movement it actually moves

#

but not in straight line mine is jumping lol

wintry quarry
#

You would have to show your code and maybe a video - and explain how things are set up

rapid thunder
wintry quarry
#

So what do you mean by "jumping" exactly

#

I kinda meant a video of your issue

rapid thunder
#

here it is

rapid thunder
#

like before unity learn i tried multiple tuto for movement but i couldnt manage to make them walk

wintry quarry
#

Did the tutorial ask you to do that?

#

I would guess it has a collider already

#

As you can see - the collider you added is clipping through the ground

#

so that explains why your object jumps into the air at the start of the game

#

Yeah you can see the green framework looking stuff around the actual cylinder - that's probably the existing MeshCollider that the object already had

rapid thunder
wintry quarry
tribal fulcrum
#

is this error code related?

#

if so what can i do to fix this

polar acorn
twin pivot
#

could someone give me an example of how the InstantiateParameters parameters work

#

i dont really understand what that means

twin pivot
#

yes and i still dont understand what the last parameter is supposed to represent

wintry quarry
#

The docs describe it

twin pivot
#

is it just any parameter?

naive pawn
#

no, it's that specific type

wintry quarry
twin pivot
#

ive read it 3 times now but i still dont quite get it

wintry quarry
#

The docs are pretty straightforward. You can see it's a struct defined in the UnityEngine namespace, and it has 3 properties:

  • parent
  • scene
  • worldSpace
#

you can even click on each property to see what it does

twin pivot
#

no i know what the properties are

naive pawn
#

it's a combination of those 3 values, into a single parameter

twin pivot
#

i just dont know how one would use it

wintry quarry
#

So I'm having trouble understanding where your confusion comes from

wintry quarry
#

you would use it as a parameter to Instantiate just like it shows

hexed terrace
#

It's a type used to hold some data, making it easier to re-use the same values without having to keep typing the same 3 things

wintry quarry
#

Maybe you're confused about how structs, classes, and parameters work in general?

naive pawn
#
Instantiate(obj, new InstantiateParameters() { parent = parentTransform });
twin pivot
#

oh i see

wintry quarry
#

it's no different from the Vector3 position parameter, for example

twin pivot
#

hold on lemme see if my understanding is correct

wintry quarry
#

just a struct holding some data

hasty adder
#

does anyone here know tf is going on? im returning to the original MR template but it doesnt work anymore???? i need it because apparently you cant use building blocks to: have a cube with physics and have it use the room scan - also the room scan block sometimes displays sideways room scans so i need this template

#

where would said prefab be so i can get it from the template and fix it.

hexed terrace
twin pivot
hexed terrace
#

You don't need it, you can instantiate without it (I didn't know this type existed until now). You could just ignore it and carry on - return to trying to understand it when you've got more experience

polar acorn
twin pivot
polar acorn
wintry quarry
twin pivot
#

but _pointerParent and its child kept taking on the size of the gameObject

wintry quarry
hexed terrace
#

gameObject.transform is the same as just transform.. and they're both THIS gameobject/transform (where this component is attached)

wintry quarry
#

which object are you trying to clone and which object do you want the clone to be a child of?

wintry quarry
#

ok then that's correct

#

yes a child object will take on the scale of its parent

twin pivot
#

but avoiding that

wintry quarry
#

if you don't want things to be scaled that way, you need to fix your hierarchy so your parent object(s) are not scaled.

twin pivot
#

oh my god i thought the gameObject was at (1,1,1) scale the entire time

#

thanks for the help

green copper
#

in cases where I have number of variables like this, my general process is to take a screenshot so I can remember what they're called when I'm working on a function ~100 lines down in a long file. Winkey/shift/s is just the fastest way I know to put the information on screen and keep it there.

is there a way to pin them or something in VS?

Googling mostly gives results about how to keep an eye on their values for debugging, that's not what I need

naive pawn
polar acorn
#

Like, if these were named ConvoQueueIncoming, ConvoQueueOutgoing, and ConvoArchive, you could just do .Conv and see them all in suggestions

green copper
#

Thanks for the tip!

rotund crown
#

why is spacesArray null?

polar acorn
rotund crown
#

hm, well i was thinking i should declare the array, then have a function assign values to it

#

but i cant assign values to it because it is null

polar acorn
#

You can't assign values to null

#

You can assign values to an array, but you haven't created one

rotund crown
#

so i declared the array incorrectly?

naive pawn
#

you declared it correctly

#

maybe you wanted to initialize it too?

polar acorn
naive pawn
#

you would create an array with the size you want it to be

polar acorn
#

you have a perfectly declared variable that can hold an array of transforms.

#

you just haven't actually put an array of transforms into it

naive pawn
#

if you don't know what size you want it to be (which seems to be so since you're doing i++ in Start) you should use a list instead (and you still have to initialize that

#

also why are they static

#

that's not how they should be, and not how singletons work

rotund crown
#

yeah i realized static variables are more what i want here than a singleton, i just didnt rename the script

#

i figured i'd make it globally accessible so i dont have to get a reference to it since this is just a small practice project

#

ah i see, when i declare a variable, that remains as null, i have to immediately or later create a new value to assign to it

polar acorn
#

Yes, declaring and assigning are two different things.

#

Until you assign a value to a variable, it will remain default, which is null for anything that can be null

rotund crown
#

is there an equivalent to .Length but for lists?
i tried to find list on the unity docs but i couldnt seem to find it

polar acorn
#

Count

polar acorn
rotund crown
#

ahh so if i cant find it on the unity docs, check the C# docs, thaat explains a bit

rotund crown
#

how do i use a script to retrieve a child gameobject?
it looks like i can only retrieve components on child gameobjects

naive pawn
#

though do you need to? consider using serialized references instead

rotund crown
#

i was just thinking that

rotund crown
# naive pawn transform.Find, GetChild

well transform is a component of the gameobject right?
do i have to find the transform then use that to retrieve the gameobject that owns that transform?

naive pawn
#

no, transform.gameObject is a thing

#

and same for every other component

rotund crown
#

ah okay so like this

naive pawn
#

you could theoretically find "child with component X" by doing GetComponentInChildren<X>().gameObject

#

(but really you should probably just use serialized references)

rotund crown
#

getting children by component rather than by name does sound better

naive pawn
#

doing it statically in the inspector would generally be even better

rotund crown
#

mhm but i know how to do that, gotta try new things to learn
thank you~!

#

what is this warning me about?

rich adder
#

what does DiceButton do ?

eternal needle
rotund crown
#

mhm it's rider

brave compass
#

I usually get this when methods use Debug.Log. It’s not smart enough to know when it's rarely used.

rotund crown
#

okay so it's just a random warning and it's up to me whether it's founded
i put in the _buttonCooldown for a reason so i'm good

rich adder
#

its not a warning, its just rider information

rotund crown
#

this ide sure is nervous

rich adder
#

they had to add extra bells to make it worth the $

eternal needle
#

thats something id probably turn off lol

rotund crown
#

so many bells and whistles of questionable usefulness

shell sorrel
#

can turn most of that stuff off

#

some of it can be useful though

rotund crown
#

hm, are tweens difficult to do in unity? i tried looking up a tutorial on how to make a tween, and didnt really see one, and like 3 websites providing services (plugins?) to simplify tweening did pop up

#

oh and all the video guides are using one of those services heh (DoTween)

cosmic dagger
polar acorn
#

DOTween is probably the easiest and most robust library for tweening various values. For a long time, Unity had no tweening library, and what they have now, Timelines, is significantly more complex and less useful than DOTween

rotund crown
#

ohh lerps are probably what i'm thinking of when i think tween

#

yupyup

#

i guess the difference is tweens can have an arc

hasty adder
#

question: is there a way to get the unity 2022 ui in unity 6? i had to use unity 6 for the MR template but now the ui changed :(

hasty adder
#

:( i guess i have to use this ui just because i want MR multiplayer :/

rich adder
#

the editor UI would be the last thing I'd worry about..

hasty adder
#

idk if this is the correct channel but how could i test multiplayer if i have 2 devices?

#

i got 2 people too

frosty hound
#

Have you made your game multiplayer?

hasty adder
#

yeah i used the MR multiplayer template (im assuming this isnt ar talk)

#

because uh this is really multiplayer in general

hasty adder
#

yeah uhh i can build it

#

ok -

#

can i use unity 2022 android build tools with unity 6

#

cz i dont have 5 gb to blow on stuff i already have

brave robin
golden notch
#

how do i cancel a selection in a selection event function <Input Field>?
Attempting to select while already selecting an object.

hasty adder
naive pawn
#

yeah don't use genai for help lol

naive pawn
hasty adder
#

no i do need unity 2022

#

all of the storage i got is just basically steam :/

grand snow
#

you should be able to share it between i expect, ive done it all though android studio custom before and that was mostly stable

hasty adder
#

yeah but

#

i need to use unity 2022 android compiler

#

welp it might be time to get my 20th usb in a year soon

grand snow
#

or buy 1 decently sized drive?

polar acorn
hasty adder
#

no

#

its basically just gmod, mods, and p2

#

and i need those :/

golden notch
#

well idk how to use waittillendofframe to bypass the error, it still doesn't work. I need to deselect when someone selects the item, but if used in the same frame, i get an error

#

adding the eventdata parameter makes the function not even show up in the inspector

#

like this doesn't even show up anymore in the inspector when trying to add it

    {
        if (!mainChatFadeScript.currentlyVisible)
        {
            Debug.Log("Selected Item");
            eventData.selectedObject = null;
            //eventSystem.SetSelectedGameObject(null);
        }
    }```
tawny atlas
#

Is anyone interested in a virtual chemistry set?

golden notch
#

it has to be void apparetly with no parameters

naive pawn
tawny atlas
#

Not sure I understand? Are you real or some sort of bot?

naive pawn
naive pawn
#

this channel is for help with code

golden notch
naive pawn
tawny atlas
#

No. Why all the agression? I have produced a 3d version of the periodic table. Am happy to share, if anyone wants to play.

golden notch
naive pawn
#

please do read channel topics before posting

#

i see you're new to discord, so; most servers have rules that you have to read and agree to before interacting in the server. did you actually read the rules? #📖┃code-of-conduct

eternal needle
# golden notch

WaitForEndOfFrame or yield return null would have to be in a coroutine. Im not sure exactly what you're doing here, didnt see full context, but you could start a coroutine from this method

golden notch
rotund crown
#

what did i do wrong with my lerps?

north kiln
tawny atlas
#

Look. I am new to this. I am not selling anything. I have spent a long time trying to use the Unity game engine to create a virtual universe. If you are not interested, let it go. If you are, tell me what you need and I'll pass it on.

golden notch
north kiln
brave robin
tawny atlas
#

Daisy is definitely a Bot!

keen cargo
#

What?

golden notch
#

beep boop

keen cargo
#

What are you waffling about

north kiln
north kiln
rotund crown
#

so the value of t should be decreased from 1 to 0 over 14 seconds, and each call returns the value at the current t value, okay

tawny atlas
#

Contrivance is some sort of AI. Are there any real people out there?

keen cargo
#

Are you ok?

north kiln
brave robin
# rotund crown oh weird

So if you want your lerp to function over 14 seconds, you'll either need to set it up in update to keep track of a float value and increment it every frame with the time spent that frame, or do it in a coroutine or async method

tawny atlas
#

Ok. Had enough. If you're not interested, I'll try some other group. BYE!

brave robin
golden notch
#

If I post my progress like get a feature done here and there, is that proper use of devlog or do i need to wait until it's fully complete?

north kiln
polar acorn
#

This is a help channel

keen cargo
#

Yep i think that's one of the purposes for devlog

polar acorn
#

unless you have a question, you should not be posting in this channel

eternal needle
keen cargo
#

You're logging your progress yknow

golden notch
#

ahh

rotund crown
brave robin
rotund crown
#

mhm they seem pretty flexible

polar acorn
brave robin
# rotund crown mhm they seem pretty flexible

All the lerp does is figure out where something should be between A and B, if it is at T. So if T = 0.5, it will be halfway between A and B. 0.1 = 10% of the way from A to B. And so on

rapid thunder
#

does unity essentials tutorial enough for making simulator game with presets...

naive pawn
#

no, unity essentials are essentials

#

you'd need to learn a lot more to make a full game

polar acorn
#

they get you started, not finished

rotund crown
#

i love unstructured learning

rapid thunder
rapid thunder
naive pawn
#

then link them all together

rotund crown
#

but you might be different

polar acorn
rotund crown
#

regardless you'll want to start by learning the fundamentals, in my case i did iit by following a tutorial series on how to make a 2d topdown rpg
then i just built off of that

rapid thunder
#

well i just mean basic supermarket game just selling and stocking items just for now

keen cargo
#

We really can't tell you what you need to learm

rich adder
#

start with basics of c#

rapid thunder
#

and also i dont plan doing 2d stuff rn should i watch them

keen cargo
#

There's so much out there to learn that it will quite literally take them hours to list off all possible things you'd need to learn

rich adder
#

make a console app that manages some product items. Simple buy / sale logic

keen cargo
#

Also yes learning 2D is very useful

rapid thunder
#

okay thanks guys

tall delta
#

the skills will transfer 🙂

rapid thunder
rotund crown
#

hmm, i want to modify the width of a UI gameobject with a rectransform component
how should declare it in serialize field so i can access the recttransform property and edit it?

#

oh wait should i declare it as a gameobject and like getcomponent recttransform on it

polar acorn
#

use the component you actually want

#

.gameObject from a component is basically free.
.GetComponent() from a GameObject is slow as balls

brave robin
#

Only reason to declare a field of GameObject is if you only ever want to set it active or inactive

#

Or if its a prefab you're instantiating and don't need anything else

#

( might be more reasons, but not many )

rotund crown
#

why is it a 'temporary value' then?

brave robin
rotund crown
#

oh weiird i guess that works though

brave robin
rotund crown
#

so i have to make a new recttransform, copy over the properties of circleshrink, then change the width property, then assign that as the new value for circleshrink

polar acorn
tall delta
# rapid thunder so im just following all unity tutorials

not sure if you're being facetious. but my point is that: moving a character is moving a character, looking with the mouse is looking with the mouse, selling an item is selling an item. regardless of the game / genre. so there is no answer to the question "how do I make a supermarket simulator". what you need to do is break the game down in to small tangible mechanics (like looking with a mouse, clicking a button) than start to learn those things in small incremental steps as you slowly start building your project.

rotund crown
#

wait a minute
if circleShrink is only a copy of the actual rectTransform variable of the gameobject
how do i set the actual gameobject's rect?

brave robin
rotund crown
#

how do i set circleShrink's rect?

brave robin
#

circleShrink.rect = new Rect( .. values you want go here.. );

#

if you're only changing its width, you can copy the values from the existing rect for the other aspects

rotund crown
#

hm, it says it has no setter

north kiln
#

rect transforms are annoying

rotund crown
#

oo wait circleShrink.rect.set() seems interesting

north kiln
#

No

rotund crown
#

fair enough

north kiln
#

Use .sizeDelta

brave robin
#

ah, yes, it was sizeDelta. I forgot that rect is just a read only

north kiln
#

.rect is a property and Rect is a struct. Structs are copied by value, so any time you retrieve from the property a copy is made

#

so .Set would modify that copy and throw it away

brave robin
#

and yes, rect transform is annoying. I always need a refresher every time I dive back into them

brave robin
north kiln
#

Rect defines Set

rotund crown
#

okay so basically do what i did but instead of rect use sizedelta

north kiln
#

RectTransform defines rect and it only has a get

#

Pretty much. It has a lot of caveats though depending on how the rect transform is set up

#

It depends how the recttransform is anchored

brave robin
#

Ah, looked up Set(), yeah that would do nothing useful in this case, since again it's just modifying the copy from the property

rotund crown
#

there we go

#

no errors

#

yay it's working

north kiln
#

Note there's a Vector2.Lerp that could simplify this to practically one line

naive pawn
#

i don't think that would make it very readable

rotund crown
#

circleShrinkTime should decrease from 1 to 0 over 14 seconds right?

naive pawn
#

i think most direct (to logic) would be something like

float r = Mathf.Lerp(...);
circleShrink.sizeDelta = new Vector2(r, r) + circleShrink.sizeDelta;
rocky canyon
#

oh nvm im blind

rotund crown
#

hmmm, then why is it doing it over half a second

naive pawn
#

i feel like adding such small deltas could encounter floating-point issues, but probably not...

rotund crown
#

and i increased it to /140 and it was about 1 second

naive pawn
#

what does circleShrinkTime start as?

rotund crown
#

one

#

wait maybe it needs to be 1f
nope that wasnt it

mighty compass
#

Found this picture online, figured it would be useful for beginners

rotund crown
#

eh well that worked

naive pawn
polar acorn
mighty compass
rocky canyon
#

no, fixed update is independent of the update loop

mighty compass
rocky canyon
#

update loop runs as often as ur frame-rate..

#

fixed does not

rotund crown
#

does color.a have a range of 0-255 or a range of 0-1?

rocky canyon
#

0-1

naive pawn
mighty compass
naive pawn
#

and the diagram you showed doesn't indicate any sort of loop, so that kinda misses out

mighty compass
#

okay well im never using that website for unity help again

rotund crown
#

oh no, is this another sizedelta vs rect situation
how do i set color

mighty compass
#

I dont even remember where I got it from

rocky canyon
#

but leaves out lots of detail about the FixedUpdate and stuf

mighty compass
#

I c'

rocky canyon
#

the one from the Unity Docs is lot better

naive pawn
eager elm
naive pawn
rocky canyon
#
moddedColor.a = desiredValue;
img.color = moddedColor;```
rocky canyon
#

lol

naive pawn
#

col is for column ANGRY

rocky canyon
naive pawn
#

-# col is for colander

polar acorn
#

col is for collisseum! Get that Dizana's Quiver!

mint saffron
#

hi

#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using Ink.Runtime;

public class DialogueManager : MonoBehaviour
{

[Header("Dialogue UI")]

[SerializeField] private GameObject dialoguePanel;


[SerializeField] private TextMeshProUGUI dialogueText;

private Story currentStory;

public bool dialogueIsPlaying { get; private set; }

private static DialogueManager instance;

void Awake()
{
    if (instance != null)
    {
        Debug.Log("no");
    }
    instance = this;
}

public static DialogueManager GetInstance()
{
    return instance;
}

private void Start()
{
    dialogueIsPlaying = false;
    dialoguePanel.SetActive(false);
}

void Update()
{
    if (!dialogueIsPlaying)
    {
        return;
    }

    if (Input.GetKeyDown(KeyCode.E))
    {
        ContinueStory();
    }
}

public void EnterDialogueMode(TextAsset inkJSON)
{
    currentStory = new Story(inkJSON.text);
    dialogueIsPlaying = true;
    dialoguePanel.SetActive(true);
    ContinueStory();

}

private void ExitDialogueMode()
{
    Debug.Log("imate pravo");
    dialoguePanel.SetActive(false);
    dialogueIsPlaying = false;
    dialogueText.text = "";
}

private void ContinueStory()
{
    if (currentStory.canContinue)
    {
        dialogueText.text = currentStory.Continue();
    }
    else if (currentStory.canContinue)
    {
        ExitDialogueMode();
        Debug.Log("imate pravo jos jednom");
    }
}

}

#

sorry idk how to send script files

#

but anyway

polar acorn
#

!code

eternal falconBOT
mint saffron
#

im using ink and does anyone know why it only says one line

#

and wont end the dialogue and continue to next line

#

i think i made the code pretty obvious

rotund crown
#

hm, why is playerObject.Transform destroyed?

#

on game startup it works fine, but when i transition to another scene and then back, it says it has been destroyed

quick pollen
#

maybe you create it on start?

rotund crown
#

nope the playerobject is just part of the scene, and is never deleted

quick pollen
#

tbf you shouldnt be using Find in the first place

polar acorn
rotund crown
#

i know, but i'm just doing it for debug reasons in this case

polar acorn
#

Considering the usage of Singleton in this snippet, you probably have something DontDestroyOnLoad, so it's referencing an object in a scene that no longer exists

rotund crown
#

ah you're right maybe it's talking about that space's transform

#

can i make that variable accessible by other functions without making it static?
(so it gets re-initialized on scene load)

polar acorn
#

You could just get a reference to the object normally instead of it being a singleton

rotund crown
#

heh it's not even a singleton i just called it that, yeah that should work

golden notch
#

inputText = GameObject.Find("Chat Input (TMP)").GetComponent<TextMeshPro>(); is returning null, I have deugged and checked that GameObject.Find("Chat Input (TMP)") is correct and not null. What is going on here?

rich adder
#

also you should not be searching for components like this (GameObject.Find)

golden notch
rich adder
#

most textmesh pro you should use is TMP_ prefixed
text is just TMP_Text that works for UI and mesh version

golden notch
#

thanks, i didn't know that

#

so i'm supposed to have it as a public variable at the top and assign it in the inspector?

rich adder
#

ideally

golden notch
#

aight

rich adder
#

there are occasions where you'd use runtime search method / singletons etc.

golden notch
#

is there a way to hide a public variable from the inspector?

grand snow
#

it is STILL SERIALIZED EVEN WHEN HIDDEN

#

[NonSerialized] will hide AND not serialize it

#

i shout cus its easy to forget and get fucked by it later 😆

rich adder
#

its rare you should use public though. Use properties for public gets and private vars
inspector for private is[SerializeField] private to avoid using public as default for inspector

sand field
#

So I'm following Unity's own tutorials right now, and I am in Unit 3. The lesson is making a jumping minigame using the AddForce method, and my code and the settings in the inspector are EXACTLY the same from what I see, but when I play the game the character flies way off into the sky, meanwhile the video's character does a normal jump.
First image is my code, second is the video's.

eternal falconBOT
sand field
# rich adder code 👇 https://discord.com/channels/489222168727519232/497874004401586176/13650...
public class PlayerController : MonoBehaviour
{
    private Rigidbody playerRb;
    public float jumpForce = 10f;
    public float gravityModifier;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        playerRb = GetComponent<Rigidbody>();
        Physics.gravity *= gravityModifier;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Space))
        {
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }
    }
}
rich adder
rich adder
#

look at the input getting method 😉

sand field
rich adder
#

its basically jumping every frame you press/hold it, as opposed to GetKeyDown which only runs in 1 frame

sand field
#

Thank you

golden notch
#
    {
        if (currentlyVisible)
        {
            fading = true;
            deltaTime = Time.time;
            if (fadeChildrenWithScript)
            {
                foreach (SimpleFadeScript fader in GetComponentsInChildren<SimpleFadeScript>())
                {
                    Debug.Log("why are you stack overflowing?" + gameObject.name);
                    fader.closeWindow();
                }
            }
        }
    }```
`fader.closeWindow();` is causig a stack overflow, and it seems that GetComponentsInChildren gets the root object as well, how do i avoid that?
rich adder
#

recursive calls are pretty dangerous if there isn't a way to exit gracefully

rotund crown
#

can anybody recommend an example 3d project i can download so i can look through it and see how things like meshes, materials, and scripts are incorporated?

rich adder
#

each person / team does their own system, its all very specific

rotund crown
#

just any publicly available one, i'm aware that there's alot of self expression in script but seeing how they did things provides a helpful perspective regardless

rich adder
#

idk the usual places like github, unity asset store, blog sites etc

rotund crown
#

mmkay i'll have a looksee

rapid thunder
#

there are no version 6 is it a problem ? can i do it

rich adder
golden notch
sour fulcrum
#

In fairness the GetComponentsInChildren() function name is a little misleading with how it includes the parent

golden notch
#

yes yes

rich adder
golden notch
#

hmm i could do that yes and then i might not need to put those fade scripts everywhere

rich adder
golden notch
#

Hmmm... i'd need to store more data for each one, the targetAlpha numbers will be different for each item

#

already doing that tbh, just had to make new fade scripts for each one

rich adder
#

thats fine for the component to be there, its just easier to have a "mediator" you access to do further things instead of accessing children directly

golden notch
#

so like two scripts? one for main logic and one for crutial settings per object?

rich adder
#

so like you would call closeWindow() on a the parent, then that script handles the SimpleFadeScript() on its own from there, like closing or whatver else

#

unless the closeWindow is already on the parent then nvm , just use Serialized array instead of GetComponentInChildren
[SerializeField] private SimpleFadeScript[] simpleFades

golden notch
#

yeah i'm working on that atm

#

i might still need the fader scripts on all the objects since i am calling .closeWindow() on all of them

sour fulcrum
#

yeah thats fine

#

just get into the habit of trying to avoid acknowleding any parent/child relationships when it comes to code

#

its worth remembering that c# was designed for itself and Unity is just something that uses it, so a lot of the ideal logic and workflow is designed for class to class conversations without all the gameobject shenanigans

#

Having 1 class control/manage a given group of """worker""" classes is really common too, not just in this example

#

very similar to how a business or store might have a manager in a department with many employees

golden notch
#

how do i change this to the one with the add button?

sour fulcrum
#

Array is fixed size, List is dynamic

rich adder
grand snow
#

wha no an array can be any size when editied in the inspector

#

somehow the drawer is broken?

golden notch
#

List<GameObject>

rich adder
#

yea both array and list should have +/-

#

this could be a bug on Drawer

grand snow
#

do you have some custom inspector gui for this mono?

earnest wind
#

i dont understand for some reason either my code got cursed or i made a grave mistake somewhere please help

public void SettingOpen(string Name, string Description, string ExtensionName)
    {
        SettingNameText.text = Name;
        SettingDescription.text = Description;

        UpscalingFilter.gameObject.SetActive(false);
        MinMaxFPSAndPing.gameObject.SetActive(false);
        AutoColorFpsAndPing.gameObject.SetActive(false);
        BackroomsAutomaticRenderDistance.gameObject.SetActive(false);
        switch (ExtensionName)
        {
            case "UpscalingFilter":
                UpscalingFilter.gameObject.SetActive(true);
                break;
            case "MinMaxFPSAndPing&AutoColorFpsAndPing":
                MinMaxFPSAndPing.gameObject.SetActive(true);
                AutoColorFpsAndPing.gameObject.SetActive(true);
                break;
            case "BackroomsAutomaticRenderDistance":
                BackroomsAutomaticRenderDistance.gameObject.SetActive(true);
                break;
        }
    }

BackroomsAutomaticRenderDistance does neither become On or Off, why? like when this void gets called and lets say its case UpscalingFilter then UpscalingFilter gets on, and when its something else, the upscaling filter with everything else goes off too?

eternal falconBOT
earnest wind
# twin pivot !code

i mean yeah the code is kinda big but i can simplify it to remove the things that arent important so its easier to understand

#

also it gets called by other script, but the fact that it gets called, everything is working, but that object just doesnt set off or on is weird

earnest wind
#

because it is assigned in editor

earnest wind
teal viper
grand snow
earnest wind
#

the last object

#

but the other objects get disabled

#

AutoColorFpsAndPing gets disabled for example

#

BackroomsAutomaticRenderDistance doesnt

teal viper
#

Also log the name of the object with the object passed as a second parameter:
DebugLog("BARD deactivated", BackroomsAutomaticBlabla);

earnest wind
#

okay so this line at the end of the code gets activated every time

teal viper
#

Then click the log message to see what it select.

earnest wind
#

why, thats so weird

teal viper
#

A breakpoint?

earnest wind
teal viper
#

Then that case is true🤷‍♂️

#

There's no other way it would run that line.

earnest wind
#

thats really weird honestly

teal viper
earnest wind
teal viper
#

What's gone?

earnest wind
#

this is really weird honestly

earnest wind
#

only on that case

#

and e never goes off. never prints

golden notch
#

how do i get a list to show up with this in the inspector?

teal viper
teal viper
earnest wind
keen cargo
#

don't think if statements would help here

teal viper
earnest wind
#

let me check

#

the bug went away

teal viper
earnest wind
#

what the hell...

#

when i deleted the "e" case it just went away

#

so im on the same code when i encountered the problem, but no more problem

#

thats so weird..

teal viper
#

Make sure your !ide is configured correctly. That would make it less likely to happen.

eternal falconBOT
golden notch
#

i think imma backtrack and use te get element children

#

idk, it's already difficult to assign multiple things

grand snow
golden notch
#
You probably need to assign the additionalFaders variable of the SimpleFadeScript script in the inspector.
UnityEngine.GameObject.GetComponent[T] () (at <028e4d71153d4ed5ac6bee0dfc08aa3b>:0)
SimpleFadeScript.closeWindow () (at Assets/SimpleFadeScript.cs:78)
SimpleFadeScript.closeWindow () (at Assets/SimpleFadeScript.cs:78)
UIChatBoxHandler.Start () (at Assets/Scripts/User Interface/UIChatBoxHandler.cs:42)```
But it IS in the inspector, and it IS assigned as a new entity, why is this doing this?
#

it only seems to happen on one of the scripts

north kiln
#

Check every script of that type in the scene by searching it

golden notch
#

i double clicked th error and it sent me to the main script on te shatbox window

teal viper
golden notch
#

yeah it looks like the main one

north kiln
golden notch
#

yes

north kiln
#

additionalFaders is an array?
I didn't expect it to report the error you're seeing

rotund crown
#

what is this syntax? what are ? and : doing

north kiln
rotund crown
#

ah i see so it returns the first one if the first rand is 0, else it returns the second one

golden notch
#

it was a list and now it's an array and it is still giving me that error

north kiln
golden notch
#

it only complains when it's not empty

#

tried both List<GameObject> and GameObject[]

north kiln
#

I suspect you're still just not looking at the actual script with the unassigned value, and you should search the scene. But the error honestly makes very little sense to see on a serialised array, nor coming from getComponent()[]

golden notch
#

how do i even search the scene for components?

#

there's only one SimpleFadeScript in my assets

north kiln
#

Also, that looks like an infinite loop to me, as GetComponentsInChildren<SimpleFadeScript>() will also return itself.
You never use otherfaders so it's not (it's pointless instead). But if you did!

golden notch
#

oh, it didn't do anythign until i typed th ewhole name in

#

that's why i thought it didn't work

#

ok so that's done, but one of my things won't fade now

#

ok it works now

#

so i guess it is a bug, as it directed me to the main skript instead of where the issue actually was

foggy spade
#
using UnityEditor.Animations;
using UnityEngine;

public class PipeGenerate : MonoBehaviour
{   [SerializeField] private Transform trigger;
    private float Distance; 
    private bool HasCloned = false;
    private Vector2 childpos;

    
        // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {   
        Distance = Vector2.Distance(transform.position,trigger.position);
       if(Distance < 2f && !HasCloned){
            PipePosi();
            Debug.Log("worked");
            HasCloned = true;
       } 

       if(Distance > 3){
        HasCloned = false;
       }


    }

    private void PipePosi(){
        foreach(Transform child in trigger){
            childpos = child.position = new Vector2(Random.Range(-2,2), Random.Range(-7,7));

        }
        Instantiate(trigger,childpos, Quaternion.identity);

    }
}
``` is there any better way to randomize the position in the PipePosi function? no matter how much i change the values i cant seem to get it right it either goes inside of each other or too close to the other pipes
golden notch
#

does it have to be an inputbox to be able to select the text?

foggy spade
# foggy spade ```using Unity.VisualScripting; using UnityEditor.Animations; using UnityEngine;...

the issue seems to be fixed but i have another issue, it clones once only ```using Unity.VisualScripting;
using UnityEditor.Animations;
using UnityEngine;

public class PipeGenerate : MonoBehaviour
{ [SerializeField] private Transform trigger;
private float Distance;
private bool HasCloned = false;
private Vector2 childpos;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
    
}

// Update is called once per frame
void Update()
{   
    Distance = Vector2.Distance(transform.position,trigger.position);
   if(Distance < 0.1f && !HasCloned){
        PipePosi();
        Debug.Log("worked");
        HasCloned = true;
   } 

   if(Distance > 1){
    HasCloned = false;
    Debug.Log("false");
   }


}

private void PipePosi(){
    childpos = new Vector2(Random.Range(-5,6),Random.Range(-4,4));
    Instantiate(trigger,childpos, Quaternion.identity);

}

}

ivory bobcat
#

I'm going to assume that has-clone was false as initialized (not modified from the editor inspector) but the distance was not less than 0.1f

golden notch
#

is there a way to allow scrolling even if hovering over an input field?

#
UIChatBoxHandler.updateTime () (at Assets/Scripts/User Interface/UIChatBoxHandler.cs:111)```
but it still sets the value, idk if it's because it's an invokerepeating or not
slender nymph
#

if code after the line the error occurs on is running then you have more than one copy of that component in the scene where the error is occurring on a copy of the component you aren't looking at

golden notch
#

there is no duplicate though

#

only one of them is in the inspector

slender nymph
#

show the relevant code

golden notch
#

but it does seem to run twice

#
    {
        //...
        InvokeRepeating("updateTime", 1f, 1f);
    }

    public void updateTime()
    {
        Debug.Log(localCharacter);
        localCharacter.text = "Localhoster" + "\n" + System.DateTime.Now.ToString("HH:mm:ss");
    }

literally only this

slender nymph
#

then the only possible explanation if it is being set correctly is that you do have another copy of the component in the scene. search t:UIChatBoxHandler in the hierarchy during play mode when you see this error

golden notch
#

there was somehow

#

got it removed now

cosmic dagger
#

That's what you should always check. If you have an error for a variable that is not assigned but you check and it is, then there is a duplicate script somewhere . . .

golden notch
#

aight thanks

slender nymph
#

code does not exist in a quantum state where it is simultaneously working but throwing an exception too

golden notch
#

maybe in a quantum computer

teal viper
#

Thankfully you can't run games on a quantum computer yet

golden notch
#

when it says limit of one line that's what it means... i was thinking limit of one line break.

polar acorn
#

A quantum computer running synchronous code still cannot be both errored and not

golden notch
#

just learned about content size fitter but it doesn't seem to taks bottom alignment

golden notch
#

ok so i added a vertical layout group and content size fitter and now my script is buggy, when it scrolls to bottom it is always one item behind.

#

and i can't get the scrollbar to show up again

#

ok i got the scrollbar to show up again

bronze sinew
#

Hey I'm trying to make a 2D rotating platfrom that rotates clockwise or counterclockwise based on bullets falling on it on the left or right side Rightnow I'm stuck figuring out where how to invert the rotation , Should I post the code and the stuff I tried or is that a different channel? Absolute begineer

#

Or should I post it in the physics Channel?

twin pivot
#

just one suggestion tho

bronze sinew
#

I'm a completer begineer, Can you share a reference of what you mean? Is it like, there's an if statement that triggers an preset animation of the platform when it passes a certain threshold?

north scroll
#

is there a reason why a camera's FOV would change at runtime ? It kept happening to my main camera so I just added another one and I added no scripts or has any references, and when I run the scene that camera's FOV also switches from 60 to 111.something. I was trying to do some animation sequencing with Timeline, and no cinemachine installed

wintry quarry
north scroll
#

interesting, I changed it to physical camera and it stays at 60 Think

proper moth
#

i need

#

i cant say hep

naive pawn
#

!ask

eternal falconBOT
naive pawn
#

we can't help you without knowing what you need help with

proper moth
#

da

naive pawn
#

....is the bot down again

proper moth
#

idk

naive pawn
#

ah there we go

proper moth
#

for some reason when i have 2 nav agents only one moves

#

nvm i found th issue

#

i was baking every object instead of just only baking the floor

serene cosmos
#

hii on line 41, it says the object is not set to an instance, what can i do to fix this?

proper moth
#

eh i cant figure it out either

frail hawk
eternal falconBOT
rapid thunder
#

why i cant get started on this i click on get started but it doesnt direct me to another website

rocky canyon
#

workin fine over here 👍

dry pulsar
#

Guys does anyone knows why my IDE isnt auto compleating? And Yes I #854851968446365696 read it but Idk why it still wont work

#

I even have it installed

rocky canyon
#

is it set as the default external editor in the unity project?

dry pulsar
#

where can I see it?

#

that?

rocky canyon
#

!ide 👇 this is a good embed.. has pretty much every solution

eternal falconBOT
dry pulsar
rocky canyon
#

use this button

#

and restart ur editor/ide and possibly the PC and try again

dry pulsar
#

kk I pressed it Ill restart my PC

rocky canyon
#

also make sure u dont have any errors in the IDE console