#πŸ–ΌοΈβ”ƒ2d-tools

1 messages Β· Page 52 of 1

runic orbit
#

so i need to set diffrent value of z to each objects when they are instantiate?

snow willow
runic orbit
#

thanks a lot man πŸ™‚

mossy canyon
#

When I push the pause sign in the unity editor, is it possible to inspect an object so I can see private members from a script and what values they might contain ?

compact knoll
#

if you mean private variables you can serialize them to view/edit them in the inspector. Just add [SerializeField] where you declare the variable

mossy canyon
#

Is it meant to show in the Inspector then ?

compact knoll
#

Yes. serializing fields will make them show in the inspector

mossy canyon
#

Thanks! πŸ™‚

silent breach
#

I'm trying to make a click animation in a mouse sprite by using two sprites, one normal and the second with the left click highlighted, so i fade the normal sprite to 0 or 100 to make the click animation.
(Using DOTween)
So this is my code:

public void Click() {
    ClickOn();
}

public void ClickOn() {
    print("Click on");
    mouseNoClick.DOFade(endValue: 0f, duration: 0.8f).OnComplete(ClickOff); //mouseNoClick is the normal sprite.
}

public void ClickOff() {
    print("Click off");        
    mouseNoClick.DOFade(endValue: 100f, duration: 0.8f);
}

But i get this:

#

Only the click on animation works the first time (the click off animation doesn't even works)

frigid minnow
#

Answer ^ if you can first, but does anyone know if Composite Collider 2D changes the collider shape if a tile is destroyed?

frigid minnow
#

And I guess a more pressing question, does anyone have any ideas what is going on with these colliders?

#

The colliders are what you see, but I don't know why the actual collision is happening so far away from the actual collider on the player

#

Changing the box collider's shape does influence the collision but I can't figure out why the shape of the collider doesn't seem to match up with the collision

#

Like if I make it smaller, it functions as if it were smaller, but the collision still doesn't match up

late viper
#

what does the collider of the wall look like?

frigid minnow
#

I turn it on at the end of the gif

late viper
#

oh ok could barely see it

#

do you have other colliders attached to either object?

frigid minnow
#

On the player I have just a Box Collider 2D and a Rigidbody 2D
And on the wall I have a Tilemap Collider 2D, a Rigidbody 2D, and a Composite Collider 2D

late viper
frigid minnow
#

That worked wonders! Thank you!

still tendon
#

I have a super simple dialogue system where contact with a point or clicking an object takes you to a Scene/Level with the dialogue but how I can place an animation on the canvas it takes you to? (Just a simple idle animation for the character you’re talking to)

thick vault
#

does anyone know how to make a joystick go beyond just 8 directions?

elder minnow
#

It already does if it is analog input

#

Since it's a Vector2 value

hearty sage
#

can anyone help me i have 3 errors in unity. Unity packages and this error is comming everytime in am reopening any scenes in unity :(

snow willow
#

in package manager

hearty sage
#

Oky thnx for ur reply.. :)

hearty sage
#

@snow willow bro i am now even able to open the package manager its whole empty 😭

gritty dagger
twin terrace
#

If I have a tilemap with a tilemap collider, can I make it so that some tiles can colllide and some don't?

compact knoll
#

One way you can do that is create a new layer on the tilemap and put all the collision tiles on there and put the tilemap collider on that layer only.

twin terrace
white cedar
#

This is my script, I wanted to make the gameObject desactivate after its complety but dont work 😦

vocal condor
#

time is never going to be equal to full time?

#

Maybe you want less than full time

spark moth
white cedar
#

oh ookok

spark moth
#

Update is called each frame (if you got 10 fps, it will be called 10 times a second)
According to that, if your fulltime variable is equal to 2f, that time = 1.98 but that one frame took 0.1 second to calculate, you'll never fulfill the condition :)

white cedar
#

ohh ty ty >D

vocal condor
white cedar
#

i already fixed it, ty guys

spark moth
native pelican
#

I have an unresolved issue with UI elements inside a Scroll View where they don't take the full width of the screen when I set the UI Scale Mode of the Canvas to Scale With Screen Size instead of Constant Pixel Size.

#

So, what I want to remove is the space on the left and right sides, or these two areas highlighted in red.

#

It should look like this.

covert whale
native pelican
#

It seems so.

covert whale
native pelican
#

That one too.

covert whale
#

also try using expand

native pelican
#

I've set it like this. I think I've used a reasonable reference resolution

covert whale
native pelican
#

I don't see any improvements after changing it to expand

#

even after resetting the messages and entering play mode again

covert whale
#

sorry i don't know too much cus with ui i usually just try lots of different things and see what sticks

#

it's a little fickle

native pelican
#

I agree and understand. The number of objects in the hierarchy that may be causing the issue is not helping either.

woeful harbor
#

the button "sizes" (the white outline around it) is too big so I can't click any of the other buttons. Does anyone know a way to make it so that the button only works when I click the actual sprite?

subtle vessel
#

you need to set your width and height to be the size that you want for the clickable area

woeful harbor
#

that changes the button sprite size though

subtle vessel
#

oh, because your sprite has a bunch of transparent space in it

#

you need to crop your sprite to be just the button

woeful harbor
#

oh that makes sense

#

thanks

subtle vessel
#

also, it is common to use 9-sliced sprites for buttons so that the sprite will fill the button area

#

you can make one sprite for the main button area and a separate sprite for the drop shadow if need be, though I think you can probably slice it so the shadow scales correctly

#

with the drop shadow combined into the main sprite, the drop shadow is always going to be clickable. If you want only the gray area to be clickable, you'll have to make two separate sprites and put them on different GameObjects (and use parenting to make them look the same as the shadow the way you have it now)

woeful harbor
#

oh alrighty

proper granite
#

hi, I'm having a really hard time coding my ground checker. it's a boxcast attached to my character's feet and it works pretty well in general.

the problem is that when I pass through a unidirectional platform (which uses an effector) the ground checker's boxcast detects the platform before the jump is over. so the ability the jump again and the idle animation is trigger.

I can't find a way to restrict the boxcast to one direction like an effector does.

proper granite
#

(i have fixed the problem by checking the velocity of the player at the same time i check its ground checker boxcast)

still tendon
#

My Code doesnt work. Anything i am coding just doesnt work. I cant even give out something on console.

#

Can someone help me in vc or somethign

snow willow
#

But "doesn't work" is very vague and hard to go off

mossy canyon
#

Anyone familiar with AIPath? I'm trying to implement it following most of this tutorial, https://www.youtube.com/watch?v=jvtFUfJ6CP8 , and I have it working.. only my gameobject doesn't seem to follow the trajectory the ai has detected.. πŸ˜›

Let's learn how to make 2D pathfinding using A* with and without code!

● Check out Skillshare! http://skl.sh/brackeys17

● A* Pathfinding Project: https://arongranberg.com/astar/

Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·

β™₯ Subscribe: http://bit.ly/1kMekJV

πŸ‘• Check out Line of Code! https://lineofcode...

β–Ά Play video
torn fossil
#

If I wanted to create a game where tapping the screen was it's core mechanic (in a mobile game), how should I best implement touching the screen? The UI engine with abutton? raycast hit? something else? I want to be able to pull off fast,consecutive touches

mossy canyon
jolly hawk
#

Does anyone know how to make a animated objects to scale with screen size? I can't figure it out, they are sprites that are animated on background

#

Its just one static photo that is animated, no movement in the game

jolly hawk
#

Thanks I will try to look on this πŸ‘

summer spruce
#

Hello, I got a question. How can I make the shadow caster 2d dynamic? It only lets me create the shape of the shadow caster shape. Cant I do it dynamically? Like with the alpha mask of the sprite?

bronze anvil
#

I got a really strange bug related to 2D tilemaps. Let's say I set 3 tiles of type A, and after I place over them 3 tiles of type B, on exactly on the same spots. After placing the last one, all tiles disappear. If I set one more tile anywhere else, the tiles that disappeared become visible. Any idea what's going on here?

#

Calling tilemap.RefreshAllTiles solves the problem

humble lark
#

Hello ! Im not quite sure if i can ask help here but it's related to a 2D game so i guess it's OK. I just wanted to ask if i can create like Tower Of Hero made by Tatsuki (of course, it is for my own utilisation, i don't plan of making it public) with Unity and if yes, is there already a tutorial or do i just need to experiment myself (it's my first time using Unity) ?

snow willow
humble lark
#

Ok thank you ! If you say that any game is possible in Unity i believe you ! Im gonna do some experiment then

versed oracle
#

Is it correct to be using a layering system to try arranging hitboxes and hurtboxes? As an example, I want to have the same detailed hitbox/hurtbox/pushbox system utilized in games like Guilty Gear (examples being framedata like http://www.dustloop.com/wiki/index.php?title=GGACR/Slayer#Hitboxes ) but more for a beatemup like system.

So far I can foresee issues being that, in order to have a layer like "Friendly/Allied/Player hitboxes" and "Enemy hurtboxes" and "Enemy Hitboxes" it seems like I would need multiple game objects associated with one entity or character in order to achieve the proper layering. As such, I'm a bit skeptical that this is the correct idea but it may be resolveable with proper object pooling.

#

Direct example - I could have them all attached to one gameobject but that sounds like it requires a lot more work checking what the trigger is actually colliding with in comparison.

dreamy verge
#

Hi guys, im new at unity and im making a game like zelda , i wanted to know how can i make an ammo system (with an hud in top right corner?)

#

I already have the arrow script, the ammo hud

#

i just need to script it but i dont know where i should start

dreamy verge
#

Thank you! ^_^

dreamy verge
#

So i made the script

#

But now how could i attach this script to another script? i already have my main player script where its make the arrow by pressing "m" button

manic ruin
#

can some one help me? i wana put that new item that spawned in that GameObject called "newItemSpawn" but idk how

#

someone help plz?

vocal condor
#

Cache the result of the instantiation

#

Set your parent to it afterwards

#
var Set New Item Spawn = Instantiate(...);
Set Parent(Set New Item Spawn);
```*Not actual code*
manic ruin
#

hmmmmmmm

vocal condor
#

Or rather remove var if it's a class member.

manic ruin
#

ill try it later thnxxxxx

fervent otter
# versed oracle Direct example - I could have them all attached to one gameobject but that sound...

There are a lot of ways to handle this and all of them probably add more complexity than you'll like. Off the top of my head this is what I'd do:

  1. Create an interface (eg IHittable) and make every character type inherit it. This interface should define OnHitBox, OnHurtBox, OnPushBox methods.

  2. Put each of these different triggers on child game objects in each character. Give each a HurtBox.cs, HitBox.cs, PushBox.cs as appropriate. These classes will be simple so you'll be able to reuse them in each character.

  3. In each of these scripts, on Awake, find the IHittable in the parent object. Then forward the collisions with OnTriggerEnter2d(Collider2d other) => parentHittable.OnHitBox(other)

  4. Now your character can define specific responses to each type of collision. Safe it as a prefab and you have the basic character ready to go

white cedar
#

why my bullet gets more slowed as more time the method is called?

versed oracle
elder minnow
#

I honestly would implement my own collision system without relying on physics. It's just a bunch of simple square intersection checks anyway

covert whale
#

true

mossy canyon
#

Does AddForce do anything when gravity is zero ?

knotty barn
#

It does. You can think of gravity just as another AddForce call

chrome wind
#

How can I match the scale of a UI image to a sprite in the scene?

turbid heart
#

Try googling β€œhow to scale ui to match sprite unity” @chrome wind

desert cargo
chrome wind
chrome wind
desert cargo
#

It doesn't even need to be a second canvas, it can be the same one you render everything else on.

#

Up to you.

chrome wind
#

Alight. Thanks I'll look into it. πŸ‘

summer spruce
#

Hello, I got a question. How can I make the shadow caster 2d dynamic? It only lets me create the shape of the shadow caster shape. Cant I do it dynamically? Like with the alpha mask of the sprite?

honest python
#

so for some reason the collision in my game is completely messed up

#

it works 9/10 times

#

but sometimes they just go through eachother before correcting themselves

#

or sometimes they just keep going through eachother

#

even when I set my FixedTimeStep to 0.0005 it still happens

#

it does set IsOnGround properly and in time

#

but even though I do

if(IsOnGround)
{
            rb.velocity = Vector2.zero;
}
#

it doesn't set the speed to zero

modest cargo
#

I don't think you're supposed to change FixedTimeStep unless you have a very solid reason to

distant pecan
#

As it happens every frame

#

If you set to fixedupdate depending on your framerate it will be checked before/after the frame begins

honest python
#

so I got the problem

honest python
#

which makes it work

modest cargo
distant pecan
#

FixedUpdate doesnt runs every frame, so if you have a high framerate it WILL cause problems

modest cargo
covert whale
#

yeah u should do ground check in fixedupdate

modest cargo
#

If you do a physics check outside of FixedUpdate, it'll run into disagreements with the physics engine about where things are at the moment

#

The update functions are separate so physics will always run the same way regardless of high or low framerate

honest python
#

does a layermask in Physics2D.RayCast filter that layer or only detect that layer?

covert whale
#

it detects only that layer

honest python
#

if it first hits another collider does it just go through that or does it return null

#

the RayCast

covert whale
#

it'll ignore that collider if it's not the layer of the layermask

modest cargo
#

Which is really useful for making raycasts performant!

honest python
#

those two squares are supposed to only spawn above the ground

#

noit eachother

#

here they don't have a layermask

#

so they don't ignore eachother

#

and the ground has the layermask 8

#

but when I do

        RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.down, Mathf.Infinity, 8);
#

it doesn't even detect the ground

#

even though it is of layer 8

modest cargo
#

The layerMask is not the number of the layer, it's a bitmask

honest python
#

what's that?

modest cargo
#

It's a way to represent multiple possible layer selections with just one value

honest python
#

then how do I select only the 8th?

modest cargo
#

To get the eighth layer, you'll have to define layerMask as
int layerMask = 1 << 8;

honest python
#

what if I would want 5 and 8

honest python
#

thanks!

modest cargo
#

This could be too old to work one to one

#

But I guess it's the | OR operation that does the trick

covert whale
#

u could also show the layermask in the inspector and that gives a drop down menu

modest cargo
#

You can get layermasks by bitshifting, and from their name
playerLayer = LayerMask.GetMask("PlayerCollision") is what I did

versed oracle
#

Seems like 2D physics are having the Physics2d.OverlapXNonAlloc methods get deprecated sometime soon? Honestly seems kind of weird. Pops up in the documentation in documentation past Unity 2020.2

cerulean temple
#

is there any poles in 2d ik? because my characters leg is bending the wrong way and im using a fabric solver

snow willow
#

e.g. OverlapCircleNonAlloc is just being replaced by an overload of OverlapCircle that does no allocation

versed oracle
#

Ah that's exactly what's happening. Thank you!

paper timber
#

Kind of in this weird position right now where I'm looking to move a collider out of any colliders it might accidentally enter (e.g. the player closes a vertical door on themselves)

#

i don't have a problem dealing with that for a single collider, but I'm thinking of edge cases where the controller could end up in multiple solid colliders and wondering what would be a good way to find the closest valid location that's not inside of a solid object

#

gonna test out a few implementations, but if anyone has any input, I'd be glad to hear it tbh

quartz breach
#

When shooting projectiles, how do I aim the projectile toward the target place

#

Also how can I keep the projectile on its current course once it's reached the target destination

#

How do I shoot toward a target and keep the projectile going through that target point if it doesn't hit anything

snow willow
#

then you just send the projectile in that direction.

quartz breach
#

My issue is I have no firepoint

#

I tried creating one but wasn't sure how I'd fire from that point

paper timber
#

before I go and write it myself, does Unity have actual decent support for Bezier/B-spline curves in-editor?

#

e.g. for setting pathing through the world

modest cargo
paper timber
#

shouldn't be difficult to implement, i'm just glad there's a display function already lmao

mossy canyon
#

I'm struggling with my sprites (whom have rigid bodies and box colliders) crash into each other and get stuck to each other. I've tried adding a little force, pushing them apart upon contact, but it doesn't seem to do much.

            var force = transform.position - target.GetComponent<>().transform.position;
            force.Normalize ();
            GetComponent<Rigidbody2D> ().AddForce (-force * magnitude);```
mossy canyon
#

SS of effect for reference

mossy canyon
#

Fixed it by adding a new material to my collider where I removed all friction

kind raft
#

Hey so i'm not sure how to look up what i'm trying to do. i have a bunch of animations for things like dust and effects. but i'm not sure how to play the animation alongside the player action. do i just make a new game object make a child of the player and put an animator on that with a trigger or bool?

covert whale
#

i usually use .Play() instead of the animator tree cus it seems easier

kind raft
#

that seems like a logical step. i recently learned that i can set animation state to be a certain INT and trigger specific animations on the player like that. I've only been at this for a week or 2 so i'm still learning all the best use of application.

covert whale
#

yeah i usually don't mess with the animation variables and transitions and states cus if u have lots of animations then the links can get messy

mossy canyon
#

Is it safe to assume that the Awake() method of a script is called upon Instantiate() ? I am trying to instantiate an object, then call a couple methods on it immediately after. These methods use variables from the object, that get assigned in the Awake() method. I am getting nullpointers though 😦

covert whale
#

one thing tho with using .Play is that before u play an animation u should check if it's already being played, u can achieve this by whenever u use Play store the animation in a string and check that against whatever u want to play later on

finite mist
#

I have a problem with building my game. When I test it inside Unity everything works fine. But when I build it and than run it you can only see the Square and not the platforms. Thanks for help πŸ™‚

covert whale
#

could u show ur scripts for the instantiated and the instantiater

covert whale
#

could u save it and build again

mossy canyon
#

@covert whale https://pastebin.com/tkkqqtTr <- script. Instantiation is done with

        InfoSheet infosheet = Instantiate(infoSheet, transform.position, Quaternion.identity);
        infoSheet.setHeader("Oak Tree");
        infoSheet.setText("The tree currently has " + currentHealth + "/" + totalHealth + " health left");
    }```
covert whale
covert whale
finite mist
#

Yea everything is there

covert whale
#

and what's in ur 01 scene

finite mist
#

How can I see thatπŸ˜…

covert whale
#

don't u have it open currently?

#

if u want to see what's in a scene then look for it in a folder and double click on it

finite mist
#

this one?

covert whale
#

yeah

#

oh i see the issue

covert whale
#

because i'm pretty sure it's just empty so unity will load on it and there'll be nothing there

finite mist
covert whale
#

do u mean to have ur SampleScene to be the first scene that loads

mossy canyon
#

@covert whale ffs .. thanks mr rubber duck! I was just being an idiot πŸ˜› I duplicated the variable name, essentially overriding the object I wanted to instantiate

#

@covert whale fixed now πŸ˜„ And working

covert whale
#

nice

covert whale
#

which scene do u have everything u want to play

#

SampleScene or 01

finite mist
#

Well when im inside 01 and I test it, it works fine

covert whale
#

untick SampleScene

#

this means that when u start the game it will start on 01

finite mist
#

Alright now it works thanks a lot πŸ™‚

white cedar
#

hey, guys this is my script to choose a point random, form a list. But I dont wanna him to choose the same point twice, how can i do that?

turbid heart
obtuse bridge
#

Kian, you'd need to remember, somewhere, the point you previously jumped to. Make a loop - pick a point. If it's different, quit the loop. Now update the "last point".

#

You also need to have a 'last point' at the start - a simple thing to do is use a point that's not in the list

#

if you never want to use the same point, do what Wytea says

turbid heart
#

ah, good point. I didnt think about if they wanted to use the same point again, just not consecutively

#

up to you, Kian

white cedar
#

ok guys, thank you so much πŸ˜„

obtuse bridge
#

I'm wondering if just making them game objects and laying them out with code is a reasonable solution

#

or if that'll have terrible performance

wide ginkgo
abstract olive
#

If they're tiles, you don't really have a choice.

obtuse bridge
#

they'd just be meshes - low poly

#

but even a 60 x 60 grid is 3600 of them

wide ginkgo
obtuse bridge
#

Ok, cool

#

to some extent I'm also wondering if the tilemap system is being maintained - I tried following tutorials and can't get the 2d extras to compile.

obtuse bridge
#

the github repo

wide ginkgo
#

Did you follow the Tilemap section in the readme? Different Unity versions require specific branches

obtuse bridge
#

ooh, no, thanks

#

I take it I should clone with git into the Packages directory instead of using the palette manager tool

wide ginkgo
obtuse bridge
#

package manager - brain fart

#

whoot

#

thanks

burnt ether
#

Hello guys, i'm trying to use OverlapBox for ground detection, and it works. The problem is that now i want to use DrawCube to see how big my OverlapBox is, but Gizmos isn't drawing.

#

I was using OvelapCircle and DrawSphere before and it worked, idk why DrawBox isn't.

covert whale
burnt ether
#

Right here.

#

If i use a DrawSphere it works, but i need a DrawBox since my collider detector is now a box.

burnt ether
#

It shouldn't be 0?

covert whale
#

what's the z value of the player object

burnt ether
#

0 as well.

covert whale
#

could it be that the camera doesn't render the gizmos cus of the z axis

#

does the player container have a z value that isn't 0

#

or the player object that the sprite renderer is on

tawdry kiln
#

what is this? I just downloaded and opened unity

burnt ether
#

The Sprite do is on a different layer.

covert whale
#

oh ok

covert whale
#

just to see if it works

#

because i think if the z is 0 then the box won't have a thickness

burnt ether
#

It doesn't. I drag the player outside the background to see if the background layers was giving me troubles, but it doesn't seems to be the case.

#

I just put 1 on the z axis, tho.

covert whale
#

it could be that the box is too small so maybe increase its size?

burnt ether
#

What's that? Haha

covert whale
#

i've run out of ideas i don't know

#

have u restarted unity

#

could be a bug with it

burnt ether
#

Maybe.

#

Didn't work.

#

I just don't know what to do as well.

#

At first i thought it was because my OverlapBox didn't have any angle, but it actually has nothing to do with my DrawCube. And the DrawCube function doesn't admit more arguments.

covert whale
#

could u make an empty gameobject and a new script with just

void OnDrawGizmos()
{
    Gizmos.DrawCube(transform.position, new Vector3(10,10,10));
}
#

just to try out if it works

burnt ether
#

Okay

#

Hmm, it works.

#

Even as a child of my player and with the Transform reseted, it works.

#

I guess im just gonna replace my groundCheck with this new object.

covert whale
#

if it works it works

burnt ether
#

So if i turn off the script on the gameobject.

#

And instead i try to do the same thing on the same script as my character controller

#

Gizmos doesn't draw.

#

On the other hand if i try to draw it from my groundCheck script, it works just fine.

covert whale
#

well the only difference is groundcheck.position

#

so it could be that

burnt ether
#

groundCheck is making reference to the game object i just created.

#

So, wouldn't it be just the same as if i write transform.position on the script attached to the object itself?

polar crystal
#

Anyone else ever encounter a sub-optimal rendering of tiles within tilemaps which live on the same layer? I thought that ordering the different tilemaps as seen in the screenshot would give one tilemap priority over the other. When starting up Unity there is a 50/50% chance it renders correctly or wrong, I can't find anything about this issue online though it would be a pain if I had to 'merge' the void blocks with the wall tiles because it's quite modular the way it's set up now. Any help would be greatly appreciated! (running 2020.3.12f1)

covert whale
burnt ether
#

Sure.

#

Ooh, i think i found something.

#

Here i'm trying to shortcut the Vector3 by adding a reference to the new Vector3. Just like how i have it set on my character script.

#

And nothing happens.

covert whale
#

oh so the vector3 is actually not defined

#

that's unfortunate

burnt ether
#

If i do it this way, it works.

covert whale
#

i've looked at the script so many times how could i not see that

#

well at least u found out

burnt ether
#

Remember the DrawSpheres? Those are predefined, and it works. So i asume i need to define what is Vector3 before the Draw.

covert whale
#

oh right

#

cus it's in the editor so start (or any other functions) aren't called

burnt ether
#

Now it's working.

covert whale
#

nice

burnt ether
#

Success. Thank you!

covert whale
#

u can also change the order in layer

polar crystal
#

The dark 'void' block and the walls are rendered by a separate tilemap renderer, but on the same layer and same order to enable me to draw walls over void tiles and make the void tile draw over the side of the wall on the left. I'm essentially combining different tiles into a single one.

#

I can imagine the renderer being confused as to what order to render in as it results in a stalemate, hence the 50/50 chance of getting it correct/wrong

tacit iron
#

How do I sense the horizontal and vertical movement speed of an ai?

covert whale
#

otherwise the renderer doesn't know what to do

polar crystal
#

As this would be the result of setting the blocks order in layer lower than the walls'

covert whale
#

i think combining the sprites together would be best

polar crystal
tacit iron
#

does anyone know how to sense the horizontal and vertical movement speed of an ai

burnt ether
#

Sorry, i haven't used AIs yet.

polar crystal
tacit iron
#

yes it does, thank you :)

stiff wind
#

Hello, I am using https://docs.unity3d.com/Manual/class-HingeJoint2D.html and trying to rotate sword(gameObject HingeJoint2D is on) via scripting. But I couldnt get smooth rotating like how the rotation when I turn on Use Motor. I want to get same rotating behavior but with just scripting. Here is my code, I just want to rotate but sword changes position relative to connected-rigid-body. How can I achieve this?

void FixedUpdate()
    {
        Vector2 anchor = swordJoint.anchor;
        Rigidbody2D attachedRigidbody = swordJoint.attachedRigidbody;
        Vector3 position = attachedRigidbody.transform.position;
        position.x += anchor.x;
        position.y += anchor.y;

        attachedRigidbody.gameObject.transform.RotateAround(position, zAxis, horizontalSword * Time.fixedDeltaTime);
    }
#

Just noticed, rotation works great until the sword hits some collider. Then it starts to move away from the player, but I want it to move with player. When I do the rotation with motor sword lifts the player instead of moving away.

#

the problem with motor, it ignores gravity. So I tried to rotate with scripting but now it behaves different on collision.

stiff wind
#

I figured out how they did it. They are enabling/disabling the Use Motor boolean field. But this way gravity does not work when player is rotating the sword. Is it impossible to achieve?

burnt ether
#

I have another question. Should i be calling this on the LateUpdate?

mossy canyon
#

Good morning πŸ™‚ I have a UI element, consisting of mostly Text and Button objects. The element is enabled and disabled (SetActive) whenever I click on something. I have also put a draggable script on it, so I can move it around. However, once I set it active, I can interact with it a few times, then it seems to "freeze", and stops responding. Any ideas what that might be?

covert whale
# burnt ether I have another question. Should i be calling this on the LateUpdate?

u should be calling input checks in update as to not miss any inputs but u should call any physics interactions in fixedupdate so to keep the physics consistent no matter the framerate
lateupdate is for if u want to do something in update but it relies on variables or methods set in another script's update, so u do that something in lateupdate instead

#

i would keep wannainput and wannaanimate in update and move checkcollision, climb and crouch to fixedupdate

covert whale
compact holly
#

hello, I'm getting confused in the transforms of Unity. Here in My picture, the snowman object should be on top of the box because I set the transform of it the same with the box. But I don't know why it has an offset?

#
    [SerializeField]private GameObject[] spawnPoints;
Vector3 newPos = new Vector3(spawnPoints[i].transform.position.x, 
                spawnPoints[i].transform.position.y + 3.0f,
                spawnPoints[i].transform.position.z);

            //instantiate then add directly to the list
            snowmanList.Add(GameObject.Instantiate(snowMan, newPos, Quaternion.identity));```
#

I'm really confused on why is there an offset on the position of my snowman

covert whale
compact holly
#

ahh yes, because I still want the snowman to be seen in the world that's why I offset it in the Y axis. I'm just worried on the x and z axis.

covert whale
#

can u show the hieararchy of the snowman object

compact holly
#

Well it is only spawn by the script. The script is placed inside the spawnPoint object

covert whale
#

yeah so can u play the game then click on the snowman object to see what its position is

#

in the hiearchy

compact holly
#

I have a debug for it, and it is constantly showing the right positions of the boxes(spawnPoints): -5,-5, 5,5, ..

covert whale
#

yeah i saw that

#

but i want to know if the snowman object has any children

#

because it could be that those are offset

compact holly
#

The snowman object has 3 children in it, 3 sphere objects

covert whale
#

are those offset

compact holly
covert whale
#

yeah so their x and y isn't 0

compact holly
#

but those are linked to a parent?

covert whale
#

yea

#

the transform that children show aren't the global position but the local position

#

the global position is the local position of the child + the transform of any parents they have

compact holly
#

ohh, I thought object that come from prefab will have its new pos going back to 0,0,0

covert whale
#

for example if u set the position of Snowman to be 1,1,1
the position of SnowmanBody1 would be 2.4, -1.6, 0.5

#

because that's its local position added to its parents position

compact holly
#

but it will still include the child pos

covert whale
#

yeah

#

so if u want it to be centred then set the x and y to be 0

compact holly
#

but is there a script for me to check the prefabs children and access its positions?

covert whale
#

yeah u can reference a gameobject's first child with
gameobject.transform.GetChild(0)

#

then to get the local position of that u could do transform.localposition

#

u could also just change the positions of the prefab to be centred on the parents object

#

like in the editor

compact holly
#

ahh ok, now I get it

#

thanks very much

covert whale
#

next time tho if it's not 2d could u post in one of the other channels

compact holly
#

ohh noo, so sorry. I thought I clicked the general code

covert whale
#

it's alright

still tendon
#

Help. After Loading the Scene on the Restart Button it spawns houndreds of enemies

turbid heart
still tendon
#

i cant post it

#

bruh

#

But this is how i am spawning the objects

turbid heart
covert whale
#

if u want to do it once at the start then do it in Start()

still tendon
#

yes

#

but it should repeat it

#

it should spawn enemy waves out of 6

covert whale
#

what have u set i to

#

it looks like it's at 0

still tendon
#

What have it set to 0

#

oh i

covert whale
#

at the top u've defined i as
public int i = 0;

still tendon
#

yes but it still spawns 6 enemies every 2 seconds. But after i click the restart button it doesnt

#

This is the normal game

#

But if i reload the scene on the restart button there is such an big amount of enemies

covert whale
#

restart button?

snow willow
still tendon
snow willow
still tendon
#

omg pls not

turbid heart
#

you're better off declaring a float as a timer and increasing it by time.deltatime.

#

if you have a restart button, it doesnt reset time.time to 0

still tendon
#

I want to spawn the 6 enemies every 2 seconds

snow willow
#

We understand

still tendon
#

i thougt imma do that with time.time

snow willow
#

I just told you the problem with that

#

it dosn't reset when you reload

#

just switch to timeSinceLevelLoad

wet owl
#

staff please, i need my friend unbanned HarryDevv#0001 his account was hacked and sent messages to people and all discords. please send me a DM we need to talk.

still tendon
#

But still thanks for your help

turbid heart
#

so weird that out of all the channels you picked this one

covert whale
mossy canyon
#

@covert whale the script is very simple

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

public class Draggable : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    [SerializeField]
    private bool dragging;
    [SerializeField]
    private Vector2 offset;

    public void Update()
    {
        if (dragging)
        {
            transform.position = new Vector2(Input.mousePosition.x, Input.mousePosition.y) - offset;
        }
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        dragging = true;
        offset = eventData.position - new Vector2(transform.position.x, transform.position.y);
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        dragging = false;
    }
}
#

This is the hierarchy

#

It's the LumberjackMenu that's giving me problems. It activates fine .. works for a bit, then stops working.

covert whale
tacit iron
#

how do I make my character get knocked back (after being hit by an enemy)

wintry stone
#

Im trying to make a damage over time function made by Dapper Dino, but whenever run it crashes

#
        {
            if (burnTickTimers.Count <= 0)
            {
                burnTickTimers.Add(ticks);
                StartCoroutine(Burn(_colliderHealth));
            }
            else
            {
                burnTickTimers.Add(ticks);
            }

        }
        IEnumerator Burn(Health health)
        {
            while (burnTickTimers.Count > 0)
            {
                for (int i = 0; i < burnTickTimers.Count; i++)
                {
                    burnTickTimers[i]--;
                }
            }
            health.Damage(10);
            burnTickTimers.RemoveAll(i => i == 0);
            yield return new WaitForSeconds(0.75f);
        }
#

Does anyone know how to fix it?

turbid heart
#

it looks like the while statement will run forever because you never remove from burnTickTimers in it @wintry stone

wintry stone
snow willow
snow willow
#

it can't run if the loop never ends

wintry stone
#

Ah I understand thanks!

still tendon
#

Why doesnt this work?

snow willow
still tendon
#

omgπŸ€¦β€β™‚οΈ thanks...

still tendon
#

How do i render my text(top right) over the rockets?

covert whale
#

is the text a UI element?

still tendon
#

yes

#

but the normal one and not the mesh pro version

covert whale
#

and are the rockets sprites or ui

still tendon
#

sprites

covert whale
#

do u have ur text in a canvas

still tendon
#

yes

covert whale
#

could u screenshot ur hierarchy

#

check if the canvas is on the layer ui

#

cus if it's not then it won't always render ontop of everything else as it should

still tendon
#

The rocket is on default layer and the text is on ui layer

covert whale
#

i don't know how a text object that's in a canvas could render below a sprite, unless the canvas was in worldspace

still tendon
#

it isnt

covert whale
#

what mode is it in

turbid heart
autumn crag
#

I am tasked to make a rope spawn between 2 objects with tiling .

  1. objects appear in random coordinates
    2)on 1st click nothing happens, on 2nd click the rope starts appearing (there's supposed to be an animation )
    I am not sure how to do this with a script, you guys got any ideas πŸ˜„ ?
still tendon
#

and heres the text

covert whale
turbid heart
#

Show inspector of canvas

still tendon
covert whale
#

try changing that to overlay

#

or change the sorting layer

still tendon
#

where do i change the sorting layer and to what should i change it

covert whale
#

in the canvas component u can see 'sorting layer'

#

if u click on it there should be a drop down menu and u could add a sorting layer

still tendon
#

i tried but if i put it on the new layer i cant see some parts of the game

covert whale
#

wdym

still tendon
#

Cant see floor player and enemies

covert whale
still tendon
#

idk

covert whale
#

could u show what u mean?

still tendon
covert whale
#

try using a separate canvas that's on the default sorting layer or use a non-ui element instead

still tendon
#

okay

young leaf
#

having a tough time setting up a collider trigger (sounds like beginner code, I know). setting isTrigger = true does not prevent other objects from colliding with it, as the docs suggest. the only way I am able to have objects (i.e. the player) pass through the trigger is to completely disable the collider. with the collider disabled, OnTriggerEnter2D is not sent when objects pass through it. I think some of these problems might stem from the fact that the player uses both colliders and raycasters (this is not my game, I am modding a game). One final point: the unity-explorer does not see the OnTriggerEnter2D method at all in the component I have added to the object (code for this below, in case I made some simple mistake):

    public class LaserHurtbox : MonoBehaviour
    {
        public void OnTriggerEnter2D(Collider2D other)
        {

            UnityEngine.Debug.Log("Laser Triggered");
        }
    }

any help / ideas for debugging would be greatly appreciated, I'm a bit ashamed to admit that I've been stuck for a while on this

turbid heart
covert whale
#

is it that it doesn't print

#

also i think ontriggerenter can't be public

#

i think it's private

young leaf
#

sorry I guess I didn't explain it well enough. the issue is two-fold: objects still physically collide even when isTrigger = true (the docs suggest that objects should pass through triggers once this is set) - the only way I'm able to get objects to pass through the trigger is by completely disabling the collider, in which case the method is not called

young leaf
turbid heart
#

Well, if there’s no collider of course the message won’t get called, that’s a given. The real odd part is collisions still happening with triggers

young leaf
turbid heart
#

Can you show the inspector of the objects involved?

young leaf
#

sure thing, one sec - anything specific you need to see?

turbid heart
#

I’m not sure yet to be honest

covert whale
young leaf
young leaf
#

and the object I want to act as a trigger

covert whale
young leaf
#

thank so much for both of your help so far by the way

covert whale
young leaf
#

ah, of course

covert whale
#

click on the default and u can see a drop down menu and ignore raycasts should be there

young leaf
#

unfortunately, no change

covert whale
#

ok so do u know where the code is that does the raycast

young leaf
#

sort of - theres at least 4 different raycast components for the player and at least 2 colliders

turbid heart
covert whale
#

i'd go to each raycast and see if there's already a layermask used and if so then make sure it doesn't include the ignore raycast layer

still tendon
#

Hello. Why doesnt my Post Processing work?

plush coyote
#

turn on Is Global

#

and then try putting this main camera in the post processing layer, if it isnt

#

but that whole layer thing is for volume blending

still tendon
plush coyote
#

I dont even know what that means

#

you dont put layers into things, you put things into layers

young leaf
#

also does it help or hurt to add that the thing collides with itself for some reason?

covert whale
#

if i'm being honest i think that maybe ur trailrenderer is buggy

#

i'd try to do it using the normal unity collider

young leaf
#

yah, I've been thinking it might be that - I think the code is several years old so perhaps a unity update broke it

covert whale
#

have u used it on anything else?

young leaf
#

I do really appreciate your help though - I'll see what I can do with just plain collider2D

#

nope, nothing else

#

(and unsurprisingly, everything else works)

covert whale
#

yeah so no way to know if it works nowadays

covert whale
#

i think there's a setting that maybe useful

young leaf
#

ooh do tell

covert whale
#

if u go to edit > project settings > physics 2d and enable auto sync transforms

#

i think that's a setting that used to be on by default in previous versions of unity but is turned off in recent ones

young leaf
#

ah, in the unity editor? I only have access to the raw assembly of this game lol

covert whale
#

oh

young leaf
#

yah that makes everything about 100x harder haha

covert whale
#

alright

#

good luck with that

young leaf
#

thanks again!

covert whale
#

i was wondering why the inspector looked weird

#

np

marble badger
#

does anyone know any good tutorial video to learn how to create a finite state machine(class based not using enum and switch) for a 2d platfomer.
Pls let me know if you do

tacit iron
#

can see object in editor but not in game?

turbid heart
#

I don’t know if it’s good because it’s the only one i ever followed

autumn crag
#

anyone knows why the rope looks so sqeezed?

still tendon
#

I am kinda scared about my Game. If i play it on an other Screen size it looks completly false

#

This is how it looks like on Free Aspect

#

But this on Full HD

covert whale
#

the object should have a larger z value than the camera in order for it to be in front of the camera

covert whale
#

don't worry about it being part 20 he starts from the beginning

covert whale
# autumn crag

your y scale doesn't match the x scale meaning it's stretched on one axis but not the other

honest python
#

does OnMouseOver and stuff work on FixedUpdate?

#

or every frame?

tacit iron
#

The only issue I can think of is because the script is on a prefab

covert whale
#

could u show the script

tacit iron
covert whale
tacit iron
#

The bullet, which is what it's on. on collision with the enemy will give you mana

honest python
covert whale
tacit iron
covert whale
#

so public void

tacit iron
#

lol

#

I'm a bit dumb for that lol

covert whale
#

it's alright everyone does stuff like that

tacit iron
#

lol

mossy canyon
covert whale
mossy canyon
#

Looks good

#

All buttons are set to interactable

#

could it be that a raycast box ( ? ) isn't being moved? It seems the box remains responsive as long as I don't move .. or if I just move it within a very limited area..

covert whale
#

i'm not sure what the problem is

#

i made a button myself that disables and enables another button and even if i spam it multiple times the other button still works

mossy canyon
#

It's really weird πŸ€·β€β™‚οΈ But it definitely seems like the component keeps operating as long as I keep it in a very focused area. If I move its position, it will freeze

covert whale
#

u could do rectTransform.ForceUpdateRectTransforms

#

just to see if that changes anything

mossy canyon
#

Um, well, I just moved the component down the list (to the bottom of elements on the canvas), and now it seems to be working perfectly

covert whale
#

wow

#

that's really weird

#

glad it worked

mossy canyon
#

Really happy it's working - no clue how! haha

#

Not sure if that's a good thing or not

covert whale
#

if it works it works

mossy canyon
#

I get that at work quite often. "Why did you do it like this?", "I dunno! It just worked, then I left it alone"

honest python
#

how do I change the sprite a particle system emits in code?

copper seal
#

I don't see that property in the docs though

west sail
#

Hello, I would ask about how to do one thing. I would like to do destructible wall like in Tanks 1990 game and I don't know how to achieve that. I came across sprite mask which means I would need to create new object every time I shoot a wall. My second thought was to slice a sprite to 4x4 pixels, combine it into one game object and call Destroy on collision. What would be the best way to achieve such destruction?

balmy willow
#

Hey, I make a 2D game, but i do the code and my player don't move, if someone want i can send my code

lean estuary
#

@balmy willow If you are asking a question post the code and highlight the problem in detail.

balmy willow
#

i dont know what is the problem it s that*

#

wait

hollow crown
lean estuary
balmy willow
#

Can i send by a text block ?

lean estuary
#

So what's the question?

balmy willow
#

why my player don't walk ?

#

Its a 2D game

#

if you want to see what i put in the script on Unity

#

I search in the code but i see nothing

fleet ledge
#

@balmy willow do the float horizontalMovement change while ingame?

balmy willow
#

where can i see ?

fleet ledge
#

you have to create a new public variable and set horizontalMovement to it

#

so u will see in the inspector

balmy willow
#

here

fleet ledge
#

so

#

if the float isn't the problem

#

problem here

#

Vector3 targetVelocity = new Vector2(_horizontalMovement, rb.velocity.y);

#

vector3 = vector2

#

logic

#

x)

balmy willow
#

I change the code

balmy willow
fleet ledge
#

replace it by Vector2 targetVelocity = new Vector2(_horizontalMovement, rb.velocity.y);

balmy willow
#

ok ok

#

thanks

fleet ledge
#

np

#

and the rb

balmy willow
#

what i change ?

fleet ledge
#

i see u had put a Rigidbody2D

#

and in ur code Rigidbody

balmy willow
#

so i put Rigibod2D

fleet ledge
#

so in the code on the top replace rigidvody by rigidbody2D

#

and

#

the vector3 at the bottom by vector2

#

wait

#

wtf

balmy willow
#

I already have Rigibody 2D

fleet ledge
#

wait

balmy willow
fleet ledge
#

or replace every Rigidbody2D or Vector2 by Rigidbody or Vector3

#

to make everything 3D

#

but it will keep the game 2D np

balmy willow
#

ok i test

fleet ledge
#

ok post the error if there is

balmy willow
#

doesn t work

fleet ledge
#

and the inspector pls?

balmy willow
fleet ledge
#

put the rigidbody2D in the case "rb"

balmy willow
#

i cant

fleet ledge
#

or change everything to 3D if it didn't work (rigidbody2D = rigidbody ; box collider 2D = box collider etc...)

#

and put the rigidbody in rb

balmy willow
#

ok i test

#

dosn t work

fleet ledge
#

?

balmy willow
#

my player fall

#

wait i know

split portal
#

if you making 2d game, just stay in 2d

balmy willow
#

so i need to restart

fleet ledge
#

idk how to do smooth damp in 2D

split portal
#

but then whole level has to be done in 2D and 3D. platforms etc

balmy willow
#

If i need to put Vector 2 i need to put Vector 2 here ?

turbid heart
balmy willow
#

i just can jump

split portal
split portal
#

make sure all your vectors, rigidboirs, colliders are all in 2D. you cant mix them with 3d

balmy willow
#

i put everything in 2D and that appear

fleet ledge
#

restart the simulation

balmy willow
#

i just can jump

#

nobody have a code already test ?

#

for look what's the pb

fleet ledge
fleet ledge
split portal
fleet ledge
#

but actually keep it

balmy willow
split portal
#

mixed vectors

balmy willow
#

no i change

split portal
#

can we see your variables

covert whale
#

it makes life easier

balmy willow
#

that ?

balmy willow
covert whale
#

under 'ide configuration'

balmy willow
#

ok

split portal
#

maybe Vector 2.smoothdamp is problem... maybe it exists in 2d or not???

#

it does

balmy willow
#

so what can i do ?

split portal
#

paste your whole code again

balmy willow
#

wait i do an upgrade

#

it's ok ?

covert whale
covert whale
# balmy willow

if u've configured ur vs properly then it should've autocompleted with the right spelling

covert whale
#

d and t are capitalised

balmy willow
#

But wait i retest

balmy willow
covert whale
balmy willow
#

what ?

covert whale
#

just to see if it's configured

balmy willow
covert whale
#

some code of ur script

covert whale
balmy willow
covert whale
#

yeah it's not configured cus it's not the right colours

balmy willow
#

oh ok

covert whale
#

if it was configured Vector2 for example would be green

split portal
#

you have an underscore _horizontalMovement. is that supposed to be there?

turbid heart
split portal
#

ok then

#

am just learning

#

is this still the error?

balmy willow
#

no i have this

hollow crown
#

If your IDE was fully configured it would autocomplete that and you would not make basic capitalisation mistakes

balmy willow
#

i instal all

#

extension

split portal
#

I use VS because code had extra steps to configure for intellisense

covert whale
balmy willow
#

yep

split portal
#

You could fix the delta time capitalisation, or undo it...

balmy willow
#

i need to restart i thinl

covert whale
#

restarting would be good

split portal
#

smoke...use Visual Studio if you can

balmy willow
#

a lot of pb

covert whale
#

i think these errors should be underlined in red in ur vs

#

go to ur code and check those lines

balmy willow
#

i don t understand, i install all of these extension but no

covert whale
#

if vs code doesn't work for u then u could try vs

split portal
#

use full fat visual studio

balmy willow
#

it s ok

#

i find the error

#

i find why i have all of these error

#

i just need to go im sorry

#

thanks at all

split portal
#

bye

still tendon
covert whale
still tendon
#

That i see parts of the scene on full hd

covert whale
#

oh wait i wasn't replying to that

#

i was replying to another person

still tendon
#

oh

#

lol

#

i thougt you replyed to mine

covert whale
#

i'm not sure but u could set ur canvas to scale with screen size?

#

and check if ur background image is stretched

still tendon
#

Yeah i could but i want it to fit to every screen size

#

wait i can send you pics of the problem

#

This is how my game should look like

#

But if i change the game view to full hd it looks like this

#

so basically everything zooms out

covert whale
#

ok so what i'd do is set the resolution to be 16:9 and adjust ur game to that

#

then set the canvas scaler to scale with screen size and put a 1600:900 resolution as reference

still tendon
covert whale
#

it's a component on ur canvas object

still tendon
#

is it this rect transform thing?

#

with the arrows in the box?

covert whale
still tendon
#

okay thanks

#

than i will try that out

#

yes okay thanks it works now fine

#

also on 4k

#

thats cool

still tendon
#

Hello. what code do i need if i have 2 toggles and only one can be true at the time

misty kelp
#

I would like to make a game where I play as a kangaroo escaping from the villain.

#

Please answer me.

covert whale
#

if u want to know how to make a game then look for a tutorial there are plenty of them out there

#

if u have a specific question relating to how to code then come back here

misty kelp
#

I don't know how to code the game.

covert whale
#

that's not a very specific question

strong spire
#

Out of the topic question, how can i change scenes after i logged in? PHP backend

covert whale
woeful sentinel
#

this another way to do it but with slightly different use case

bool wasPressed = false;
bool wasPressedTwo = true;

wasPressed = !wasPressedTwo;
#

and this another funky way of doing it <- Do this only if you want to show off in front of your girlfriend!

bool wasPressed = false;
wasPressed ^= true;
#

welcome to my c# class πŸ™‚

covert whale
#

hehe

woeful sentinel
#

the last one, is widely known as XOR operator, just in case you're wondering πŸ™‚

still tendon
#

why doesnt this work?

covert whale
#

oh a togglegroup

#

i misread the question

still tendon
#

sry my english not the best

covert whale
#

it means to read something the wrong way

#

so i thought that toggle was like a bool

still tendon
#

oh okay

#

but do you know how i get which button is selected?

covert whale
#

i'm not sure i haven't used toggles or togglegroups

still tendon
#

okay

compact knoll
#

you need to attach a toggle group component to a game object then set the Group value on each of your toggles to the game object that has the toggle group component. That makes it so that only one toggle in the group can be selected at a time

#

quick example of that would be this. the Toggle Group component is attached to the canvas here so i set the group for each toggle to be the canvas so only one can be selected

still tendon
#

Why cant i drag the player object in there?

#

Is it becaue player is in another scene?

compact knoll
#

yeah can't drag something from another scene into an inspector field, has to be same scene. You can reference the player game object another way though. this video gives a few ways to reference gameobjects
https://www.youtube.com/watch?v=ymq2AUckws0

Check out the Course: https://bit.ly/3i7lLtH


Learn 5 different ways you can connect your gameobjects in Unity. Ranging from direct references & singletons to scriptableobjects and injection.

More Info: https://unity3d.college - (and where you can submit your own questions)

Join the group: http://unity3d.group

β–Ά Play video
still tendon
#

doesnt work for me

still tendon
#

Anyways. I exported it now and you can play it

white cedar
#

how can i make this for funcional?

covert whale
white cedar
covert whale
white cedar
#

2

covert whale
#

so u don't need the &&

#

just do

for (int i = 0; i <= dialogue.Sentences.Length; i++)
{
    
}
white cedar
#

i got the same error : Object reference not set to an instance of an object

covert whale
#

could u show ur whole script and what line does it point to?

white cedar
covert whale
#

u've only set sentences to be a new queue but not names and images

white cedar
#

oooohhh thank you, thank you !

supple gazelle
#

Hello everyone I just downloaded Unity, I have a good experience with coding so I think it's about time I use Unity. I was wondering which tutorial series on youtube would be the best to learn how to make a 2d game with Unity

topaz root
#

Probably Brackeys's. It's a good introduction.

jolly bloom
#

anyone got some 2d movement code

late viper
jolly bloom
#

oh, is this the wrong place?

#

...

#

uh

late viper
#

you're better off just googling

compact knoll
# jolly bloom oh, is this the wrong place?

if you don't know how to code it yourself, you should check out some tutorials. Brackeys on youtube is suggested a lot and has some good tutorials, there are also some great (and free) courses on udemy for 2d games. don't rely on random people to just give you code for free

late viper
#

you won't learn anything by copying

strong spire
#

Hello guys/gals so i'm working on a script that will redirect me to another scene in Unity 2D, all the tutorials i've watched so far are obsolete codes, so here i am.

here is my code:

#

on a script that will redirect the user if the credentials he/she inputs are correct*

still tendon
#

hello. i coded this

#

But i am getting a lot of errors. Why?

pearl creek
#

Guys, need help pls! I want to separate my view content from my data content, so i have data prefab which refer view prefab through Addressables. But it is a little bit uncomfortable to set data without seeing view. What i want is to fake sprite rendering of refered prefab to my data prefab. My first try was to draw texture on gizmo when gameobject is selected and load asset by addressables guid. Loading works well, but i can't find proper way to render sprite in scene view (drawing texture through gizmo gives strange result, when texture snapping to int screen coordinates). Anyone knows how to do it right and is it possible?

compact knoll
still tendon
compact knoll
#

if the issue is the player gameobject, then make it not static

#

also i'm pretty sure you don't need to check if the player object is null at the start, just assign the value in start instead of checking if it is null

still tendon
#

but i cant drag the gameobject from the other scene into this

#

so i am doing this static

#

i just cant find a solution to get my object player from one to the other scene

compact knoll
#

make it a prefab and just instantiate a clone. you can save any stats that change into a scriptable object or save it in another persistent class. or you can call don't destroy on load so it doesn't get removed when you switch scenes. You can't find an object that isn't in an active scene using the gameobject.find methods

still tendon
#

what is a prefab

compact knoll
#

you may want to check out some basic Unity tutorials to better understand how to utilize the editor to its fullest

still tendon
#

okay

#

watched a tutorial now

still tendon
compact knoll
#

only if you are passing that game object into the next scene rather than just making a new copy of the prefab.

wanton sparrow
#

Hey guys im making a platformer game and im having a problem. My player sprite turns small while in animation. can anyone help me

#

Help me please

#

:((

abstract olive
#

Remove any scaling from your animation then?

wanton sparrow
abstract olive
#

The actual problem is that your gameobject is not 1,1,1 scale.

#

And your animation is expecting it to be, and you have a scale property in the animation that is adjusting the scale.

wanton sparrow
#

So how to fix it?

abstract olive
#

Either adjust your animations so the scale properties they're animating are in line with the scale of your gameobject.

#

Or vice versa, making the gameobject scale work with the animation.

ionic halo
#

Guys on the edge of box colliders, circle colliders act different than the physics2d.CircleCast

#

Im using physics2d.circlecast in order to find the trajectory prediction of the circle

#

However as I said if thats the edge of the box collider this prediction and the real movement may produce different results

#

What can I do to predict more accurately?

honest python
#

how do I put 2d Lights behind an object?

#

or well behind a masklayer?

untold phoenix
#

How would I get a 2d map like google maps in unity that can have locations and stuff marked on it? But not google maps because the API costs money

mighty oracle
#

What’s the difference between 2D and Mobile 2D

modest cargo
#

Templates?

#

Mobile 2D template starts with Android Logcat and Mobile Notifications packages installed
and apparently some project settings already configured for mobile platforms

weak sand
#

hello i need some help with the collision on unity2D i have a test where the player is a white cube and there a ground but i want to know how to make the player and the ground collide. also i want the player to have gravity but not the ground

hollow ether
hollow ether
# weak sand

The ground should be Kinematic
That β˜‘οΈ makes it a static object which won't move

hollow ether
# weak sand thanks

you're welcome ^^
not sure if that was 100% how it worked but give it a try πŸ˜„

#

perfect

mighty oracle
white cedar
#

is it possible to know how much time this take?

late viper
white cedar
late viper
#

uh, ok? whats your point

#

thats why you're trying to time it, no?

white cedar
#

because I have 2 text

#

one for the name of who is talking and other to the dialogue

#

and sometimes, the first name already disaparead and the dialogue isnt complete

late viper
#

thats sounds like you're not toggling something correctly rather than a timing issue

white cedar
#

hummmmm gonna check O.o

gentle marsh
#

Hi I'm having trouble understanding the rule title system. I understand it's a way to make custom and easy to use brushes for painting tiles in a scene that automates the process of adding certain tiles.

But the rules system just doesn't make sense to me. I don't understand what the main sprite represents and how the additional "rule" sprites correspond to the red and green arrows or blanks.

#

Everytime I watch a tutorial or read the documentation my mind just gets stuck and I don't know if I'm just dumb or if it's really that complicated... I can't wrap my head around the concept.

cosmic olive
#

Most everyone is asleep right now I imagine, and though you said you've been watching tutorials I must ask. Did you check brackeys?

gentle marsh
#

I can wait till the morning. But please reply to me if it's been a while after my response so that I can get notified. Or ping me I don't mind

cosmic olive
#

I'm not sure he has one that directly applies though he does have a video covering tilesets.
https://www.youtube.com/watch?v=ryISV_nH8qw&t=29s
If not that then maybe: https://www.youtube.com/watch?v=dd4KrKCa3Yg

Learn how to use the Tilemap tools in Unity to easily create cool 2D levels.

Watch TILESET in Photoshop: https://youtu.be/aaEEujLtsr8

● Download Tileset: http://downloads.brackeys.com/tutorials/TilesetExample.psd

● Extra Features: https://github.com/Unity-Technologies/2d-extras
● Extra Examples: https://github.com/Unity-Technologies/2d-techde...

β–Ά Play video

An in-depth but easy to follow tutorial on how to set up and use the rule tile in your game, starting with an empty project.
My music channel: https://bit.ly/3dFq3Hf

Artist who made the tilemap (Eli): https://bit.ly/376cmyM

#Unity #tutorial #rule_tile

β–Ά Play video
gentle marsh
#

I was watching that

cosmic olive
#

Essentially the arrows define, whether they should merge with a tile on that side.

gentle marsh
#

But I still couldn't understand. Maybe I'm sleepy or there's something wrong with me

cosmic olive
#

Green means it should merge, red means it should stand alone that the edges should not connect.

gentle marsh
#

Ah

#

You mean it should merge with whatever is inside the arrow or outside of it?

cosmic olive
#

If the tile should connect with the one on it's left, place a green arrow on the left of the 3x3 grid.

#

inside of the arrow

#

Technically

#

If you're seeing the gray center as the current tile.

gentle marsh
#

The gray circle or sensor represents the current rule tile and not the default Sprite?

cosmic olive
#

The default sprite should be to the right of the 3x3 grid

#

Hopefully you've already sliced your tilemap correctly in which you'd be ready for that part.

gentle marsh
#

But there's a default sprite at the top and then the tiling rules have their own sprites

compact knoll
#

the default sprite is just what is shown in the tile palette

cosmic olive
#

The tiling rules are the ones you've sliced. The default tile.. ^

#

Which you could just set to a center piece with four edges if that helps

gentle marsh
#

?... The sprites I'm pulling are from my tiles which are all sprites that I've spliced

#

Ok...

#

I'm sorry.. it still doesn't make sense to me...

cosmic olive
#

Red light green light

#

Red light means no touchy, the edges do not connect and become a different type of sprite.

#

The green light means touchy, the edges connect and change the two sprites to be connected.

#

To "appear connected"

gentle marsh
#

Hm

cosmic olive
#

For now I recommend some sleep, atleast for me personally. Perhaps with a fresh mind it'll click.

gentle marsh
#

I was just about to say that

cosmic olive
#

If I can, I'll think of a better metaphor

gentle marsh
#

Thanks. It helps me understand if I think of it as a person. Maybe I don't understand the actual objective of this tool..

cosmic olive
#

Badduck has a good visual for it

gentle marsh
#

Goodnight I guess

#

Aye

cosmic olive
late viper
#

its just to make painting tilesets easier

gentle marsh
#

I'll watch it again.

late viper
#

so you don't have to manually place tiles yourself

gentle marsh
#

Aye

cosmic olive
#

2:38

#

Depends on the scale, but honestly. I hear you

late viper
#

so you can say, "hey, I want this area to have a bunch of tiles", and unity will figure out which tiles go where based on your ruleset

gentle marsh
#

Right

cosmic olive
#

You define the rules now, so you can paint freely later.

gentle marsh
#

Like Mario maker except I'll be in control of now they merge

cosmic olive
#

Never tried, but I think so yes

gentle marsh
#

Ohhh so I don't need to add a default sprite

cosmic olive
#

Correct

#

You may leave it empty, it only serves as a visual FOR YOU alone, in the editor.

gentle marsh
#

What do you mean a visual? Oh like it's not actually a placed sprite. It's more like a cursor

#

That makes so much more sense...

#

So I should make it something generic and looks obvious not like a sprite I'd use for the final product

cosmic olive
#

Personally, I would use the center piece that is placed when there are no neighbouring sprites

#

As for what you should do, I guess that's up to you.

#

Some leave it blank entirely.

gentle marsh
#

I understand now

cosmic olive
#

woot woot

gentle marsh
#

Thank you wizard of oz...

cosmic olive
#

oh no not again

#

but you're welcome, glad I could help you understand

gentle marsh
#

I will use blank or something that looks debuggy so that I understand

cosmic olive
#

cool cool : )

maiden forge
#

How do i move my camera in 2D on the editor screen?

cosmic olive
#

Jayyyyy

#

how dare youuu

#

you never responded to my first recommendatin