#๐Ÿ’ปโ”ƒcode-beginner

1 messages ยท Page 377 of 1

swift crag
#

if you have Interpolate enabled

rich adder
#

UnityThings โ„ข๏ธ

wintry quarry
#

Ah maybe that

swift crag
#

actually, that might not even work either

#

If you want to continuously rotate a rigidbody use MoveRotation instead, which takes interpolation into account.

wintry quarry
#

for some reason, this works in Update to make smooth rotation.

#

I agree the docs disagree

#

but this is Unity

swift crag
#

It will be a lot better than trying to set the transform's rotation when the rigidbody is set to interpolate

#

since that causes you to fight with the rigidbody

summer shard
#

uhhh it works now

private void HandleMouse()
{
    float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.fixedDeltaTime;
    float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.fixedDeltaTime;

    cameraLook.y += mouseX;
    cameraLook.x -= mouseY;

    cameraLook.x = Mathf.Clamp(cameraLook.x, -85f, 85f);

    cameraHolder.localRotation = Quaternion.Euler(cameraLook.x, cameraLook.y, 0);
}

private void Update()
{
    HandleMouse();
}
swift crag
#

well that's just wrong

rich adder
#

you should still not have deltaTime on inputs

summer shard
#

ik

#

but it works

swift crag
#

you're using fixedDeltaTime in a method you called from Update

#

and it's still wrong to use delta time at all

#

just get rid of it and divide your sensitivity by 50

#

also, note that this is exclusively rotating the camera holder

#

it's not rotating the rigidbody at all

#

so your player isn't going to turn to face the direction you are looking

summer shard
#

uhh yea it kind of works

#

thanks

swift crag
#

i can only do so much to stop you from doing objectively wrong things here

wintry quarry
summer shard
#

i did that

spice pendant
#

hi i have wierd issue, i am using TextMeshPro i added font, when i create new material from default shader and color it green it works, but when i rename that material cuz i dont want to hav SDF 1 2 3 45 i want to have greenOutlineFontShader, when i rename it i cant select it as mterial in textMeshPro in inspector, wtf? it all works until i rename it

rich adder
#

I love Unity's "Do as I say not as I do" approach

sonic mango
#

Any noobs in USA timezone interested in teaming up with other noobs for a small project?

eternal falconBOT
sonic mango
ruby flower
#

anyone tips to learn coding in unity i find that most tutorials write the code and let you copy it and i want to learn how to do it

eternal falconBOT
#

:teacher: Unity Learn โ†—

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

halcyon geyser
#

Roll-a-ball tutorial

ruby flower
rich adder
ruby flower
#

i followed the roll a ball tutorial but they give you the code

#

and you can't figured it out on your own if you try

rich adder
#

some of the vids are bad at explaining the code

ruby flower
#

yeah but had it with some unity learn things to

rich adder
#

check the stuff pinned in this channel

ruby flower
#

and i dont find a place really how to learn it

#

it is mostly copying the code

rich adder
#

explains both Unity - specific functions and regular c# stuff

ruby flower
#

ima check it out ๐Ÿ˜„

#

thank you

halcyon geyser
#

Theres plenty of simple and easy ideas which you can code to ur own imagination

rich adder
#

np. All you need is the very basics on how to read c# code, the rest is literally reading the documentation

#

docs explains(usually) what each function in the API does

ruby flower
#

yeah i checked visual scripting out to see some functions to XD

#

and other things

#

didn't knew before it stood in the docs

#

does someone recommend some good books to learn from?

rich adder
#

books are meh

#

look up ones on traditional c#

#

those are way better than unity ones

ruby flower
#

yeah

#

which do you recommend from traditional c#?

rich adder
#

mostly just theory stuff but you can find those with e-books these days

ruby flower
#

but i can read the code i find that simple but to make it yourself idk where to start

rich adder
#

hey mention a few books. But these are probably stuff you should worry after you learned how to do 2+2 on the computer

#

to make it yourself you think of what you want to do then lookup the functions you need through the docs/googling

ruby flower
#

oh

#

i understand now XD

rich adder
#

coding is literally problem solving

#

how do I solve this problem

rigid tundra
#

I dont understand whats wrong

ruby flower
rich adder
eternal falconBOT
rich adder
#

this is a unity coding channel

rigid tundra
#

ty

woven crater
#

is this look wrong?

rich adder
rich adder
#

are you having an issue or something

ruby flower
wintry quarry
#

it doesn't look inherently right or wrong - although those variable names are pretty bad

rich adder
#

oops

wintry quarry
#

Stat6??

#

It's being multiplied by a V3

rich adder
languid spire
woven crater
# rich adder maybe ?

im having a player manager that couple with PlayerStat/playerweapon/playerinventory/etc. and when a script that needd value from another script i get it through player manager just afraid its gonna be a noddle of coupling ๐Ÿ˜…

ruby flower
woven crater
ruby flower
#

but makes it more difficult

polar acorn
rich adder
#

numbering stats notlikethis

woven crater
#

just placeholder ill define each one when im theree

woven crater
rich adder
#

accessing something many layers deep isn't necessarily coupling

#

just high level abstraction

past lichen
#

If anyone has a tutorial on implementing Steam achievements using Unity VS, can you ping me?

woven crater
#

does SO only to contain data do i want to define method in there for anyreason?

rich adder
#

SO can have methods

#

think of them as a fancy static class that unity treats as an asset of sorts

ruby flower
rich adder
#

when you install .NET SDK restart your PC (very Important)

woven crater
#

hmm it does make a whole lot clearer to think them as static class

#

thank you

ruby flower
#

or x86

rich adder
ruby flower
#

oops

#

XD

#

does it automatically restart

#

or

rich adder
#

nah you gotta do it iirc

ruby flower
#

iirc?

rich adder
#

if i recall correctly

ruby flower
#

im going to restart my desktop then

#

Need to Update Some drivers to ๐Ÿ˜ฆ

brave pecan
#

hi everyone. i made a quiz game. everything works without problem when i run game in unity. But after i builded my game, game doesnt work correctly. (questions are not showed when game started). What should i do i dont know what could be problem is? As i said i can still play in unity. but build not working right.

rich adder
slow hollow
wintry quarry
brave pecan
#

thanks guys i will try it

slow hollow
#

Try to add ur phone resolution in the editor and try playing in that

final kestrel
#

When actually does OnAfterDeserialize work? I was watching something and the dude switched the item on a database scriptable object and it updated itself?

#

I read the docs I did not understand why it happened

swift crag
swift crag
rich adder
swift crag
#
private int currentHealth;
[SerializeField] int maxHealth;
#

you might want to write maxHealth into currentHealth after deserialization

#

and yes, the page for ISerializationCallbackReceiver explains what happens

languid spire
#

It's a good way of rebuilding Dictionaries without using 3rd party tools

final kestrel
#

Yeah he is using dictionaries inside

swift crag
#

OnAfterDeserialize is the very first moment you can safely use the serialized lists to build the dictionary

#

Doing that in a constructor would be too early.

languid spire
#

so onbeforeserialze splits the Dict into 2 Lists and onafterdeserialize reconstitutes the Dict from the Lists

final kestrel
#

all right thanks.

ruby flower
rich adder
#

just making a cs files does nothing

ruby flower
#

oh XD

#

that explains it

rich adder
#

You need the assemblies and such

languid spire
rich adder
#

create a script from unity then double click it, you will find all the Unity ones (hopefully)

#

make sure its all setup in External Tools

ruby flower
#

i did that now ๐Ÿ˜„

#

oh i see it now

rich adder
#

nicee

ruby flower
#

nvm XD

rich adder
#

regen project files too , it might

ruby flower
#

i had 2 visual studios on XD

#

i see it thank you so much this is going to make it easier

rich adder
#

it really does

ruby flower
#

damn i have deja vu abt this

#

this happend before i swear XD

rich adder
#

nahh that just means your brain unlocked a new achievement UnityChanLOL

ruby flower
#

XD

#

damn i am learning so much now so quick XD

#

asked chatgpt what void meant now i am reading his code and trying to understand it what you said earlier

#

i learned about recalling an event to idk how to explain it

rich adder
ruby flower
#

oh no XD

#

was some simple things

rich adder
#

at least as beginner is not a good way to start, it will mislead you

#

or show bad habits

ruby flower
#

oh okay i wil not use it ๐Ÿ˜„

#

well for learning

#

trying to make smth simple so i am asking for a really simple game idea

rich adder
#

yeah use it for other stuff , learning aint one of them

barren vapor
#

damn

ruby flower
languid spire
barren vapor
ruby flower
#

zeker XD

rich adder
ruby flower
#

want smth 3d XD

#

or not

rich adder
#

make a 3d version of them

ruby flower
#

should i make 3d or 2d

#

๐Ÿ˜ฎ damn good idea

cosmic dagger
#

Flappy bird is always a great first project . . .

ruby flower
#

then i am going to start with flappy bird

#

i learned blender so i can make a cool model ๐Ÿ˜„

rich adder
#

angry birds gets no more love ๐Ÿ˜ฆ

magic pagoda
#

I have this function connected to an Input Field, but the input doesnt change when I hit enter... what am I doing wrong?

cosmic dagger
#

I'd say do that, then Galaga or Gradius clone . . .

magic pagoda
#

thank youu!

ruby flower
#

and i need to make multiple maps and a physics engine

rich adder
#

playing w/ physics never get boring

ruby flower
#

yeah true

#

i can go make angry birds to

#

is procedural generation hard in unity

#

prob yeah XD

#

because otherwise you need to make a lot of levels

jovial forge
#

Quaternion.Euler(x, y, z) Appears to be setting rotation in world space. Looking through the API I'm not finding how to change the rotation based on the parent

ruby flower
#

or 1 level XD

magic pagoda
rich adder
languid spire
ruby flower
#

oh really simple models just a sphere XD

rich adder
ruby flower
#

greyboxing

#

right

jovial forge
ruby flower
#

should i make a first person angrybird game xD

#

or is that weird

rich adder
rich adder
ruby flower
#

yeah okay XD

jovial forge
swift crag
#

yes, beacuse it's not a method

#

it's a property of Transform, and you read and write it

magic pagoda
#

is there any way to round numbers into a small decimal instead of an int? like, rounding down 3.14 to 3.1 instead of just 3

slender nymph
#

unity's Snapping.Snap method can do that

rich adder
#

which is what instantiate wants

polar acorn
magic pagoda
#

I want to change it yeah

magic pagoda
cosmic dagger
night owl
#

Hi! (im back ;,)) I've been trying to make the attack point for my player character to be shaped to a polygon collider but it keeps saying that "no overload for method OverlapCollider takes 2 arguements and I've gone thru so much documentation and trial/error but am still very stuck.
code: https://gdl.space/ikabidarid.cs
thanks for any help in advance!

night owl
#

please i swear

jovial forge
rich adder
#

did you look at docs of Physics2D.OverlapCollider

rich adder
rich adder
night owl
#

no

#

yesterday i looked at it

#

and it was linked multiple times ๐Ÿ˜ญ

rich adder
#

also is IDE even configured?

#

pretty sure it shows you what signature is

jovial forge
night owl
cosmic dagger
magic pagoda
rich adder
# night owl yeah i got it working

I have my doubts lol it shows you inside the code editor what the 3 parameters are.
so you either are not paying attention or its not configured to help you

night owl
night owl
rich adder
#

"what is parameters in function" etc

cosmic dagger
night owl
#

ok thats fair

#

i really didnt mean to ask pointless questions i thought i was genuinely stuck

#

small part of yesterdays search history

magic pagoda
#

found a way I think.

jovial forge
# rich adder yes it does

Quaternion.Euler(Transform.localEulerAngles + new Vector3(0, 90,0)); I'm guessing this is more of what you were talking about?

rich adder
#

nowhere did i mention eulerAngles

#

i said Instantiate takes Quaternion instead of eulerAngles, not sure why you keep insisting on using that lol

#

transform.localRotation gives you the local rotation as Quaternion

magic pagoda
#

I found another way

jovial forge
#

Where private Quaternion startWall = Quaternion.Euler(0, 0, 0);

polar acorn
twin bolt
#

Question, how would i go by adding a portal like pick-up system, where the object floats in front of the player, but the item kinda sways to the players camera, not just following. So its kind of delayed?

ionic zephyr
#

is it better to check if the inventory is full in Update or everytime I add an object??

wintry quarry
willow scroll
wintry quarry
twin bolt
wintry quarry
#

MoveTowards isn't a way of moving things anyway, it's a math function to calculate a position

twin bolt
#

Oh ok

willow scroll
# ionic zephyr Okay, thanks a lot

Update is called every frame, so this will decrease your performance if you do all these things there. Aditionally, it's much more readable

polar acorn
#

Doing nothing is always more performant than doing something. The more often you can manage to do nothing instead of something, the better

ionic zephyr
#

Im planning on making a crafting system similar to little alchemy (with drag-and-drop events) does anyone know how to check if the place where my object lands is in an specific area?

wintry quarry
#

IPointerEnterHandler/ExitHandler and just store whatever the most recent object was?

swift crag
jovial forge
#

Somehow this Instantiate(walls[0], transform.TransformPoint( -2, 0, 2), transform.localRotation = leftWall); is causing the left wall to be spawned with a world position of (-10, 0, -2). The object that is spawn this wall has a world position of (0, 0, 0)

swift crag
#

checking if it's full in Update is just flat-out wrong

ionic zephyr
wintry quarry
jovial forge
languid spire
wintry quarry
#

is that intended?

#

I doubt it

late burrow
#

can i make interface which requires index input

faint agate
#

Hello, I ran into a problem I dont understand why it wont destroy the game object, I even put a log to see if I hit a wall and it prints when I do hit a wall but it doesnt destroy the game object.

  1. script to detect hitting a wall https://gdl.space/ujeqarajay.cpp
  2. script to destroy gameobject upon hitting a wall https://gdl.space/awexosivuq.cpp
jovial forge
languid spire
jovial forge
languid spire
slender nymph
#

or rather it assigns the value of leftWall to this object's localRotation

spiral rain
#

Hello, I am using https://github.com/CMDRSpirit/RollercoasterDesigner this package to make my one roller coaster. Sadly it is not very polished but I have one problem with it. When I set the StartSlope Variable it sets its own. (See Attached video https://drive.google.com/file/d/1CJEgclQS7Q3JbD32qIymqrm9aiU7Gspt/view?usp=sharing) Also when you try to make a vertical loop or any other loop it glitches out at makes it so you are not inverted.

I tried to get Chat GPT do help me fix it but that didn't work. I came to the conclusion that this line might be the source of the problem float3 startSlope = lengthsq(StartSlope) != 0 ? StartSlope : float.NaN; Here is the scipt https://pastebin.com/j957ybX3 and the GitHub project https://github.com/CMDRSpirit/RollercoasterDesigner

GitHub

A toolset for creating and operating realistic rollercoasters in Unity. Includes per car simulation of forces, like rolling resistance and acceleration through gravity with full integration into th...

languid spire
#

and then passes that as the world rotation for the instantiated object

jovial forge
#

I don't understand what I'm missing here with the rotations

#

Should I just instantiate the object and then transform the rotation?

slender nymph
#

do you want the object with this component on it to be rotated whenever you instantiate something?

late burrow
#

i wondered whats the proper way of getting something like that, i have big array of interfaces, and these have some field in them which i want make array of, do i just loop through each of them

jovial forge
slender nymph
#

then why are you doing transform.localRotation = leftWall

ionic zephyr
#

Does anyone know how to do a drag and drop system like in Little Alchemy? (I reckon it creates a copy of the object that can be mixed right?)

rich adder
#

what makes it so special?

ionic zephyr
#

Oh okay sorry

jovial forge
slender nymph
#

as has already been pointed out, that sets this object's rotation, not the instantiated object. and then it passes that as the instantiated object's world rotation

ionic zephyr
# rich adder what makes it so special?

the thing is it is a game in which you have an inventory with different items. Also you have a big space in which those items are manipulated. Whenever two items are mixed they are converted in something else (crafting)

ionic zephyr
jovial forge
slender nymph
#

you cannot assign the local rotation in the Instantiate call, you have to do it after it is instantiated. so pass Quaternion.identity for the rotation, then on the following line assign the returned object's localRotation

rich adder
wintry quarry
#

That's what that does

jovial forge
#

Yup, I got the answer now. Thanks

languid spire
rich adder
jovial forge
rich adder
#

@ionic zephyr just use the event trigger basically to do an OnDrop or OnEndDrag

languid spire
ionic zephyr
rich adder
ionic zephyr
ionic zephyr
ionic zephyr
rich adder
ionic zephyr
#

Yeah, sorry

rich adder
ionic zephyr
rich adder
#

yea

#

those are pretty much the way through event system

#

or just get raycast hits from the Raycaster directly , thats also an option

languid spire
ionic zephyr
#

It is difficult to explain sorry

jovial forge
rich adder
languid spire
ionic zephyr
#

but I dont know how to do this, I thought of making a DraggingItem component and make also a CraftableComponent for the objects in the crafting area but Im really lost

rich adder
#

the basic gist of it, I use scriptable objects to check recipies. I use the object being dropped on to call a "TryCraft" function or something

tulip tendon
#

hi, i have a horror gave and i need the monster to shoot object, but i tried codes from youtube last few hours and nothing works, can someone help me please

rich adder
lost wasp
#

Hello there. I wanted to make my own little 2D Pixel Game for quite a while but im more like a designer rather then a programmer but im willing to learn C#. The Problem is, there are to many courses and guide and im not really sure, whats the best content for me to start this journey. For some more informations. I want to make like a basic demo of an 2D Pixel RPG and there for I want to make my own scripts with C#. Like an Inventory system and so on. Does anyone has a clue what content I could use of does anyone can recommend a C# course for a beginner? Greetings! ๐Ÿ™‚

eternal falconBOT
#

:teacher: Unity Learn โ†—

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

rich adder
#

start with pathways ^^
this goes for you too @tulip tendon

ionic zephyr
tulip tendon
ionic zephyr
lost wasp
# rich adder !learn

Thank you but is it just about C#? I feel pretty good in the usage of Unity itself.

ionic zephyr
languid spire
rich adder
rich adder
rich adder
lost wasp
#

@languid spire @rich adder Thank you guys aswell. I will take a look! ๐Ÿ™‚

ionic zephyr
#

yes

rich adder
#

Im confused on that part

ionic zephyr
#

as you can see, the slot has an image, which is the thing I want to make draggable

rich adder
#

oh ok so you dont know how to make it draggable ?

#

just set its position to Input.mousePosition in the OnDrag method or use Update

ionic zephyr
#

whenever it touches the crafting area

rich adder
#

what do you need a clone for ?

ionic zephyr
#

because the images are just that, they dont have the function of being mixed with other objects

rich adder
#

they don't have to, they can just be placeholders

#

but you do need some scripts to determine its craftable

ionic zephyr
rich adder
ionic zephyr
#

Okay, maybe its simpler that way

rich adder
#

not a fan of working with UI myself but yeah you have to have a way to determine what you dropped on is a craftable object

#

I typically just have UI invoke an event to a manager of sorts

#

instead of dealing with the logic directly

ionic zephyr
rich adder
#

then the manager that was subscribed to this event does the logic, because each spawned item has this event so on creation just subscribe to it when Instantiated

ionic zephyr
#

So the crafting should be done on a separate manager?

rich adder
#

Its mainly preference / workflow . I personally would do so

ionic zephyr
rich adder
# ionic zephyr Okay really helpful

when chain stores get money , they count it (through machines that ring you up) but whos the one that does processing and payrolls pays everyone is the company that owns those stores

ionic zephyr
rich adder
lusty nest
#

Hello, is there a way to reset the entire scene without stopping play mode from within a script? Alternatively it would take longer but I would have to reset all the position, rotation, velocity, angular velocities of multiple gameobjects so

ionic zephyr
#

and also

#

how can I ensure the object is located in that zone

#

within those "borders"

rich adder
#

I think you might be jumping 20 steps ahead already ๐Ÿ˜›

ionic zephyr
#

oh okay

#

but what I am saying is

#

if I drop the object in the crafting area it stays there wating for it to be mixed

#

but if I place it outside i want to destroy that object

rich adder
#

you can use OnEndDrag on the Sprite you're dragging

ionic zephyr
#

how do I ensure it stays there

rich adder
#

if its not dropped on anything you destroy or whatever

ionic zephyr
#

but how do I know what "anything" is?

rich adder
#

the Canvas Raycaster is always raycasting from your cursor, you can for example check if the raycast pointer is not on any UI elements of interest

ionic zephyr
#

how?

rich adder
#

ill show you an example rq gotta load up unity ๐Ÿ•š

hasty sleet
#

IDropHandler has a parameter that tracks PointerData which contains the object dropped onto

rich adder
#

basically this

hasty sleet
#

I haven't used it in a while but PointerData should contain all the information you need

rich adder
#

indeed

ionic zephyr
rich adder
ionic zephyr
hasty sleet
ionic zephyr
rich adder
#

like ```cs
public void OnEndDrag(PointerEventData eventData)
{
var obj = eventData.pointerCurrentRaycast.gameObject;
Debug.Log(obj);
if (obj != null)
{

    if (obj.TryGetComponent(out UISlot uiSlot))
    {

        SetUISlot(uiSlot);
        belongsTo = BelongsTo.Slot;
        image.raycastTarget = true;
        return;
    }```
ionic zephyr
#

Oookay, i think I get it now

#

thanks a lot guys

robust kelp
#

for rigidbody 3d transform.position = new Vector3(transform.position.x, transform.position.y + 0.5f, transform.position.z); is it better to put it in update or fixedupdate?

languid spire
#

neither. dont mix rigidbody and transform movement

robust kelp
#

just change hitbox height?

languid spire
#

wtf has crouching got to do with movement?

polar acorn
hasty sleet
#

This teleports the object up 0.5 units.

You didn't state your requirements or goals, so there is no way you can be helped.

robust kelp
#

mb again but i think i solved it on my own ๐Ÿ‘

zinc kite
#

I have both the shoot and movement script follow the cursor they both dependent on a variable named rotaionZ. First where should I put the script that gets mouse cursor rotation and how can I update it in both scripts?

polar acorn
zinc kite
ionic zephyr
#

eventData.pointerCurrentRaycast.gameObject doesnยดt return the object in which I dropped my dragged object correctly

polar acorn
ionic zephyr
ionic zephyr
#

the object I was dragging

ivory bobcat
#

So it returned the object which was dragged

ionic zephyr
#

the same object I was dragging yeah

ivory bobcat
rich adder
#

thats prob why

ivory bobcat
#

I'm not sure what the issue is

ionic zephyr
#

this is the code

#

_clothBackground is the background of the interface

#

whenever I drop the object, the Raycast returns the object itself

rich adder
#

did you see what I wrote?

ionic zephyr
#

yeah

rich adder
#

do you have Raycast Target enabled on the thing you're dragging

#

if you don't turn it off, of course the first returned object is what you're holding onto

zinc kite
ionic zephyr
polar acorn
rich adder
ionic zephyr
rich adder
#

start drag = off
end drag = on

zinc kite
ionic zephyr
#

And what if I use Colliders and Triggers?

rich adder
#

if they are UI why are you using colliders?

ionic zephyr
ionic zephyr
ionic zephyr
#

In my case is it convenient?

ionic zephyr
ivory bobcat
swift crag
#

or plain old C# objects that you serialize into a scriptable object

#

you might want to be able to handle recipes without needing an asset

#

I mean, I guess you can create non-asset ScriptableObject instances, but,

ionic zephyr
#

maybe "ifยดs" are okay?

ivory bobcat
#

Just make what you can

swift crag
#

you don't want to implement the actual recipes directly in code

#

you want to write code that reasons about recipes

#

(which are just data)

rich adder
ionic zephyr
#

of a class

#

I didnยดt use Scriptable Objects

rich adder
#

they are just for the recipe not the item itself

ionic zephyr
rich adder
#

just the crafting system and recipes, helps matching

#

the output can just be a GameObject or whatever u got

#

look over it and you will see

ionic zephyr
#

Okay, thanks a lot guys

twin bolt
#

How do i rotate a object to a certain point, like a animation?

#

but from code

rich adder
#

Lerp in coroutine

#

for rotation you can prob use Slerp

slender nymph
#

or use a tweening library (if you already have a need for one or could use one in other situations as well, don't just download an entire tweening library for a single rotation)

rich adder
#

ah yes Dotween can do this in one line lol

twin bolt
ionic zephyr
#

and cloning from it

amber spruce
#

what is the 2d version of physics.CheckSphere

ionic zephyr
rich adder
#

since 2D only has circle and not spheres..

rich adder
#

like quantity

amber spruce
slender nymph
#

OverlapCircle

amber spruce
#

alright thanks

slender nymph
#

it still returns a collider, but you just null check that and that tells you if anything at all was found there

void seal
#

I have my VSC Configured for Unity but it appears my Quick Actions and Refactoring is no longer showing up! Any reason that may be? The only thing I can think of is variables that arenโ€™t being referenced properly rather than an issue with VSC.

#

Or a mistake in proper inheritance?

slender nymph
#

i don't understand what you mean when you say you think it is "variables that aren't being referenced properly", but if your quick actions and other IDE related features are not working, then try regenerating project files and restart vs code. if that doesn't work, try reconfiguring it. and if that doesn't work then consider switching to a real IDE that isn't liable to break every 5 minutes

winter spade
#

i want to start dev. games in unity, does it make sense to build projects wiht c+ first to have an understanding of the p language or should i just go straight unity engine

void seal
#

I appreciate it but not sure what is gained by that last part. One could at least specify alternatives.

winter spade
swift crag
slender nymph
wintry quarry
winter spade
ivory bobcat
#

If you know the basics and are simply moving to the unity platform, you may be able to get away with just some !learn tutorials - api, workflow etc. Else you'll really struggle if you're trying to learn to program and use Unity at the same time.

eternal falconBOT
#

:teacher: Unity Learn โ†—

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

swift crag
#

(well, they're "code actions" in VSCode: "quick action" is a Visual Studio term)

rich adder
#

oh yeah never noticed

void seal
rich adder
#

add missing cases you mean? make sure you're doing it on the variable in the switch

void seal
swift crag
#

if you're talking about implementing abstract methods, that should be a code action on the type name.

short hazel
#

You can also type override and the start of the method name whil in the class, and it should provide you with a list of available methods to override

slender nymph
swift stream
#

anyone know how to fix failed to update android sdk package list?

summer stump
amber spruce
#

hey so i want to use math.lerp to lerp a gameobjects rotation from where its at to 0 on all rotation axis how would i do that exactly

ivory bobcat
#

Maybe consider using quaternion slerp for rotations

#

Else Vector 3 lerp/slerp.

slender nymph
#

also check out this page for info on how lerping (or slerping) works: https://unity.huh.how/lerp/overview
it even has a link to a page that explains how to do it in a coroutine

amber spruce
#

aight thanks

twin bolt
#

The second if statement is the one with the issue

slender nymph
#

why are you comparing floats like that? you should pretty much never compare floats for equality, use something like Mathf.Approximately. but also why the magic numbers

ivory bobcat
twin bolt
rich adder
#

unless you set something to 24.938 aint no way thats gonna happen. Ah yess you're using quaternion as they were euler

ivory bobcat
#

Rotation would be a quaternion, so consider not to even bothering evaluating it.

slender nymph
#

oh yeah those numbers are way off for a quaternion, which is normalized

rich adder
#

yes eulerangles and quaternions are different

slender nymph
#

and even if they were the values you see in the inspector for its euler angles, you should never base your logic on the euler angles like that since they are interpreted from the quaternion at the time you read them. and rotations can be expressed in a very large number of ways using euler angles

amber spruce
amber spruce
#

ok thanks

late burrow
#

how i make class with lists that doesnt start as null

wintry quarry
#

use a field initializer

late burrow
#

i added = new List<string> to them next to class but they still output as null

#

i dont want manually activate each of them

wintry quarry
late burrow
#

i need to create them

#

when i create new class

wintry quarry
#

show your code

late burrow
#

wwhen i create new followdata i want lists to already be done

slender nymph
#

that's what will happen there. the lists will not be null when you create an instance of that class

late burrow
#

they are null

slender nymph
#

show where you are seeing that they are null

wintry quarry
dense root
#

How do you setup dialog for multiple characters? Right now I have it ghetto rigged as a string in a script but what if if I want to reuse the same dialog system for other characters?

    private string[] dialog = 
        { "ใ“ใ‚“ใ„ใกใฏ", 
        "The poor bell is jammed, it's like the heart of the town has stopped beating.", 
        ""};
late burrow
#

ok it was because i was confusing i with ii

frosty hound
#

Don't hardcode the array of strings, serialize it to the inspector and add it there for each NPC

wintry quarry
dense root
#

Oh smart, smart.

frosty hound
#

(though architecturally speaking, this isn't the greatest method, but just to answer your question)

late burrow
#

also how can i make array of that class to autofill itself

dense root
#

That's a fairly simple way to go about doing it, thank you so much

wintry quarry
late burrow
#

new followdata[] to have all in array not null

wintry quarry
#

Assuming it's an array of a class, you have to populate it

#
for(int i = 0; i < followdata.Length; i++) {
  followdata[i] = new Something();
}``` for example
late burrow
#

so regular way

wintry quarry
#

yes, the regular way

late burrow
#

thought i maybe can add [notnullable] something

wintry quarry
#

if it's an array of a struct, it will already bne filled with the default version of the struct, since structs cannot be null

slender nymph
#

but you should also note that structs cannot have field initializers

late burrow
#

so struct will make it both autofilled and lists autofilled

slender nymph
#

so reference types stored in the struct, like lists will default to null

late burrow
#

aw

wintry quarry
#

For classes, the default value is null
For structs, it's a zeroed-out version of the struct

late burrow
#

oh i realized i dont want go by adds but by exact indexes

#

can i for example access 1000 index of list and it will auto extend to that range?

wintry quarry
#

no

#

Consider either a large enough array, or a Dictionary<int, MyClass>

late burrow
#

hmm so whats the best way for array of unknown length which i want to fill out with nulls in middle in some cases

late burrow
#

isnt dictionary just list but double?

wintry quarry
#

no

#

what does that mean anyway? List but double?

late burrow
#

ah right using ints in non index way

wintry quarry
#

the int would be an index in the example of Dictionary<int, MyClass>

#

technically called a "key" but it serves the same purpose

dense root
#

Hmm I'm stumped, my dialog system works for one character's interaction but when I apply the same thing to another character they refuse to speak lol
https://gdl.space/lifekeseni.cs

#

The problem is that it won't set canvasDialog.SetActive(true) for some odd reason

#

Oh here we go, I'm getting an error message now

wintry quarry
#

on that line, you are trying to access a GameObject that has been destroyed

dense root
#

But I'm not destroying anything as far as I understand. I mean obviously I am destroying something but I don't get where that could possibly take place

wintry quarry
#

filename and line number
Read it, or you're flying blind and guessing

dense root
#

I'm setting it to false at the beginning manually but other than that there's no reference to it being destroyed

wintry quarry
#

read the error

#

you seem to be ignoring that part

#

and trying to skip ahead

#

you need to know the filename and line number where it's taking place. Without that, you're wasting your time.

teal viper
#

There should be an error thrown every time someone doesn't read the error properly

slender nymph
#

but they would need to read that new error too which probably won't happen

slender bridge
#

Also do a find all for "Destroy" in your project files

slender nymph
#

it's likely due to a scene change not an actual Destroy call

slender bridge
#

true but you never know lol

slender nymph
#

sure, but i am also pretty familiar with their project at this point. but they still need to read the stack trace for the error to see where it is actually coming from

dense root
#

The error disappeared

teal viper
slender nymph
dense root
#

Yeah I cannot replicate the aforementioned console error

#

I'm really confused how it's working for another character but not the one that was duplicated. I made some adjustments to address the null error but i'm pretty sure that won't fix it

    private void OnTriggerExit2D(Collider2D collision)
    {
        hasEntered = false;

        if (canvasDialog != null)
        {
            canvasDialog.SetActive(false);
        }
        dialogInt = 0;
    }
slender nymph
#

have you actually confirmed this is the source of the issue?

wintry quarry
dense root
#

Yeah I double clicked the console error and checked the offending line

wintry quarry
#

and which line was that

dense root
#

canvasDialog.SetActive(false);

wintry quarry
#

the one in OnTriggerExit2D?

dense root
#

Yeah

slender nymph
#

and how is canvasDialog assigned

dense root
wintry quarry
#

Ok what oyu shoudl do then is this:

        if (canvasDialog == null)
        {
            Debug.Log($"CanvasDialog was null on {name}!", this.gameObject);
        }```
slender nymph
# dense root

is this object perhaps a DontDestroyOnLoad object?

dense root
#

If I'm reading this correctly, no

wintry quarry
#

yes or no would suffice

#

you weouldn't know until the game is running

dense root
#

This is a screenshot of the game running

wintry quarry
#

anyway you may simply have a copy of this script on an object in the scene which is referring to an object you destroyed

dense root
#

I don't get how I'm destroying something when I don't have that call anywhere in my scripts

wintry quarry
#

pressing delete in the editor is one way

#

another is unloading a scene

slender bridge
slender nymph
#

you should pause execution when that variable is null so you can inspect wtf is happening. you can use Debug.Break() to pause play mode. or just don't null check and enable error pause on the consoel

#

also, unrelated to the issue (probably) but you don't need separate components for "Girl Dialog" and "Boy Dialog" and stuff if it's just to display dialog. you can reuse the same component

dense root
#

Oh okay, let me go back to the drawing board and see what I can come up with, i'll try that Debug.Break() trick technique

slender bridge
#

As boxfriend said, you just need to create a prefab that you can instantiate when you need it and just update the text if its a simple dialog with no uniqueness

slender nymph
#

i mean, it doesn't need to be a prefab. just reuse the same component type, the copy with a different name does exactly the same thing just uses different values for its serialized variables

dense root
#

So I figured it out, because of the way I've implemented dialog system I actually need to have an empty string so that it can iterate upon it

slender nymph
#

huh?

dense root
#

I think the way I did this line
https://gdl.space/laxahizemo.cs

            // When it reaches end of dialog/array, set dialog canvas to inactive.
            if (dialogInt >= dialog.Length)
            {
                canvasDialog.SetActive(false);
                // Reset dialogInt to 0 so you can speak to them again
                dialogInt = 0;
            }
slender nymph
#

i don't see how any of that would cause the error you were experiencing

dense root
#

Yeah I'm confuddled too

slender nymph
#

did you bother doing what i suggested and actually look at what is happening in your scene at the time the error occurs? or are you just taking wild guesses about what is causing it? because it seems like you are doing the latter

dense root
#

I can't, because the error refuses to reproduce

slender nymph
#

well yes, you're specifically preventing the error now. put the debug.break in the else statement with that debug.log call

dense root
#

The canvasdialog one? Okay

#

Yeah it won't break

slender nymph
#

what did you do before when it was throwing the error? do exactly that

dense root
#

Nothing special, honestly it was being thrown randomly

#

When I put the play mode

slender nymph
#

don't tell me . . . was it throwing the error when you left play mode? and not during play mode?

dense root
#

Yes

slender nymph
#

maybe say that next time so that we don't have to go through all of this pointless debugging

#

OnTriggerEnter2D will be called when exiting play mode or leaving a scene when there is a trigger overlap happening in the scene at the time you do that

dense root
#

Oh that makes sense, well I'm glad we fixed it

slender nymph
#

so if you were exiting play mode while within the trigger that caused that OnTriggerEnter2D then it will call that method and because everything is in the process of being destroyed at that time you get that error.

#

for some reason unity said this is expected behavior and not a bug

dense root
#

I see, that makes sense

#

Thanks for the assistance

high walrus
#

I'm trying to make it so that I can pause and unpause the game using the escape key, right now pausing does not work but unpausing does, I don't understand why

#

this is the code

#

it doesn't even do the debug

#

This is the correct image

#

if I manually set gamepaused to true and the pause menu to active escape does work to unpause the game, but pausing does not work

#

I tried to just have the if gamePaused == true (for unpausing which does work) and placing the pausing code in else, same result

#

nvm I'm an idiot I fixed it, I'll explain how. The script was linked to the main menu, which is DISABLED by default. that's why the script didn't work. I attached it to Canvas instead not which is active. Might not be the best place to link it but it seems to work now

wintry quarry
#

You set it to true right before checking if it's true

high walrus
#

Yeah I noticed that right after, changed it into an else

#

I've got a fun new issue to deal with now ๐Ÿ˜‚

#

Pausing using the escape key now works fine, but in ever level except the first I can't click my buttons

#

I didn't have EventSystem gameObjects in those scenes, seems to work fine now

#

Though I don't really understand what the eventSystem does, that it's needed for buttons but not other scripts

wintry quarry
high walrus
#

Gotcha, thanks!

violet glacier
#

How do I sync runtime frames with animation frames? For example, I have an animation that shoots a bow at frame 50 (in the animation controller) and I want to do something. However, this code executes faster than the animation

int frame = 0;
while (true) {
  if (frame == 50) {
    // do something
    break;
  }
  frame++;
  yield return null;
}

How do I do this without using animation events?

zenith cypress
#

Without Animancer (paid asset), probably not easily without animation events LUL

faint sluice
#

Does Time.UnscaledTime or Time.RealtimeSinceStartUp work on application's internal clock or uses System's time as reference?

faint sluice
violet glacier
faint sluice
violet glacier
#

I can't use animation events because if I have more "do something" (e.g. 1000), I would need to create 1000 animation events which is not feasible

teal viper
#

Unless you have 1000 different animations that need different events..?

olive lintel
#

hey all, having some trouble right now with an editor window I'm trying to make, I have the MenuItem attribute set up correctly, as it works with my other editor window I've made before, but for some reason this one doesn't seem to appear in the window tab?

#

the "MarcLerp" editor window is my own custom tool I've made earlier and been using for a couple months, however my new one doesnt seem to appear :/

#

both inherit from editor window

faint sluice
#

Also on GUI

zenith cypress
#

You can only put MenuItem on a static function

#

Don't put it on OnGUI

olive lintel
zenith cypress
#

You also don't need to wrap your stuff in that if you put your editor window/editor specific code in an /Editor/ folder

olive lintel
faint sluice
eternal needle
# violet glacier I can't use animation events because if I have more "do something" (e.g. 1000), ...

if you can declare somewhere when you want this event to happen, like at 50% or 0.5 through the animation, then you can just try checking the normalized time https://docs.unity3d.com/ScriptReference/AnimatorStateInfo-normalizedTime.html
Or have a timer which runs at the same time you start the animation.
I use my own timer and it works well, assuming you arent taking into consideration stuff like transitioning which may cause your animation to not play fully. I define a total length which is how long the animation should play, then use another value (0 to 1), which indicates how long into the animation an event should happen.

faint sluice
olive lintel
#

like it only executes code in the editor

#

its for like positions and stuff

#

its super janky

olive lintel
#

its made of sellotape

#

but instead of rebuilding it I kept adding to it and now its like a bomb inside my computer

eternal needle
faint sluice
river pecan
#

I'm trying make line of sight in a 3d space. I'm trying to use a mesh at runtime to get a cone shape, however I don't understand the problem that is happening when setting the vertex positions. When the player moves, the origin vertex moves in a different direction than the player, the rotation of the mesh also does not follow the players rotation. I have very little experience with making meshes this way so I'm coming here to ask what I'm doing wrong with the meshes positions.

olive lintel
eternal needle
faint sluice
#

Onapplicationpause = true if you will

river pecan
#

So I thought it was using localPosition since the object is a child of the player

faint sluice
eternal needle
river pecan
eternal needle
faint sluice
olive lintel
river pecan
#

My only thought was that it was using local position, however even this code doesn't fix the issue

        Vector3[] verticies = new Vector3[3];
        Vector2[] uv = new Vector2[3];
        int[] triangles = new int[3];
        verticies[0] = transform.TransformPoint(transform.position);
        verticies[1] = transform.TransformPoint(transform.position + transform.forward);
        verticies[2] = transform.TransformPoint(transform.position + transform.right);
        uv[0] = new Vector2(0, 0);
        uv[1] = new Vector2(0, 1);
        uv[2] = new Vector2(1, 1);
        triangles[0] = 0;
        triangles[1] = 1;
        triangles[2] = 2;
        mesh.vertices = verticies;
        mesh.uv = uv;
        mesh.triangles = triangles;
eternal falconBOT
scenic burrow
#

New to scripting so bear with me. I am making a simple game where the player is controlling a plane that is constantly moving forwards, which they have to guide through hoops without crashing. The plane is also meant to be restricted to certain boundaries so they cannot go off screen. I was able to get that portion right, but because of that I cant make it move forwards which should be simple. How can I fix this?

scenic burrow
#

To move the plane forward, I use a simple one line code which works, but since I am using a new Vector3 to add the restrictions, I am forced to set the value to 0 based on my understanding.

charred spoke
#

You are not forced to set it to 0 you can store the result of your transfrom.forward calc in a variable and put that as the z value of your clamped transform

abstract finch
#

I need to send a raycast x degrees from a transform forward. What would be the best approach to get the direction? I would like to add that I plan on doing subsequent raycasts all the way to the back of the transform.

eternal needle
eternal falconBOT
eternal needle
#

though im not sure what direction you're trying to get from the question

scenic burrow
#

Actually I had another thought. My goal is to have the player fly towards rings which they need to fly through and not hit. Would it be smarter to make the player be stuck on the z axis and have the rings come towards me?

abstract finch
#

Actually I'm not sure I need to fire a ray towards this direction so it needs to be a v3

eternal needle
scenic burrow
#

I think Im going to go that route. Thank you!

eternal needle
nova swift
#

I ran into a bug in a game of mine (platformer with similar physics to sonic), where a particular aspect of the physics appeared to be frame dependent. I attempted to replicate it in a new project in a much simpler manner to make debugging easier, and it seems the frame dependency carried over, but I don't really understand why there is frame dependency, or if that's actually what the issue is.

To me it looks like the issue is frame dependency, as the blue cube goes faster and higher the lower the frame rate, shown in the video. I also don't believe Time.fixedDeltaTime is ever getting changed, only the target frame rate, and I don't think the two are related. If the issue is frame dependency, could anyone point out what the issue is in the code? The code is pretty simple and short, as seen in the video, though a particular if statement is pretty specific to this physic sticking.

Code: https://paste.ofcode.org/ymiFDf9WB4GNSwdDsqriEb

eternal needle
#

also with transform.position, replace that with rb.position

nova swift
#

will give it a try

#

It looks to me as if the issue still persists

eternal needle
nova swift
#

Could give that a try, I do wonder if any of the maths is frame dependent, tho I've been told that may only be the case if Time.fixedDeltaTime was to change

eternal needle
#

One sanity check you could do is print out some info from fixed update, save that somewhere (maybe even just write to file) and compare the 2 tests. You could see stuff like at which time they actually have a difference, maybe one is considered sloped or grounded while the other isnt

nova swift
#

Fair enough, I did remove all the ground there was, and it seems the issue was just based around the slope bit, as the blue sprite would go around the circle much faster at 60fps compared to 240fps

eternal needle
#

there is something im unsure of so i will test something, that it may even just be related to those ground checks and how it is using groundCheck.position.

nova swift
#

alright, I'm quite confused as to why there appears to be frame dependency so I could assume I'm missing something that may be obvious

eternal needle
#

hm these shouldnt even really be issues cause its being called from fixedupdate but i also am not sure if theres a difference in 2d objects

nova swift
#

yea I find it quite strange

#

in my original project I thought the issue would relate to how I retrieve inputs or even just something in the Update() function messing it up, but here with all those potential problems seemingly gone, I'm quite lost

eternal needle
#

were u able to change those?

#

from a quick test, at decent speeds and interpolate turned on there is actually a significant difference

nova swift
#

currently trying to change the transform.right stuff into rb.rotation things

#

would

Vector3 rightDirection = new Vector3(Mathf.Cos(rb.rotation * Mathf.Deg2Rad), Mathf.Sin(rb.rotation * Mathf.Deg2Rad), 0);
            Vector3 upwardDirection = new Vector3(Mathf.Sin(rb.rotation * Mathf.Deg2Rad), Mathf.Cos(rb.rotation * Mathf.Deg2Rad), 0);

be a correct way of getting the directions with rb.rotation?

eternal needle
bold osprey
#

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.VFX;

public class Domain : MonoBehaviour
{
[SerializeField] private VisualEffect vfx;

[SerializeField] private InputActionReference vfxSpawnKey;

[SerializeField] private InputActionReference WarpSpawnKey;

[SerializeField] private VisualEffect Warp;
private void Awake()
{
    vfxSpawnKey.asset.Enable();
    vfxSpawnKey.action.performed += OnVfxKeyPressed;
    WarpSpawnKey.asset.Enable();
    WarpSpawnKey.action.performed += OnVfxKeyPressed;
}

private void OnDestroy()
{
    vfxSpawnKey.action.performed -= OnVfxKeyPressed;
    WarpSpawnKey.action.performed -= OnVfxKeyPressed;
}

private void OnVfxKeyPressed(InputAction.CallbackContext obj)
{
    if (vfx != null)
        vfx.Play();
    else
        Debug.Log("There is no vfx attached to this component");
    if (Warp != null)
        vfx.Play();
    else
        Debug.Log("There is no vfx attached to this component");
}

}
using a Reinit(); how do i stop warp vfx after 15 seconds

nova swift
eternal needle
#

we can make a thread for this also, might take some more messages

nova swift
#

Do I have to convert rb.rotation into something else first? Am I not multiplying Vector3.right by 0 if the player is flat on the ground, thus making a Vector3.zero?

nova swift
simple furnace
#

Hey, can anyone please help with getting a decent rotation camera going? Been searching for hours on YouTube for a script and found almost nothing..

eternal falconBOT
bold osprey
burnt vapor
# bold osprey ty

I was pointing out that you should format your code? Is there an issue?

scenic burrow
#

When setting up a spawn manager, should the function of the object be done in the spawn manager script or should I make it a seperate script? I am just trying to make them move in a certain direction until they pass the player

burnt vapor
#

The actual spawning?

abstract finch
#

```float angleSection = 180 / _numberOfRays; Create Radial ````
Is there a reason why I'm unable to produce a ray behind the transform?

    {
        Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.up);
        Vector3 rotatedPoint = rotation * transform.TransformDirection(0, 0, length);
        return rotatedPoint;
    }```
scenic burrow
#

I pretty much got them to spawn but havenโ€™t done the actual movement part so they come towards player

storm dove
#

im having this problem where in vs some of my code that should be color coded just isnt, is there a setting that i need to change in vs or something that i need to do to get the colors back?

eternal falconBOT
storm dove
#

cool, that worked thanks ๐Ÿ™‚

simple furnace
#

Hey so like, is there a code out there to decide spawn points like something with coordinates?

halcyon geyser
#

sure

languid spire
simple furnace
languid spire
#

why dont you read the documentation on Instantiate

simple furnace
late burrow
#

i want make custom string type which holds variables of different variations of same string, which thing is best

languid spire
queen adder
#

should i start by learning general c# or unity specific c#

languid spire
queen adder
#

alrighty thanks

languid spire
late burrow
#

i think with struct i cant get

#

so between class and interface

languid spire
rare basin
#

Anyone can help me fixing my IDE? 0 errors in the console, can enter playmode and build just fine

#

yet i have a lot of errors in the IDE itself

#

a lot of namespaces cannot be found like using TMPro; using UnityEngine.UI;

languid spire
# rare basin

open Solution Explorer, Right click on solution, reload with dependencies

rare basin
#

i don't have such option

#

compile solution

#

compile solution again

languid spire
#

what IDE ?

rare basin
#

vs 22

languid spire
#

should work. Screenshot complete window

rare basin
#

1 sec i'll change ide languagee

#

im trying to update vs22 to newest version aswell

buoyant meteor
#

hey I have some code that im using to give 2d objects a fake height. my issue is when i give the object im testing on a rotation of any kind and want my x position to
move based on the objects rotation, it still goes off its world position of x. Also how do I type my code in chat properly?

eternal falconBOT
buoyant meteor
#
!code private void BodyPosition()
        {
            if (onGround)
            {
                return;
            }

            if (!onGround || body.transform.position.y > shadow.transform.position.y)
            {
                parentObj.transform.rotation = new Quaternion(0,0,rotation,1);
                // body.transform.rotation = new Quaternion(0,0,rotation,1);

                verticleVelocity += gravity * Time.deltaTime;
                body.transform.localPosition += new Vector3(0, verticleVelocity, 0) * Time.deltaTime;

                parentObj.transform.position += new Vector3(horizontalVelocity, 0, 0) * Time.deltaTime;
                // shadow.transform.localPosition += new Vector3(horizontalVelocity, 0, 0) * Time.deltaTime;
            }

            if (body.transform.position.y <= shadow.transform.position.y)
            {
                onGround = true;
                verticleVelocity = 0;
                horizontalVelocity = 0;
                body.transform.position = new Vector3(shadow.transform.position.x, shadow.transform.position.y, 0);
                // gameObject.transform.position = body.transform.position;

                transform.rotation = Quaternion.identity;
            }
        }
eternal falconBOT
verbal dome
#

Don't do the command, read the bot's message instead ^

rare basin
#

there is no such thing as reload with dependencies

night mural
#

Edit->Preferences->External Tools->Regenerate Project Files

rare basin
#

already did several times

#

aswell as deleting the Library folder

#

and .csproj files

halcyon geyser
#

you need the csproj files

rare basin
#

ik

#

that's not the issue

#

my IDE just doesnt recognize some unity namespaces

#

but i have 0 errors in the console and can enter playmode and build etc

teal viper
rare basin
#

I did try that several times

teal viper
#

What checkboxes do you have ticked there?

rare basin
#

nothing

#

yesterday it worked fine

teal viper
#

What can you tick?

rare basin
#

tried many combinations

#

with all ticket

#

all unticket

#

etc

teal viper
#

Try deleting the csproj and sln files and regenerating

rare basin
#

all of them?

teal viper
#

Yes

rare basin
#

worked partially

#

for some namespaces

#

now it doesnt only recogznice DOFade on canvas group component

#

from DOTween asset

#

but it works, no errors etc

teal viper
#

Is is an extension method or something?

weak grove
#

hello my loverlies, did my first bit of c# without an example to follow yesterday , its silly its noob but honestly it made me so happy LOL

burnt vapor
weak grove
#

๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„

summer creek
#

guys do you have any similar enemy AI code like the horror game granny?

#

patrolling and smart Ai thing

whole lark
#

Hi, in the following asset I made the mistake, that I built it and when I opened the menu of the game, I changed the resolution from 1920x1080 to 800x600. It was now a small window and it looked pixelated. I tried to undo it, but it doesnt work. after a lot of searching I gave up and deleted the project and imported the asset to a new project. I built it and opened the game. It is still 800x600... does anyone know how to fix that? (Here the link to the asset: https://github.com/DevionGames/inventory-sytem)

silent bone
#

need some help on how to start dm me

burnt vapor
eternal falconBOT
#

:teacher: Unity Learn โ†—

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

burnt vapor
languid spire
eternal falconBOT
whole lark
#

is that right?

languid spire
whole lark
#

... its not my code ๐Ÿ‘€ its just an asset

burnt vapor
#

Also, does it possible skip the if statements? You could also log these

languid spire
karmic kindle
#

Hey, I just wanted to check, do I need to use the line 'pTimer = timer' or is that irrelevant because the IEnumerator has already started etc..? ```cs public void DotEffect(string spell, float timer, float damage)
{
switch (spell)
{
case "Poison":
pTimer = timer;
pDamage = damage;
StartCoroutine(Poison(pTimer, pDamage));
Debug.Log("I've chosen poison > d = " + pDamage + ". t = " + pTimer);
return;

        default:

        return;
    }
}```
#

!code

eternal falconBOT
languid spire
karmic kindle
languid spire
#

if you are using class scope variables no need to pass them as parameters

karmic kindle
#

Unless I'm going the wrong direction, I plan to use the switch command for other things like "burn" etc.. so I'm thinking I do need to pass them?

languid spire
#

no, not at all

#

you may need to pass them into the coroutine so it has fixed values not affected by other processes

green ether
karmic kindle
languid spire
karmic kindle
jovial forge
#

Dude, Unity learn is a great resource

swift vessel
#

How do I make a moving platform without using the setparent method? in 2d

languid spire
eager spindle
#
public bool inContanct
void Update() {
  transform.position += moveDirection;
  if(inContact) PlayerController.instance.transform.position += moveDirection
}
void OnCollisionEnter() {
  if(other.CompareTag("Player")) {
    inContact = true;
  }
}

void OnCollisionExit() {
  if(other.CompareTag("Player")) {
    inContact = false;
  }
}
#

not tested do not copypaste in

timber tide
#

moving platform/elevator logic makes me cry

eager spindle
#

its not horrible unless you're using something else besides hardcoding to move your stuff

#

some days I use an animator because funni effects

#

but nowadays I just have a state machine and transform.position += moveDirection

timber tide
#

I'm not really sure the right way to go about it using rigidbodies. It's never smooth no matter what I try

eager spindle
#

dont use rigidbodies on a platform??

#

the only way for that is parenting

timber tide
#

yeah unfortunately.

eager spindle
#

you can also track position delta

#

but still a bitch to use

#

idk how breath of the wild does it

#

AAA magic goes crazy

timber tide
#

It works for elevators since you can add that illusion, but moving platforms to jump between is a pain

eager spindle
#

just that it doesnt carry the velocity onto the player

swift vessel
#

@eager spindle Thanks, this worked great, but if I want the player to jump according to the speed of the platform while jumping, should I use rigidbody?

eager spindle
#

no

#

when collision exit, you can check the direction of the platform. use the direction of the platform to push the player

#

does your player have rigidbody?

swift vessel
#

yes

eager spindle
#

ok nc

#

you can rb.AddForce(moveDirection, ForceMode.Impulse)

swift vessel
#

okay ฤฑ will try

sonic dome
#

I'm using webgl platform unity

Is there any way I can make it so that let's say I use pun2
And I want to make it so that when I go to the link

Example.com/roomcode

And roomcode can be a I'd i have given and can I get that roomcode of the url and use in my code?

#

Ping me on reply

summer creek
#

guys do you have an enemyAI script patrolling around the map and if the player seen it will chase you

Reply to me or dm if u have one thank you!

eager spindle
# sonic dome I'm using webgl platform unity Is there any way I can make it so that let's sa...

you cant really communicate from the webpage to your unity game. the dumb solution would be to host an external server, say in Flask.
the external server will serve your game at root. the external server will serve any extensions to your game as well, while attributing the device's MAC address to the game. when the game launches, it checks your external server to see if theres a room code cached for it

eager spindle
sonic dome
eager spindle
#

the approximate solution is to make a Frustrum raycast that's the same size as the camera, or a spherecast or whatever
when the raycast hits the enemy, activate the enemy, and turn on the enemy AI

sonic dome
eager spindle
#

ill review it onesec

sonic dome
#

This one line makes me believe it

summer creek
eager spindle
#

when you build the game?

#

or when you run the game

sonic dome
summer creek
#

run i mean

eager spindle
#

what are you using for the enemy ai

#

navmesh? a*?

summer creek
#

yes

eager spindle
#

which one

lusty nest
#

Hi guys, I was trying to reset the scene using a script (as seen below) since I have to reset the positions, rotations and velocities of many gameobjects but my unity crashes everytime I execute the code. Do any of you have any alternatives to reset the scene ?

public override void OnEpisodeBegin()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

summer creek
lusty nest
wintry quarry
#

The solution is - don't do that

lusty nest
summer creek
dim wharf
#

Does add listener in buttons put it into a list of listeners of the button or does it replace the current listener?

languid spire
dim wharf
#

so it does add another listener. i was overthinking it too much

languid spire
#

good guess

wintry quarry
#

adds, yes

tough trench
#

I am working on a idle game and I cant get number higher than 10,000,000,000,000,000,000 in my code for number notations does anyone if I can bypass this number?

wintry quarry
tough trench
#

a float

wintry quarry
#

you know there are precision limitations to simple datatypes like float right?

swift crag
#

you'll get a much wider range if you use doubles instead of floats

polar acorn
swift crag
#

but "BigNumber" data types are appropriate for completely ridiculous sizes

tough trench
#

Ok thank you

swift crag
#

It looks like this just uses a long for the exponent and a double for the mantissa

#

so it's conceptually similar to a 128-bit float

slender nymph
#

you know, recent versions of c# have a 128 bit integer now. where's my 128 bit float. I demand a System.Quadruple

quick pollen
#

@hollow dawn first of all, you shouldnt have multiple controller.Move() calls in update, you should only have a single one which handles all of them