#💻┃code-beginner

1 messages · Page 336 of 1

carmine elm
#

How can I use OnMouseOver function?

hexed terrace
#

by typing it out?

#

Check the docs for it

carmine elm
#

I can t find the function. It dosen t show up when i type it.

modest dust
#

You don't find it, you just type it out in your script (and if it doesn't auto-complete then configure your IDE as shown below)

#

Same deal as with Update or Awake

eternal falconBOT
carmine elm
hexed terrace
#

configure your IDE

carmine elm
#

i have it configured

hexed terrace
#

well, I'm sure you can finish typing the rest of the method name yourself

carmine elm
#

is not really working

hexed terrace
#

explain yourself

solar charm
#

anyone knows where is the problem here?

carmine elm
#

i mean if i go over the gameobject with the cursor it dose nothing

hexed terrace
hexed terrace
solar charm
modest dust
carmine elm
#

to check if it works i just use print"smh"

hexed terrace
solar charm
hexed terrace
carmine elm
#

i know

modest dust
carmine elm
#

yes

modest dust
#

Show your gameobject

carmine elm
modest dust
#

Is that all?

carmine elm
#

and the script

hexed terrace
#

where is the script.

#

box colliders aren't for UI

#

UI scale should always be left at 1,1,1.. use the width/ height to size UI elements correctly

carmine elm
hexed terrace
#

Use one of the correct UI funtions

#

The button component has on hover events, or you can use IPointerEnter/ Exit.. etc

#

google -> unity UI how to detect mouse over

carmine elm
#

thanks

manic sphinx
#

im trying with playerprefs it is okay???

i mean, when i hit the chests they are opening all the time

topaz mortar
eternal falconBOT
manic sphinx
#

I have literally shared it with that

languid spire
#

no you have not, you dropped your code file into the chat

manic sphinx
#

i downloaded my code from hastebin sorry if did it wrong

languid spire
manic sphinx
#

oh ok xd

rocky canyon
# carmine elm
using UnityEngine;
using UnityEngine.EventSystems;

public class UIButton : MonoBehaviour, IPointerDownHandler
{
    public void OnPointerDown(PointerEventData eventData)
    {
        Debug.Log("Clicked on " + gameObject.name);
    }
}
``` when using the IPointer Handlers the Image Component acts as the collider..
the only thing you need is a `GraphicRaycaster` component on the Canvas GameObject
and to make sure `RaycastTarget` is ticked on the `Image` component
topaz mortar
#

Is this possible? Where character is assigned through the inspector?

...
Character = JsonConvert.DeserializeObject<Character>(characterJSON);
burnt vapor
topaz mortar
#

no I'm wondering if it's possible to overwrite an existing object with JsonConvert.DeserializeObject

burnt vapor
#

Sure, why not?

#

But why overwrite something you assigned?

#

Why not just reassign through the inspector?

topaz mortar
#

the json is coming from my server

burnt vapor
#

You can overwrite data, yes. Would be weird if you could not

#

The only reason why it would not be possible is if the field you try to replace has the readonly keyword, or if the property you try to replace has the init keyword

#

Also, unrelated style note, private fields usually start with an underscore and use camelcase

topaz mortar
#

I don't like starting all my variables with _ too annoying to type

burnt vapor
#

I disagree but feel free to learn your own style

#

In your case I would confuse it with a property for example

fervent abyss
#
OculusSDKManagerMini.GetOculusUserData(r => {

        }, x = () => {});

im trying to do this lambda expression for Action (event) that has no parameters, and i get an error "The name 'x' does not exist in the current context"

gaunt ice
#

the expression x = () => {} first assign x to lambda expression () => {} then returns x

burnt vapor
#

This local variable is never assigned

gaunt ice
#

if you didnt declare x, then ofc does not exist

burnt vapor
#

Instead, remove x = and it should be fine as an Action like you mentioned

fervent abyss
#

ohhhhhhhhhhhhh

#

thansk

topaz mortar
burnt vapor
#

Attributes? What do you think an attribute is if I may ask?

topaz mortar
#

_ is just hard to reach on my keyboard lol

burnt vapor
#

And properties should be pascal case

topaz mortar
#

guess the correct name would be field 😛

burnt vapor
#

Thought so

#

I believe technically public fields should be pascal case and private fields should have an underscore

topaz mortar
#

belgian azerty kinda sucks lol

#

I'll switch to QWERTY when I buy a new keyboard an rework my entire codbase 😅

languid spire
languid spire
#

yes, I read it, and I'm sick and tired of reading this crap time and time again

burnt vapor
#

A few messages up it was merely a suggestion after I helped Pasc, who chose to continue the conversation

#

Cool down a bit 😎

topaz mortar
#

yeah I found it interesting, it's easy if everyone uses the same coding conventions

languid spire
#

you are the one pontificating about how others 'should' be doing things, not me

burnt vapor
#

If these things are not appreciated then I'm sure they can say that themselves instead of having somebody else point it out.
Also, surely you can notice it is a "suggestion" and not required? They can learn their own style. This was also pointed out.

robust pecan
languid spire
eternal falconBOT
robust pecan
languid spire
spare kayak
robust pecan
#

The function is static so it can't reach "this"

languid spire
#

make a parameterless constructor to do the same

smoky bobcat
#

I'm definitely a C# beginner. I'll hang out here for a while and see what I can learn.

spare kayak
#

My case tier list:

  • PascalCase
  • camelCase
  • Pascal_Snake_Case
  • snake_case
  • thiscaseiforgotthenameofwhichisalllowercase
  • kebab-case
  • Pascal-Kebab-Case
  • camel_Snake_Case
  • camel-Kebab-Case
  • TRAINCASE
languid spire
spare kayak
robust pecan
languid spire
robust pecan
languid spire
#

no

robust pecan
languid spire
spare kayak
#

Sorry i didn't mean from A-F

spare kayak
#

Since most would be F

#

Unless i do a Grey and do FS, FA, FB, FC, FE, and FF

#

Everything under snake_case is an F basically IMO

robust pecan
topaz mortar
#

~~Uff, I moved my Steam Manager script from one game object to another and now I'm getting this error:

Steamworks.InteropHelp.TestIfAvailableClient () (at Assets/com.rlabrecque.steamworks.net/Runtime/InteropHelp.cs:34)
Steamworks.SteamUser.GetAuthTicketForWebApi (System.String pchIdentity) (at Assets/com.rlabrecque.steamworks.net/Runtime/autogen/isteamuser.cs:205)
InfiniteForestIdle.SteamLogin.SignInWithSteam () (at Assets/Scripts/SteamLogin.cs:45)
InfiniteForestIdle.SteamLogin.Awake () (at Assets/Scripts/SteamLogin.cs:31)```
No idea why or how it broke, anyone got a clue?
It was working perfectly for months, but after the move it broke~~

Nvm, version control saved my life, wonder what happend though!
robust pecan
# languid spire you'd need to use Resources.Load

Moved the it into a folder i named "Resources" but it cannot seem to find the as it logs out "Null"

private void Start()
{
    actions = Resources.Load<InputActionAsset>("Inputs/MainControlls.inputactions");
    Debug.Log(actions);
    actions.Enable();
}
polar acorn
languid spire
robust pecan
drowsy oriole
#

I need help I have this error thats not linked to a script so Idk how to fix it

ivory bobcat
topaz mortar
final totem
#

how can i get that for my public floats?

drowsy oriole
languid spire
languid spire
ivory bobcat
red siren
rocky canyon
haughty tide
#

I am having a probelm with vs code, it loads the highlighting correctly at first but few seconds later it loads some incorrect thing

#

does anyone know what is causing this or how tof ix it

rocky canyon
#

u need to install/ update ur .Net SDK

#

if ur talkin about that little divider.. idk

haughty tide
languid spire
haughty tide
#

vs code did an update and windows updated and it broke grammarly as well

#

so something happened

languid spire
#

well there you go, why am I not surprised, thank you MS

warped ginkgo
#

I have a question, lets say we have two objects, a parent and a child object. Both have trigger colliders. The parent object has a script attached to it that has a OnTriggerEnter function. Will the OnTriggerEnter function be called, if something hits ONLY the child collider?

rocky canyon
#

if it has a rigidbody it combines the two into a composite collider

warped ginkgo
#

only the parent has rigidbody

rocky canyon
#

thast what im talkin about

warped ginkgo
#

oh okay

hexed terrace
#

physics events get sent to the first/ closest (hierarchy) Rigidbody

gray elk
#

How do you export a c# file as a zip?

rocky canyon
#

right click it in the file explorer > Send To > Compressed Folder/FIle

#

or New >

gray elk
#

Thank you!

#

Is this through Unity or Visual Studio?

rocky canyon
#

File Explorer.

#

ur basic windows folder viewer type thingy

warped ginkgo
waxen cypress
#

If im gonna make a keypad lock in Maya. Should I make each individual key a separate model and then in Unity I parent then keys to the base and then code each button to have its own collider and script to which will then unlock the keypad if correct order is put in?

rocky canyon
real rock
#

Iirc yes

#

Just mess with the rb settings so it doesn’t try to do funky things

rocky canyon
#

the Collection would act as the parent.. and each mesh would be a child object.. once imported into unity

warped ginkgo
hushed hinge
#

uhh... hello?

real rock
waxen cypress
rocky canyon
#

as long as they are different meshes in blender yes

waxen cypress
#

I use maya but same thing I guess.

rocky canyon
#

yea, i figure it will work the same

hexed terrace
waxen cypress
#

Alright thx.

real rock
#

Also idk what you’re doing but individual colliders may not be necessary

hushed hinge
rocky canyon
#

if its more specific than that.. there might be another channel

hexed terrace
#

if it's not a code question, then, yes.. put it in the correct channel

haughty tide
#

it still loads correctly for the first fwe secnds and then breaks to this

wind raptor
#

How do I change the font in the inspector? Preferably for a single element or script

rich adder
rocky canyon
#

u got two options in the settings

wind raptor
rocky canyon
#

but its global..

waxen cypress
#

Does anyone have a tutorial by any chance how to make snap zones trigger an event. For example, like a drawer opening or a door.

waxen cypress
rich adder
#

ohh its VR specific, haven't worked on that fully yet :\

waxen cypress
#

Kinda a dead chat ngl.

wintry quarry
#

"I refuse to post there"
"Why is it dead over there???"

rich adder
#

the perpetual cycle continues

atomic sinew
#

I’m using unity btw

haughty tide
rich adder
#

first @atomic sinew 🔽

eternal falconBOT
languid spire
#

do not post photos

atomic sinew
#

Oh sorry

#

I joined yesterday srry..

final totem
#

is low code coverage bad?

rich adder
rich adder
magic jungle
#

Hi i want to create a Quiz game with a Json file. I watched brackey tutorials but i have an error with the Json question loading. is there someone who can help me ?

wintry quarry
#

It must be wrapped in an object

magic jungle
real rock
#

(Aside from this) Is there any reason you’d use JSONUtility over newtonsoft?

burnt vapor
#

Nope

#

You can use it to ensure your object can be serialized by Unity itself if that is of any interest

#

If you dont have a specific reason, please just use Newtonsoft

magic jungle
real rock
#

Newtonsoft is a much nicer system for reading and writing to json

magic jungle
#

alright thanks i'll check that 🙂

burnt vapor
#

It has easy Unity support

real rock
#

You can just using newtonsoft.smthorother btw

burnt vapor
#

System.Text.Json is even better but hard to implement in Unity due to lack of support

hexed terrace
real rock
#

Oh they made it a package? What version is that?

magic jungle
#

should i install something or is it by default in unity ?

burnt vapor
#

Its a package you need to download

magic jungle
burnt vapor
#

Syntax is about the same between the two

magic jungle
#

Thanks you so much everyone ! 🙂

cinder helm
#

hi, got a question, have a timer (on a canvas) that runs through my different levels and stops at the last level's completion, then displays the final time on a separate end canvas
however, despite using debug.log to show that all the functions are running, the final time is not displayed

timer code: https://paste.ofcode.org/G4jFC8Ni7UA4pNzTjmGN6c (component of first canvas)
code to display timer: https://paste.ofcode.org/mtsTGpjfkhggNaFViTyvaN (component of end canvas)

polar acorn
cinder helm
#

the timer does exist between the different scenes, the only issue is that once it stops, that final time isnt displayed

#

unless im not understanding what you're saying correctly

polar acorn
chrome tide
#

is it possible to set a timescale value for only 1 object, so that only this object will be affected by the timescale while other objects won't be affected?

wintry quarry
#

Instead of being wrapped in an object

#

As I said the fix is to wrap it with an object

polar acorn
wintry quarry
hushed hinge
#

should i go back to the topic of the player respawn issue as to why the player can't move and the health doesn't go back to full?

cinder helm
polar acorn
#

rather than having this object change the text on a referenced text

hushed hinge
polar acorn
molten dock
hushed hinge
white glade
#

Hello,
Any idea of how to check if the mouse was hovering a UI Element ?
I tried using the pointerData but it doesn't work,
I also tried this method

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out RaycastHit hitInfo)) {
            Debug.Log("Hit object: " + hitInfo.transform);
            if (hitInfo.transform == transform) {
                Debug.Log("Hi");
            }
        }

but nothing happened also.

molten dock
white glade
hushed hinge
polar acorn
hushed hinge
polar acorn
swift crag
hushed hinge
swift crag
#

and yes -- UI raycasting is entirely separate from 3D/2D physics

polar acorn
molten dock
swift crag
#

(although I think you can allow physics colliders to block ui raycasts, but that's a separate matter)

hushed hinge
hushed hinge
white glade
polar acorn
polar acorn
#

They all have it by default

hushed hinge
molten dock
#

i think u could teleport that gameobject back rather than destroying and spawning a new one, then it would keep the reference

swift crag
polar acorn
swift crag
#

(even though it has a RectTransform and is on the UI layer)

swift crag
#

it's like trying to do a physics raycast against a game object with no components on it

polar acorn
#

so if the objects that used to be referenced are destroyed, it no longer has them to reference

hushed hinge
molten dock
#

dang what happened lol

white glade
solar charm
#

anyone knows why this isnt working?

wintry quarry
#

I would guess it's simply not running

#

Because you probably haven't created the conditions required for it to run

robust pecan
solar charm
wintry quarry
#

Ok then you skipped something from the tutorial

#

You need a Rigidbody2D

#

And a Collider2D on both objects

#

And at least on of them needs to be a trigger

robust pecan
#

The Is Trigger needs to be checked

solar charm
#

yep both of them have colliders and rigidbodies

#

both checked

hushed hinge
wintry quarry
#

Show us

solar charm
#

WAIT I FOUND IT

#

THANK YOU THICCTAPEMAN

robust pecan
robust pecan
solar charm
#

ill check the bullet rn

wintry quarry
#

The other thing probably shouldn't be a trigger

#

Just the bullet

#

But you told us "both checked" before lol

solar charm
#

yeah i meant this

wintry quarry
#

😭

robust pecan
robust pecan
wintry quarry
#

No it was enabled

solar charm
#

STOP BULLING MEEEE 😭

wintry quarry
#

But that's not what matters

molten dock
#

has anyone else had objects become invisible in the scene view but visible ingame

wintry quarry
#

That's a 3D Collider

solar charm
wintry quarry
hushed hinge
wintry quarry
#

Also not a code question

molten dock
#

where should i put it

molten dock
robust pecan
#

Maybe I'm just tired, but why wont this work?

Transform trans = camera;
trans.rotation = Quaternion.Euler(0, cameraCinemachine.m_XAxis.Value + 180, 0); //Turns the -180 - 180 range into 0 - 360
cameraMoveDelta = trans.TransformDirection(new Vector3(movementInput.x, 0, movementInput.y));
molten dock
#

im not sure how to add instantiated objects into the editor

robust pecan
dusty zinc
#

hey im trying to make a 2d game where my 2d guy has a shield projected infront of him. but every time i start to move the shield drifts away from the character. is this because they both had ridgid bodies? how can i fix this

wintry quarry
molten dock
robust pecan
wintry quarry
#

It will cut the Z off completely

hushed hinge
robust pecan
molten dock
hushed hinge
molten dock
#

assuming that script is attatched to the player

#

i think u wanna do transform.position = lastCheckpoint.position

#

just check what lastCheckpoint is

hushed hinge
molten dock
#

it would be a good idea to know alittle about how your code works lol

hushed hinge
molten dock
#

what does that mean

hushed hinge
molten dock
#

i think lastCheckpoint is another script

hushed hinge
molten dock
#

what is it then

hushed hinge
deft grail
#

also if you dont know then you should learn what you are writing, if you are that is

hushed hinge
deft grail
#

what is lastCheckpoint then

hushed hinge
hushed hinge
rich adder
#

we already see that in the code, thats not what they asked

deft grail
rich adder
#

things don't magically break on their own

hushed hinge
molten dock
#

can you show whats in the inspector of the player2D script

rich adder
#

and what is happening instead ?

robust pecan
deft grail
#

you can also do 3 for a code block, !code

eternal falconBOT
robust pecan
rich adder
hushed hinge
robust pecan
deft grail
rich adder
molten dock
#

that lastCheckpoint box is empty

hushed hinge
rich adder
#

there is no way you got this far into developing this and still are confused how all this works..

rich adder
#

remember when I warned about keeping too many of the same functionality into multiple scripts

molten dock
#

if you dont know how it works then u shouldnt be so certain that lastCheckpoint isnt a script

#

i think its gotta be

hushed hinge
languid spire
hushed hinge
molten dock
#

you reference lastCheckpoint 6 times in your checkpoint script so it probably is an issue lol

rich adder
hushed hinge
polar acorn
molten dock
#

their newly instantated player is not being assigned in the inspector

hushed hinge
hushed hinge
molten dock
#

so i was saying that they should transform the current players position to the last checkpoint instead

rich adder
#

you not remember when I said just resetting the player instead of creating new one would be easier UnityChanThink

#

so you dont break all your references

molten dock
#

but i dont think they know how to tell where the last checkpoint is

rich adder
#

isnt that the whole point of lastCheckpoint

polar acorn
#

This is a very very important lesson in what "Technical debt" means

#

Doing things fast early on means that now it takes half a dozen people several hours to change a health bar

#

All that technical debt has come due

molten dock
polar acorn
#

I don't actually think the checkpoint script is the problem other than the fact that it's spawning a new player instead of just reusing the existing one

#

And honestly looking at all the Finds just makes me willing to write this whole thing off as unfixable

rich adder
#

yeah used to be worse, can you imagine

#

hey found my handy work!

 if (collision.TryGetComponent(out DoorInteraction d))
        {
            door = d;
        }```
polar acorn
#

This is not going to be a simple fix. Everything's so interwoven it could be literally anywhere

#

So, my recommendation would be to try to simplify the code without changing the functionality, which will make it easier to find the problem

rich adder
#

start consolidating and prob learning about single responsibility

polar acorn
#

Even just small things like caching Finds and GetComponents would go a long way to making the code more readable and thus, more debuggable

molten dock
#

perhaps look up a tutorial on youtube which will show you how to make a 2D platformer respawn script

rich adder
#

this will just cause the same issues

polar acorn
molten dock
#

lol i was just thinkin they should ditch that one tho

#

and since they dont know how to do their own

polar acorn
#

This is fixable, but not in its current state. So, the way to fix this is to start by cleaning things up. They won't actually address the problems, but they'll make it easier to find when they're done

#

Let's start with some light refactoring of the checkpoint script, starting with the fields. What do all of these variables do? What is the intention of keeping em around?

molten dock
#

surely it should be as simple as detecting if the player has hit a trigger collider for the checkpoint postition and then setting the player to teleport there whenever they die

polar acorn
rich adder
polar acorn
#

In fact, this could take a while, so I'm starting up a thread

hushed hinge
# polar acorn So, what code moves the player, and what code refills the health bar

https://gdl.space/iwimeyesub.cs this is the code when takes damage
https://gdl.space/rodiduzobi.cs this is for health
https://gdl.space/hofehuquro.cs and this one is the player lost all lives, game over
https://gdl.space/oxonolanep.cs i think where GameObject go = Instantiate(player, transform.position, transform.rotation) as GameObject; is when the player spawns on the checkpoint object while i think
GameObject.FindGameObjectWithTag("Player 2").GetComponent<HitPoints>().ResetHitPoints();
GameObject.FindGameObjectWithTag("HealthUI2").GetComponent<PlayerHealthUI>().UpdateGraphics();

is when the health is back at full

polar acorn
#

The Great Refactoring

hushed hinge
# polar acorn Let's start with some light refactoring of the checkpoint script, starting with ...

starcheck is for the checkpoint sprite when it is not passed. while the sprite starpassed is when you have passed the checkpoint which you can respawn from.
public bool checkpointReached; is to check is the checkpoint is passe dby any of the players or not
private SpriteRenderer checkpointSpriteRenderer; is so that the sprite can be changed to being passed

while i don't know about private GameObject _gameOverScreen; but it is used for if the player lost all lives down to 0 lives and when you die agian, it goes to a gameover screen

polar acorn
hushed hinge
#

ok

spiral narwhal
#

Is it preferred to use colliders or constant raycasts for ground checks?

prime cobalt
#

I'm trying to instantiate gameobjects on each spot in a grid that there's one of the white hexagons but for some reason they're super offset. The green circle is around where it should be according to a function that debug logs mouse pos. Does anyone have any clue what could be going on?

eternal needle
wintry quarry
#

It shouldn't matter because they should be converting the grid coordinates to world space, which they're not doing

#

This is not a data type problem

#

It has nothing to do with that

#

They need to convert grid coordinates into world space coordinates

#

That's exactly what the Grid component is for

prime cobalt
sand swift
#

private void FixedUpdate() { accelerationGain += 1 * Time.fixedDeltaTime; }

is this more acurate and frame rate independent than this?:

private void Update() { //accelerationGain += 1 * Time.deltaTime; }
?

wintry quarry
#

it's a bit unclear what "accelerationGain" is though

#

if it was velocity than absolutely yes.

sand swift
#

dont worry I just need to be sure that is a value that increases by "x" per second

wintry quarry
#

It really depends how it's being used whether it matters or not

#

And what your requirements are

sand swift
#

but I do can share the script but I dont think is easy to understand where I want to go with. Disclaimer: I come from Arts, I use unreal (use only BPs) for few time but I decide to comeback to unity cause flexibility / freedom

#

The Notes at some comments are in Portuguese tho

wintry quarry
#

I don't see where accelerationGain is used

sand swift
wintry quarry
#

yeah it should go in FixedUpdate

sand swift
#

btw thanks a lot for the help, I think I really never used this server, but I wasn't exepting help so fast

sullen jolt
#

Hello, I hope you're doing well!

I have built a small dialogue system that uses 3 scripts to work with a string array and some booleans. Script 1 is responsible for typing out the text on screen (with typewriter effect), Script 2 is responsible for a lot of stuff but mainly checking OnTriggerEnter2D then checking for the if conditions responsible for increasing array index or disabling the text if the dialogue ends. Script 3 checks if the dialogue is on its last character and turns the canEndDialogue to true.

My problem is, in Script 2, the if conditions are all met and I've made sure by debugging but the code won't execute at all.

Script 1
https://gdl.space/erikafuner.cpp

Script 2
https://gdl.space/kutetewixe.cs

**Script 3 **
https://gdl.space/xojizosade.cpp

civic flax
#

Why does my projectile collide with me even though I have multiple lines telling it not to...

wintry quarry
#

Doesn't look like your logs are printing typewriterScript.isDoneTyping which is one of the conditions you need

sullen jolt
wintry quarry
#

What is more likely to be true:

  • you made a mistake
  • if statements in C# don't work properly
#

if the code isn't running, your condition is false

sullen jolt
wintry quarry
#

THank you

civic flax
#

Why does it keep colliding with me

#

I'm so confused

#

I tell it 3 times

#

I even put it in update

#

ignore layer

#

but it doesnt

polar acorn
#

!code

eternal falconBOT
sullen jolt
#

Am I missing something or are all relevant conditions met?

#

"Length" is the array length btw

#

I also just discovereed that pressing Return while the text in index "1" is being written keeps increasing the indexes until they are out of bound

#

This whole issue started because I wanted to disable pressing the Return UNTIL the dialogue has reached its absolute last letter

keen dew
#

You call OnTypingComplete only if canEndDialogue is false, but the log shows it's true

fluid glen
#

Ok guys

#

I need someone

#

To

#

Ok

#

Ok h

#

Ok e

#

Ok l

#

Ok p

#

Read that

#

Read the red thing at the bottom

#

Idk how to fix

robust pecan
#

and then screenshot the console

polar acorn
polar acorn
civic flax
#

please

#

i cant figure it out

civic flax
fluid glen
polar acorn
fluid glen
robust pecan
# civic flax pls

I think i see it, you need to wrap the Destroy() and the Physics.IgnoreLayerCollision inside the same scope (these {})

robust pecan
summer stump
fluid glen
#

Oh shut yeh

#

😭😭

#

One sev lemme do that

summer stump
#

Take a screenshot (not a picture) and maybe someone will help

acoustic arch
#

so my enemy AI will always have from 1-9 possible actions which are then weighted from most effective to least effective then i have a field called skill for enemy ai which is from 1-10 which determines how often they make highly effective actions

#

how can i create a calculation for the ai to pick an action from 1-9 based on skill while still being random?

#

this is the current enemyAI status

polar acorn
acoustic arch
#

to separate low level npc battle from stronger npc ai

fluid glen
#

@robust pecan

robust pecan
fluid glen
summer stump
# fluid glen

Looks like you need another package downloaded? Not sure
What is the other error?

fluid glen
summer stump
#

Ok, try to close Unity, delete the Library folder, and reopen unity. This will not affect your project assets or anything, but it will take a bit when you reopen unity as it regenerates the library

unique slate
#

!code

eternal falconBOT
fluid glen
#

Then re load unity back up

summer stump
#

Make sure unity is CLOSED first

fluid glen
#

Ok

#

Cheers

#

Lemme re load it

unique slate
#

I want to make my item be rotatable to make the incoming inventory tetris not super boring. BUT when i rotate it and move even 1 pixel it just freaks out and disappears to some far away position. I cant rly find a fix online, the only questions i found are about the same problem in JavaScript lol. Gif that shows what i mean: https://i.imgur.com/IXu4Rk9.mp4
The relevant code:

public void OnMouseDown()
    {
        isDragging = true;
        transform.rotation = Quaternion.identity;
        GetComponent<Rigidbody2D>().isKinematic = true;
    }
void Update()
{
if (isDragging && Input.GetKeyDown(KeyCode.R))
        {
            transform.Rotate(0, 0, 90);
        }
if (isDragging == true)
        {
            Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
            transform.Translate(mousePosition);
        }
}
fluid glen
summer stump
fluid glen
#

Oh shit that’s a problem innit

robust pecan
summer stump
sullen jolt
fluid glen
#

Not sure don’t think so.

summer stump
#

Looking it up, it looks like you are required to do that

fluid glen
#

Yh it’s the vision os that’s the problem

#

But I don’t want a vision pro app it’s meant to be oculus tho?

unique slate
#

thanks!

robust pecan
summer stump
fluid glen
#

Ok

robust pecan
fluid glen
#

Ok

prime cobalt
#

I'm trying to implement pathfinding but every time I run this the program freezes until the computer runs out of memory. I'm guessing there's an infinite loop but there shouldn't be.
https://gdl.space/wicomasufi.php

eternal needle
prime cobalt
#

Oh I found the issue ok thanks

acoustic arch
queen adder
#

Is there something like [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] that acts for every scene instead of first only?
#💻┃code-beginner message

atomic yew
#

What is the reason why the object is created twice when I use the instantiate command?

rich adder
eternal needle
polar acorn
deft grail
rich adder
polar acorn
wintry quarry
rich adder
#

@atomic yew yeah this coroutine might be called twice,
hard to say without seeing the whole script

acoustic arch
#

@rare basin sorry for the ping but i remade my enemy ai and haven't completed some certain things but i wanted your opinion

deft grail
acoustic arch
#

i made a class called action containing the weight of the enemy possible action and what it does

#

then through the enemy ai used a List<> and did it like that

#

does it look workable at all?

atomic yew
#

it is work

atomic yew
atomic yew
#

thank you all. Thanks to you, I found the answer to the question I was looking for for 2 hours in 1 minute.

atomic yew
sage thunder
#

Where do I find information on how the Skinned Mesh Renderer works? I want to understand exactly what is being done with the armature transforms and shapekeys, and what info it is passing to the shader. Is there somewhere I can read the code for it? Can it be modified?

wintry quarry
#

No you can't modify it

sage thunder
#

Is it doing those positional changes in the vertex shader? Can that be edited there?

acoustic arch
spiral narwhal
#

How do I access the offset variables in a script

rich adder
bitter crown
#

can someone explain the error here for me im confused the compiler error page didnt help

rich adder
spiral narwhal
languid spire
slender nymph
rich adder
#

m_Body. I think

bitter crown
#

spawn a slash at the players position

#

the script is on the player so it should spawn there no?

spiral narwhal
#

Not there sadly

slender nymph
bitter crown
#

spawning the slash at the player position

#

making the spawn position

polar acorn
#

Why is this a thing

slender nymph
bitter crown
slender nymph
#

like wtf was going through your head when you wrote it because the entire line is basically nonsense

bitter crown
rich adder
polar acorn
#

what is this

#

Like literally what are you trying to do here

slender nymph
polar acorn
#

by setting the position to itself

#

inside a Vector constructor

bitter crown
#

this isnt helping ill try myself

slender nymph
slender nymph
bitter crown
#

your just flaming me

polar acorn
# bitter crown this isnt helping ill try myself

Listen, the line you've posted is pure, unadulterated nonsense. To the point that in order to actually help you we need to know what you were thinking when you wrote it so we can find out what went wrong and correct the misunderstanding

slender nymph
# bitter crown your just flaming me

no, i'm trying to figure out what the actual fuck you thought that line of code was doing so that i can explain why that is not anywhere close to what it actually says

polar acorn
#

You have clearly missed something very basic, and unless you explain why you thought to write that we have no idea what

rich adder
#

we can only assume by what we see

bitter crown
#

its fixed

rich adder
#

that line makes no sense , maybe you thought it did something else. We wanted to know what

rich adder
bitter crown
#

ill just show you

queen adder
#

One message removed from a suspended account.

slender nymph
languid spire
queen adder
bitter crown
rich adder
#

yes there we go, that makes more sense, at least 2 floats in constructor for v3

languid spire
bitter crown
#

what

bitter crown
languid spire
#
Vector3 spawnPos = Player.transform.position;
spawnPos.z = transform.position.z;
rich adder
#

ah was just writing that..

bitter crown
#

i have another and final issue

#

how exactly do i spawn it in the if statement

rich adder
#

huh which if statement?

bitter crown
rich adder
#
bitter crown
#

whats that exactly?

#

oh

rich adder
#

did you look?

bitter crown
#

thank you

#

......i kinda wanna know one last thing

#

how do i make the range not random

#

i tried RangeInt but it doesnt seem to work

languid spire
#

dont use Random.Range

bitter crown
#

oh

#

thats all?

#

okay thank you

wary igloo
#

https://gyazo.com/ac754dae3c0215e0b312ac7aba078b3e does anyone know how I could make this for mobile where you have to hold the screen to rotate the gun instead it moving with the mouse ``` public Transform m_transform;
Vector2 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - m_transform.position;
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; // angle it most rotatet o face the mouse
Quaternion rotation = Quaternion.AngleAxis(angle + 35, Vector3.forward);
m_transform.rotation = rotation;

bitter crown
languid spire
bitter crown
#

spawn a range of prefabs

deft grail
# bitter crown

you are using random, how do you not use random
by not using random but using something specific

languid spire
#

but you said 'how do i make the range not random'

deft grail
#

take the time to actually learn what you are doing

#

instead of writing random code

bitter crown
#

I removed the word random and it still didnt work

deft grail
bitter crown
#

what do you want more from me

deft grail
#

i want you to learn C#

#

instead of writing random code

languid spire
#

to go away and actually learn something

bitter crown
#

instead of randomizing it

deft grail
#

ok so you need to do 0, 1, 0, 1, 0, 1, 0

languid spire
#

well why did you not say that first?

bitter crown
#

mb

languid spire
#

yes, you also need to learn how to ask questions so that others can understand

bitter crown
#

sorry then

bitter crown
languid spire
#

why would .Length change in that code?

bitter crown
#

im not understanding

languid spire
#

no you are not. Go and learn the basics of C# and coding

bitter crown
#

it gets how long the prefab array is

#

can you atleast tell me where i can learn unity C#

languid spire
languid spire
polar acorn
bitter crown
#

ik that

polar acorn
#

And Random.Range gets you a random value in a range

bitter crown
#

mhm

bitter crown
polar acorn
polar acorn
bitter crown
#

that makes sense ill do that

zenith cypress
# bitter crown i want it to alternate between the 2 prefabs

Various ways to do it; here are some examples:

private int _attackIndex; // stores the value for incremental usage

private void SpawnSlash() {
  // option 1:
  _attackIndex++;
  if (_attackIndex == SlashPrefabs.Length) {
    _attackIndex = 0;
  }

  // option 2:
  // https://docs.unity3d.com/ScriptReference/Mathf.Repeat.html
  _attackIndex = (int)Mathf.Repeat(_attackIndex + 1, SlashPrefabs.Length);

  // option 3:
  // modulus; gives the remainder of the division: (_attackIndex + 1) / SlashPrefabs.Length
  //          so 0 / 5 -> 0,  1 / 5 -> 1,  2 / 5 -> 2,  12 / 5 -> 2, etc
  //          https://www.dotnetperls.com/modulo
  _attackIndex = (_attackIndex + 1) % SlashPrefabs.Length;  

  // option 4:
  // if you only have two, you can get fancy
  // flips the first bit so it goes 1, 0, 1, 0
  _attackIndex ^= 1;

  // rest of code
}

Do whatever feels the easiest to you 👍

fierce valley
#

Greetings my fellows, I am a total newbie using Vuforia (AR) and I was having this issue where, having an imageState that contains a Cube, for it to rotate as long as it's on the ARCamera POV, basically when it is "onTargetFound". But it's not working at all. I probably lack something or have something wrong which I have reviewed over and over but since I lack knowledge I am struggling to get it.

(The "cube" is the rectangle-like one)
The original idea was to make both the cube and cylinder rotate when BOTH where on the camera's POV, but I can't make it work with only one so let alone both.

Would appreciate if anyone could guide me to a better understanding.

twilit pilot
#

in the OnTargetFound event, it looks like you've assigned the script but not the function being called

fierce valley
twilit pilot
#

since it's a monobehaviour you'll need to target the instance of it, whatever GameObject your RotarControllerFound component is attached to

fierce valley
twilit pilot
#

on your ImageTarget GameObject you have a RotarControllerFound component, that's an instance of the class that your script defines - make sure that's what you're dragging into the UnityEvent inspector

#

it's possible to drag the script file from your assets folder instead, but it wont know what to do with that, so it wont show any functions on it

fierce valley
#

Thank you so much!! That was the issue. Now, I dragged the instance instead to the event inspector, and can now find the missing functions 🙂

acoustic arch
#

how can i integrate my enemy ai, enemy skill into the choose action function in my enemy ai script

#

line 70-94

#

the better the enemy skill, the higher likely for a higher weighted action

eternal needle
acoustic arch
#

also i have another question

#

i'll ask after this

#

this is my first time ever making an ai for a custom battling game

eternal needle
# acoustic arch i've been trying to think about how it would affect the numbers but i can't find...

first think about this purely in numbers. You have a skill level from 1-10. How much more likely should it be that someone picks the highest weighted ability, or 2nd highest, or any, based on these numbers.
A simple way could be scaling the weight relative to the average weight. Or even just doing exponential like new weight = (weight ^ skill)
All this really depends how much you want skill to matter

acoustic arch
#

oh i get it

#

so when the weight is calculated, that weight is then changed based on the enemy skill whether it's good or not

shrewd gazelle
#

hello Bawsi would you be interested in tutoring me in discord for 30 min on unity for 20 $ and Ill pay before we start Im trying to do something and didn't find tutorials on it

eternal needle
shrewd gazelle
#

aw man lol

acoustic arch
#

this is the action script that calculates weight based on different variables

#

even if i changed the initial weight would it really effect anything?

#

it would still be sorted from 1-9 best actions

eternal needle
#

since these are (relatively) high values, then i take back the part about doing exponents on them. Any sort of multiplication should work

shrewd gazelle
#

ok Bawsi you know the game among us you know when the player goes to tasks and then a small minigame opens and you play it and finish it I was trying to do that but didnt find turorial on it the only way I can do something like that is if I tell a script to change the scene and if the player wins go back to the old scene but the requirment is for the game to stay in the scene and the mini game to be in the same screen like among us

#

do you know any tuturial on that

acoustic arch
eternal needle
shrewd gazelle
#

when you get the chance please answer me Bawsi

eternal needle
eternal needle
#

yea also could just show some UI or do it via additive scenes.

acoustic arch
#

for a lower skill^

#

should i come up with a scaling factor for each skill then?

shrewd gazelle
#

and Im fine with learning new things but I have a deadline and didnt expect not to find tuturiols on lol

#

but thanks

#

sorry that was for Frostyio

gray elk
#

!code
(using this for myself)

eternal falconBOT
eternal needle
# acoustic arch should i come up with a scaling factor for each skill then?

If thats what you want to do then yea, i assumed skill lvl 1 would mean it wouldnt affect the values. Either way, there should be some skill level that basically doesnt touch the weights. Honestly im not even sure what to suggest for an equation, I imagine you could use something related to the average of all the total weights. Like if you have weights 20, 40, and 60. 20 would be seen as below average, 60 above average. Do what you want from there based on a formula

gray elk
#

I'm encountering a weird error when i run my code. Does anyone know what this means and/or how to fix it? The game works just fine in Unity, so its only wonky like this when its being run.

https://gdl.space/loxideladi.sql

wintry quarry
#

Could be your code or the engine itself

acoustic arch
acoustic arch
#

so i could figure that one out first

shrewd gazelle
#

I will learn all of it just as I mentioned its just the deadline and me not being aware of the fact that theres no tutorials for it

acoustic arch
hushed hinge
#

I'm trying to access the player 2d component to access the last check point reference (an object in the scene that was last reference) yet idk why it have a red underline there

slender nymph
#

does whatever GetPlayer returns have a public player2d variable?

#

also it generally helps to share the error

hushed hinge
#

PlayerComponents go = PlayerManager.instance.SpawnPlayer(1, PlayerManager.instance.GetPlayer(1).player2d.lastCheckPoint.transform.position);

slender nymph
#

does PlayerComponents have a public variable called player2d

slender nymph
#

okay so what does the error say

#

here, i'll give you a hint: take another look at the line you've written. then look at the PlayerComponents class and see if there's anything different

hushed hinge
slender nymph
#

well this is now a different error

#

so now you have to look at the Player2D class

hushed hinge
#

ok

gray elk
hushed hinge
#

everything is working now, but however... when I'm in a different scene, in a world when you select a stage and when i spawn in that stage scene and when i die and repsawn, it doesn't work

acoustic arch
hushed hinge
# hushed hinge oh.... come on!

PlayerComponents go = PlayerManager.instance.SpawnPlayer(1, PlayerManager.instance.GetPlayer(1).player2D.lastCheckpoint.transform.position);
and it sent me over to this line of code

gray elk
valid pine
#

Hello guys, im very new in unity and c# aswell, sorry for bothering you guys. i wonder if anyone knows how to calculate the position offset from a angle, i tried polar coodinates, transformpoint, rotatearound, trigonometry in gereneral but everything i do result in wrong position.
Context:
this is a IK system that i want to do procedural animation combined with regular animations.
If i im broking some rule please let me now
https://gdl.space/totecuriki.cs

wintry quarry
#

Also for sharing code: !code

eternal falconBOT
valid pine
hallow sun
#

the one you've got commented is wrong, it should be:

float x = r * Mathf.Cos(phi) * Mathf.Sin(theta);
float y = r * Mathf.Cos(theta);
float z = r * Mathf.Sin(phi) * Mathf.Sin(theta);
#

dunno where you got -0.31f from though

timber tide
#

otherwise I suspect you'd want to use Quaternion.Inverse

valid pine
# hallow sun dunno where you got ``-0.31f`` from though

the 0.31f was the temporarly fix for the r * Mathf.Cos(theta) because cos is never 0, so always he was return a offset
also didnt work i tried some combinations because im using camera local space so i thought this was the issue but isnt.

valid pine
valid pine
#

i think i have to use matrix probaly but had the same effect

timber tide
#

Not too sure the results you want, but when im confused with space relativity, I just work it out from world space

acoustic arch
#

how can i multiply a number by another, where if it's multiplying against a low number it gets higher, if it's a high number it gets lower

#

for example if the number is 70 it gets lower when multiplied, or if it's 5 it gets higher when multiplied

valid pine
timber tide
#

so, find the offset of the right hand from the camera's position and just add it to the left hand's position

valid pine
timber tide
#

your screenshot there says positionoffset

acoustic arch
#

making the worse move more likely, better move less likely

#

then the opposite for the better ones

valid pine
hallow sun
timber tide
valid pine
timber tide
#

I assume you mean the hand rotates around the camera, but that is just positional displacement when you think about it

valid pine
#

i think if i demonstrate it with ingame screenshot ull understand but its more moving the left hand moving arond the right hand, like its child only for this rotation offset

#

maybe a video would better

timber tide
#

a lot can be solved by general vector addition using the origin

#

of course you can do it with matrix logics, but sometimes the easiest solution would suffice

valid pine
#

i tried the matrix now and it does a lot of that i dont know, but i dont know other way to calculate a position with a angle and radius. i used the polar coordinates and was uunsuccessful

topaz mortar
#

A bit hard to explain this one:
I have 3 classes: Character (not a MonoBehaviour), CharacterLogic (MB) and CharacterVisuals (MB)
CharacterLogic is on a gameobject and holds a reference to Character and CharacterVisuals
CharacterVisuals is on another gameobject and holds a reference to CharacterLogic

I also had a reference to Character on CharacterVisuals
I assigned it in the Awake function like this: this.Character = this.CharacterLogic.Character

Then after the CharacterLogic.Character got loaded, none of the values in CharacterVisuals.Character were updated?
Can you not reference objects like this? Where did I go wrong?

nimble apex
#

if my script extends a class from unity library
like dropdown (which is a class for dropdown UI in unityengine.UI)

if i declare new variables, will it shows on inspector? (public var ofc)

#
public class CustomDropDown : Dropdown
{
    public GameObject arrow;
    public Image currentSelectBg;
    public Text currentSelectText;
    public Transform generatedDropDown;
    public RectTransform dropDownScrollContent;
}```
#

im fully confident that im not blind

#

ok this is absurd

#

the team has a custom script that has identical name to one of the class in unity library

#

and its using that library as well

summer stump
#

<@&502884371011731486>
Fake link, scam

timber tide
#

use the vs debugger and step through to see what the reference is and if it's being populated

#

also execution ordering if this is all being done in a single frame perhaps

topaz mortar
timber tide
#

Separation from visuals and logic, they should work no matter what order you load them, but Visuals needs some Character to bind to, but it can hang out in the scene until it is.

#

Character logic does not need to know about visuals, but visuals do need a reference to character. Character should work completely without visuals.

#

In theory

#

Only problem with this is you need to handle the execution if it's chopped apart like this, so keeping the visuals as a field to the character logic would guarantee it load correctly (this would go against the idea that the character logic does not need to know about the visuals but who cares)

#

Otherwise you do like a manager like RequestUI

torn edge
#

Hello, I don't know much about angles so I needed to ask, if you want your bullets to travel higher or lower depending on the x-value of the player's rotation (such as if the x value of the player's rotation > 20 then travel until transform.position.y == 20f or something) can you just do rotX = playerTransform.rotation.x or do you need to convert it to something before doing the conditional statements?

timber tide
#

if you rotate your character's x, it will affect the tilt, so a negative x rotation would make them face upwards

#

in the traditional xyz rotation (y world up)

atomic bison
#

hi there! good morning

atomic bison
#

but documentation tell me myUniversalAdditionalCameraData.cameraOutput = CameraOutput.Texture;
myCamera.targetTexture = myRenderTexture;

topaz mortar
slender nymph
#

also what version of URP are you using? because those docs are for a really old version. and of course GPT is just guessing what you should be doing based on predicting what text is most likely next after the text it has already generated. it does not know how to do things, especially when things change with newer versions

atomic bison
# topaz mortar Looks like you're trying to put a Texture into a cameraOutput, obviously that wo...

im trying to adapt brackeys tutorial from portals to urp https://www.youtube.com/watch?v=cuQao3hEKfs

Get all Udemy courses for only $10.99: http://bit.ly/BRACKEYSJAN

The link above is an exclusive limited $10 site wide deal that expires soon so... go nuts!

In this video we create a smooth portal effect in Unity!

● Download Shader: https://goo.gl/iKCk1r
● Project on GitHub: https://github.com/Brackeys/Portal-In-Unity

The video is based on th...

▶ Play video
topaz mortar
#

I'm just explaining your error, think about it

atomic bison
#

so the way to use a rendertexture to a mesh renderer in scene i understand this step, so in urp i hve to modify a bit the code because there is another section in maincamera with the output

timber tide
#

Sebastian's video is probably more informative

atomic bison
atomic bison
timber tide
atomic bison
slender nymph
#

correct

timber tide
#

bracky's implementation uses mostly quaternions but there's problems* with it

atomic bison
timber tide
#

lague has a better matrix implementation of viewing through

#
var matrix = transform.localToWorldMatrix * inPortal.transform.worldToLocalMatrix * playerCamera.transform.localToWorldMatrix;
outPortalCam.transform.SetPositionAndRotation(matrix.GetColumn(3), matrix.rotation);

Basically that

topaz mortar
#

Tried adding & removing nullable, tried adding a (Character) cast, I know I'm doing something silly but I don't see it:

Character Character = CloudSave.LoadCharacterData(context, gameApiClient);

eternal needle
#

your ide should give you the exact type it wants, if you do var character then refactor to use explicit type

topaz mortar
#

bleh just missing async in the function -_-

#

and await in the call

#

weird error though

rich adder
topaz mortar
#

Here's the working version:

topaz mortar
#

but it sorta makes sense

rich adder
topaz mortar
#

I would expect it requires await if you're trying to call a Task
but I guess there are use cases where you want to store the actual Task instead?

rich adder
#

yeah if you're running a bunch of tasks they can be put in a special class for it

#

etc

keen dew
#

async/await is just syntactic sugar for calling and handling Tasks manually

zinc shuttle
#

hello, i am making a top down game in unity 2d, and i want the camera and movement behaviour a lil different.

  1. I want the camera angle to follow the mouse
  2. The movement i have currently is w for going straight up but i want it to be facing the cursor.

new to unity, i wonder how can i do that

teal viper
harsh drift
#

hello. how rotate the 3d object to other 3d object?

atomic bison
#

nevermind i just found the solution inside one comment 😛

timber tide
#

it's just a screen space position shader

#

it's also a single node if you want to do it via shader graph

zinc shuttle
timber tide
manic sphinx
#

Hi, I have a problem, I save chest states and delete them with the m key, it happens that when I save or delete them, only the saved and deleted ones are applied to the scene I am in, how can I apply them to all the scenes the changes? I've been trying for a long time, please help

https://hastebin.com/share/qidefifixu.csharp

harsh drift
#

im try rotation the 3d object, but its need +90 degree. how add this?

#

Vector3 direction = target.transform.position - transform.position;
Quaternion rotation = Quaternion.LookRotation(direction, new Vector3(0, 0, 1));
transform.rotation = rotation;

timber tide
#

where you changing by degrees

#

you're rotating towards a direction here

zinc shuttle
queen adder
#

Hi guys can anyone help me with this, its simple, but i rly idk how to do it, i created a slide bar on a canvas, and then i applied an effect for my camera, but the effect affects the canvas as well, and my slider bar becomes distorted, how can i put a straight bar again?

slender nymph
#

this is a code channel

ruby python
#

Mornin' all,

Soooooo, I'm following a tutorial on infinite scrolling background using tiles, the tutorial is a 2D solution and I'm trying to 'convert' it to 3D.

I'm not overly experienced with Overlap Circle/OverlapSphere/SphereCast etc. so I'm not 100% sure how to get this to work.

Would anyone be okay to take a look at the code and point me in the right direction please? (I've left the original OverlapCircle code in but commented out to compare)

https://hastebin.com/share/fowacuquru.csharp

iron galleon
#

So I'm following a first person tutorial by this guy

#

and I can't get it to work

#

the capsule just falls

ruby python
#

Do you have a collider anywhere?

iron galleon
queen adder
iron galleon
#

I still haven't gotten to the player controls

#

I just finished the camera controls

ruby python
# iron galleon yeah

What is the player position before you click play? And the ground Position (specifically the Y position)

iron galleon
ruby python
#

Show the scene view when not in Play mode

iron galleon
#

and for the ground:

ruby python
#

Focused on the player.

iron galleon
ruby python
#

Okay, first guess is that your collider is below the ground, so it's not detecting the collision. Try raising up the player GameObject to about 0.5

iron galleon
ruby python
#

That doesn't tell me anything dude 😕

keen dew
#

Does the ground have a collider

iron galleon
#

it just pushes the player up now

languid spire
#

why do you have a rigidbody on the ground?

iron galleon
#

I didn't add it?

languid spire
#

it didn't add itself

iron galleon
#

removed it

ruby python
#

As you're following a tutorial, go back and retrace every step slowly. I know that guys tutorials, and he's pretty good.

manic sphinx
#

Hi, I have a problem, I save chest states and delete them with the m key, it happens that when I save or delete them, only the saved and deleted ones are applied to the scene I am in, how can I apply them to all the scenes the changes? I've been trying for a long time, please help

https://hastebin.com/share/qidefifixu.csharp

ruby python
# real rock I think you want CheckSphere

I thought the same, but was a bit confused by it as CheckSphere doesn't return a boolean (like OverlapCircle does), so not really sure how to use it in this context.

ruby python
real rock
#

Easily done lol

manic sphinx
real rock
#

Maybe someone else will be around that’s actually used it

spiral narwhal
#

Why does the movement make the sprite so stuttery?

#
        private void Move()
        {
            if (!_canMove) return;

            var rigidBodyVelocity = _rigidbody2D.velocity;
            var movementVelocity = new Vector2(_moveInput.x * _movementSpeed, rigidBodyVelocity.y);
            _rigidbody2D.velocity = movementVelocity;
        }
real rock
#

Not 100% sure why but one thing to do is add a little drag

keen dew
#

That looks like camera stutter more than movement stutter. Can't tell for sure because there are no reference points in the background

real rock
#

Could be yeah

#

Which would make sense

spiral narwhal
#

Ah I see

#

Let me send it

languid spire
spiral narwhal
real rock
#

In something I’m making someone thought there was a bug where the player went flying, turns out it was just the camera

spiral narwhal
iron galleon
#

boys I figured out how to move the camera 🔥🔥🔥🔥🔥

ruby python
#

Hmmm. Okay, so CheckSphere seems to be the way to go, but it's introduced a new issue that I'm not sure how to fix. 😕

I could obviously put a collision check on the tiles, but that would introduce a lot more processing.

Any ideas? 😕

real rock
#

Why… why is your script in scripts/ignore lmao

iron galleon
real rock
#

Could use that and instead of if(overlap do if(overlap.count > 0

ruby python
spiral narwhal
real rock
#

Makes sense

ruby python
#

!code

eternal falconBOT
ruby python
#
Collider[] hitColliders = Physics.OverlapSphere(player.transform.position, checkerRadius);

 if (hitColliders.Length > 0)
 {
     Debug.Log("Hit Triggered");
     noTerrainPosition = player.transform.position + new Vector3(xPosition, yPosition, zPosition);
     SpawnChunk();
 }

This is what I've got. Even with a layerMask it does the same thing. It's happening basically because I'm calling the check every frame, so it's detecting the current collider every frame. I'm just not really sure what the difference in the detection side is between the circle and sphere methods is 😕

real rock
#

Can you show the 2D code again rq?

ruby python
#
if (Physics2D.OverlapCircle(player.transform.position + new Vector3(xPosition, yPosition, zPosition), checkerRadius, terrainMask))
{
Debug.Log("Hit Triggered");
noTerrainPosition = player.transform.position + new Vector3(xPosition, yPosition, zPosition);
SpawnChunk();
}
#

Oh wait, 1 sec, I did miss something.

gaunt ice
#

Physics2D wont work in 3d physics, two different systems

real rock
#

Theyre converting from a 2D tutorial to 3D

ruby python
#

Gah, this is really frustrating. lol.

real rock
#

Lol

#

You got this

ruby python
#

Oh, I think I may have figured it.

#

Needed to change the colliders check to <=0 instead of >0

real rock
#

Not sure that will fix it in the long run lol

ruby python
#

Maybe not, but it's doing the same thing as the 2D tutorial is doing, so I can move onto the next stage and see what happens. lol.

real rock
#

Lol

#

What happens if you do > 1 instead?

ruby python
#

Nothing. I figured it wouldn't because the collider count won't go above 1 until a new tile is spawned, which will never happen because a new tile will never spawn (if I understand the logic correctly)

real rock
#

I think something is a little broken then but I guess you’ll find out in future, hard to tell without an editor in front of me to play with lol

ruby python
#

Yeah I know what you mean. I get the same thing.

iron galleon
#

boys how do i add 2 tags?

ruby python
#

The vector3 offset is basically to 'move' the sphere to that point based on the players movement, so when the check moves off the 'current' tile, the next one spawns (If that makes any sense.)

deft grail
gaunt ice
#

but a gameobject can have only one tag

deft grail
#

exactly, so probably want a || instead of &&

iron galleon
#

ight

#

WHAT THE HELL, I ADDED COLLISION

burnt vapor
iron galleon
#

collision doesn't work

burnt vapor
iron galleon
#

ight thanks

burnt vapor
nimble apex
#
      //portrait resolution : 3/4 only
      //landscape resolution : 16/9 only
      if((r.width/r.height) == (3 / 4))
      {
        portraitResolutions[dropDown.options.Count] = r;

        if (!GameManager.Instance.isLandscape)
        {
          newOptionData = new OptionData(GetResolutionText(r));
        }
      }
      else if ((r.width / r.height) == (16 / 9))
      {
        landscapeResolutions[dropDown.options.Count] = r;

        if (GameManager.Instance.isLandscape)
        {
          newOptionData = new OptionData(GetResolutionText(r));
        }
      }```

do u guys think this code can be further optimized?
#

what this script does is basically obtain all resolution possible, and group them into 2 kinds of resolutions, add them to a list for later display

languid spire