#💻┃code-beginner

1 messages · Page 724 of 1

lethal meadow
#

then do the ray intersection calculation for each triangle in that mesh

rocky canyon
#

havent gotten around to trying that but sounds cool..

#

lots of ideas rattling around

lethal meadow
#

i always wanted to try rainbow 6 siege like destruction now i know how

rocky canyon
languid pagoda
#

"Cross scene reference not supported" are you kidding me?

#

is there a workaround?

languid pagoda
#

another example of half finished unity implementation.

#

Like is there rational behind why they didnt do it?

#

or did they just say fuckit ship it people definitely wont want to do this

rich adder
#

probably? I don't know the technicals to give you a reason

#

generally you should have a better system in place anyway like proper Dependency Injection chain

#

wait thats entities ?

#

I'm sure there is a thread somewhere dicussing but I dont feel like googling tbh

#

google AI thing says this

Scene files are designed to be self-contained units. If an object in Scene A directly referenced an object in Scene B, and Scene B was not loaded, the reference would become null, leading to potential NullReferenceException errors. Unity cannot guarantee that all scenes containing referenced objects will be loaded simultaneously or in a specific order.
Serialization Challenges:
.
Saving and loading these cross-scene references reliably would be complex. When a scene is saved, it needs to store information about its own objects. Storing references to objects in other scenes would require a more intricate system to track and resolve these dependencies, especially if scenes are modified or renamed.
no clue how accurate it got this info

languid pagoda
#

Could be wrong but idk a better way to do this personally. I Have a scene that is always loaded, with a "VehicleManager" class attached to one of the objects. I created an editor script that is just a scriptablewizard that takes in a mesh and some other data and creates a car prefab and some scriptable objects, assigns an ID and then generates a class so for example

public class VehicleList
{
            public const int corvette = 1; // where 1 is the assigned ID;
}

It then places a reference to the prefab i just created into a dictionary<int, GameObject> where the key is the assigned ID. This allows me to call

vehicleManager.CreateVehicle(VehicleList.corvette); and vehicle manager will just do a simple dictionary lookup by key.

the vehiclemanager lives in the scene that is always loaded so its not destroyed and clear the dictionary.

#

I mean obviously i am not rewriting all this due to this issue im just going to chuck DontDestroyOnLoad in start and chuck it in the main scene but damn

languid pagoda
eager crow
#

how do I rotate an object using scripts?
I have transform.eulerAngles.y = 0;

#

shouldn't this work?

rich adder
#

if you want to properly rotate consider using
.rotation = Quaternion.euler
or
.Rotate()

eager crow
#

so transform.Rotate() = 0 would work?

rich adder
#

guessing ain't something you should do with code. it needs to be functional

languid pagoda
frosty yarrow
#

does someone know how to help me

rich adder
frosty yarrow
rich adder
frosty yarrow
valid estuary
#

Bro how can we use behaviour tree

frigid sequoia
#

I want to do this since I don't want this to ever be modified from outside, but I'd want it to display properly on the inspector and not with the camelCase, can I do that?

timber tide
#

Make it not camelcase

#

Can you clarify what you're asking cause im not sure of your problem

frigid sequoia
#

I mean, I could, but then it just looks messy on the code instead lol

timber tide
#

By naming convention here just make uppercase here and that would be fine

#

public getters are usually by pascal case anyway

frigid sequoia
#

I just want to make that field not modificable from outside, but this has the side effect of looking like this:

midnight plover
#

you could use the readonly attribute

frigid sequoia
#

It's not making the first one capitalized for some reason

#

It's messing my head lol

timber tide
#

so you do want it camelCase or what

polar dust
timber tide
#

if you want it camelCase you need to modify how it's displayed with a custom inspector script because all exposed variables on the inspector will be pascalcase

frigid sequoia
#

I want it to show as all the other fields show, with the camelCase transcribed to show in full split capitalized words

polar dust
#

I thought unity always auto capitalises field names

#

"myTestName" would be "My Test Name" wouldn't it?

frigid sequoia
timber tide
#

what you can do is use snake case

#

that will go against unity's ability to capitalize

grand snow
#

SnakeCaseRulez

#

wait thats pascal FUCK

#

who named all these damn things

polar dust
#

WaCkYcAsE

timber tide
#

but that also means means public variables will also have to start with an underscore to override it

pure cosmos
#

Any developer that can help in creating rp game please dm

vocal blaze
#

Good day, is it possible to find a mentor to receive some tasks and gain more experience in development? Or perhaps to work in a team with more experienced developers?

grand snow
#

!collab

eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

We do not accept job or collab posts on Discord.
Please, use Discussions to promote yourself as job-seeking, advertise commercial job offers, or look for non-commercial projects to participate in:
Collaboration & Jobs

rotund root
#

is ↓ bugged in unity 2022ver or something?

        yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);

auto detecting didn't work (i can see the debug object but not the permission request)

#if UNITY_ANDROID
        // Ask permission once
        yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
        DebugObject.SetActive(true);
#endif

it just won't pop up the permission request, I even tried to make the button for it, the button itself is working and running the coroutine (i can see the debug object) but it just won't pop up the request and i've to put a text box there to ask the user do it manually like a 🐒

    public void OnButtonClick()
    {
        StartCoroutine(RequestWebCamPermission());
    }

    private IEnumerator RequestWebCamPermission()
    {
        DebugObject_working.SetActive(true);
        yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
    }
grand snow
#

I think if the user has already chosen it wont let you re ask? It may not be unitys fault

rotund root
#

no it's flesh install

grand snow
#

Request permission, check after if its granted and if not show some message box informing the user that its required.

#

DId you add the permission to your android manifest yet?

rotund root
#

i believe i did

grand snow
#

oh nvm thats deprecated

#

hmm double check what unity uses

rotund root
#

my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <application>
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
</manifest>
#

the user can allow it manually via going to the phone's setting/app/(app name)

grand snow
#

when using android logcat do you get any errors when you attempt this permission request?

#

(perhaps it needs camera2/camerax and it will mention this?)

rotund root
#

edit: nvm that's not related, that's just the gameobject that uses the cam

grand snow
#

hmm sus

rotund root
# grand snow hmm sus

i really dont know what makes the app thought that happened, bro is seeing things

        if (Application.HasUserAuthorization(UserAuthorization.WebCam))
        {
            Debug.Log("Webcam permission granted");
            // Add code here for what to do if permission is granted
        }
        else
        {
            Debug.Log("Webcam permission denied");
            // Add code here for what to do if permission is denied
        }
raw matrix
#

Random question. I just spent like 5 hours trying to figure out a bug. I had code i KNOW used to work as i have source control on it. All of a sudden my code would throw an error that i was unable to understand or figure out why it was happening. I started walking back through my source code and after about a 100 commits and a months worth of time i saw i had added an onclick() to a button which i also had execute in code by having the button hooked to code directly. Long story short is how did my code function for a month like this then all of a sudden stop. I had source control, i didnt upgrade unity, i didnt change packages. I am really baffled but glad i figured it out.

rotund root
#

the code for unity 2022 (the one i'm on rn) didn't work but the code for unity 6 worked
what can i say

halcyon lion
#

does anyone know any good videos that can teach me the basics of C# game dev or could someone check if the video I found covers the correct topics?

naive pawn
#

there are resources pinned in this channel

halcyon lion
#

ahh didn't see that

#

thanks for pointing it out I'll have a look at that then

balmy vortex
#

hey so like how do wallruns work in unity?

#

like what do you need to do to implement it?

#

more specifically how do you know if the object the player is touching actually is wall runnable?

grand snow
#

kinda vague but the answer is "you check with how you assigned such data"

naive pawn
grand snow
#

hit surface -> does it have my special component? -> check properties -> ??? -> profit

balmy vortex
#

how do you actually check if the players touching the wall though?

hexed terrace
#

the same way you'd do a ground check

#

there's most definitely going to be tutorials online for wallrunning

glass summit
#

Can someone help me with this?

#

For my FPS game, I'm trying to add lean mechanics

balmy vortex
glass summit
strange jackal
#

I figured it out

tidal shuttle
glass summit
tidal shuttle
#

ohh

#

thank you

#

did you write the whole code by yourself

glass summit
#

It was a template by Unity but then later some of the code I have entered it by watching a yt tutorial

tidal shuttle
#

oh, nice

hexed terrace
eternal falconBOT
tidal shuttle
glass summit
glass summit
tidal shuttle
#

ohh

#

ok

hexed terrace
glass summit
#

Ever since i added the new code from the yt tutorial, I get these weird errors

hexed terrace
#

list of mods on the right they have orange-y names

hexed terrace
hexed terrace
#

where's the error

tidal shuttle
#

by the way

#

what is an fps game?

#

nvm ill google it

glass summit
#

Most of the code came from a Unity template by default, but the lean codes are from the yt tutorial

glass summit
hexed terrace
#

and the error is.......?

tidal shuttle
#

ohh

#

thank you

glass summit
remote tundra
#

hey can someone help me add or create flowing lava??

#

anyone???

remote tundra
glass summit
remote tundra
# glass summit What's up?

can you help me build a player movement code (i have been struggling with it..i have recreated the code 8 times and it still doesnt work)

grand snow
#

there are plenty of resources you can follow at your own pace to do player movement

remote tundra
#

im only left with this option now

grand snow
remote tundra
#

lemme check that

#

nwo hwo do i get this into my project

grand snow
#

then you can import it. the visual of this asset are for URP only

umbral basin
#

Hi everyone,

Just joined the server and I am not really an active Discord user. Is this the place the ask questions? I dont see any channels specifically for help or voice chats that's why I'm asking.

grand snow
#

ask questions in the relevent channel
here is for code questions, #1390346776804069396 for light/graphics/shaders

strange jackal
#

character control question - am using 3rd person camera, and i have the target offset .x set to 0.45, but when I use S to run back, the camera swaps the sides of the offest creating a very jerky experience. so I tried to use this code to fix, but it is still kinda happend, them my code fixes it, but it is very jerky now...

    if (moveInput.y < 0)
    {
        cameraComposer.TargetOffset.x = -0.45f;
    }
    else if (moveInput.y > 0)
    {
        cameraComposer.TargetOffset.x = 0.45f;
    }
naive pawn
#

most of them are help channels so they aren't specifically designated

glass summit
naive pawn
glass summit
naive pawn
#

the channel

#

you never said what you needed help with

glass summit
grand snow
#

Yea people are free to help if they want

glass summit
strange jackal
naive pawn
# glass summit I did 💀

the most info you gave was "help with lean mechanics"
you never said what issues you were having or what part you needed help for

#

vague questions will yield vague responses

naive pawn
glass summit
naive pawn
#

ok, and what are said errors

glass summit
naive pawn
#

you shouldve led with said errors

#

and no need to ping me just to say "one sec" lol

glass summit
digital stone
digital stone
digital stone
#

or a private object

strange jackal
hexed terrace
# glass summit

remove the public from the line it tells you.
add an extra } where it makes sense to - so your brackets are in pairs

naive pawn
naive pawn
digital stone
naive pawn
strange jackal
naive pawn
#

so where does the issue come from exactly?

#

when it turns around?

strange jackal
#

ya

naive pawn
#

is it turning around immediately?

strange jackal
#

basically

naive pawn
#

then that would make the camera turn immediately too
perhaps slerp/smooth the rotation

strange jackal
#

ya

#

the character movement is ok, it is the camera jumps to the left side of my character. if I can simply stop it from doing that, it would be great

#

I want the cross hairs to stay on the right

naive pawn
#

perhaps slerp/smooth the rotation

strange jackal
#

basically like the game Valheim

glass summit
naive pawn
hexed terrace
#

tell me what you didn't understand.

glass summit
#

I'm new to Unity

naive pawn
#

this isn't unity-specific

glass summit
#

Also uhh

naive pawn
#

this is.. quite nearly english

glass summit
#

My scripts aren't opening

naive pawn
#

do you have an ide installed

glass summit
naive pawn
#

this is nothing personal against you, im not actively trying to be rude

#

but really, what carwash said is plain english

glass summit
naive pawn
#

now that's how you ask for clarification

#

an ide (integrated development environment) is the app you write code in

#

usually vscode, vs, or rider for unity

glass summit
naive pawn
# glass summit My scripts aren't opening

could you clarify on this?
what did you do exactly (double clicked a script in unity? double clicked a file in file explorer?)
did you get any pop ups or error messages

remote tundra
#

someone please help me..rob gave me a starter asset adn i downloaded it adn now it turns out the camera is stuck in a place that doesn't show anything..the player is moving but the camera is just stuck there

naive pawn
#

is it missing some configuration, perhaps

#

that's not a lot of info to go off of

naive pawn
#

you have compile errors, you have to fix those before these can make sense

naive pawn
glass summit
#

How exactly do I fix those? When I try to right click to open the script, they're not working

naive pawn
#

hm, not sure what's up with that, but that's a secondary issue
open the scripts in your ide or via file explorer for now, probably

#

it tells you the file and the line where the error is
the (408, 9) means line 408, column 9

glass summit
#

Nvm I give up man

#

I hardly understand half the stuff everyone is saying

#

Im just gonna make a new project from scratch

naive pawn
#

that.. isn't gonna help if you don't learn it eventually

#

if you don't understand a specific word or phrase, then ask about it lol

glass summit
#

Finally

#

I found and opened the script in my file explorer

glass summit
grand snow
#

something tells me you have no idea what this project is or what you are doing...

#

why are you fixing such an error?

naive pawn
#

the 2 lines giving errors, fix them as carwash said above

tidal needle
#

Yo i've been trying this for a while and i still can't get it so if anyone can spot the issue that would be sick. I've got this modifier for my game which allows the player to shoot from both sides of them but for some reason the bullet still spawns from the shield rather than behind the player. The raycast on the second side shows that the position is placed behind the player whenever I press shoot but bullet still doesnt spawn there.

glass summit
eternal falconBOT
naive pawn
glass summit
tidal needle
naive pawn
#

there should be line numbers

glass summit
naive pawn
#

turn them on in settings

#

there'll be a search bar

#

(no spaces between the backticks and the cs)

tidal needle
#

alr

glass summit
#

Sorry for caps

naive pawn
#

also make sure it's on the same line - also you can edit messages

glass summit
#

Ehem uhh I think I found the issue

tidal needle
#
float distFromPlayer = 0.75f;
        Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); //Gets the position of the mouse
        mousePos.z = 0f;    // Making sure that Z doesnt mess up the calculations/spawning

        Vector3 direction = (player.transform.position - mousePos).normalized;      //Direction of the mouse to the player

        Vector3 mirroredPosition = player.transform.position + (direction * distFromPlayer);    //Player position plus the direction opposite of player to mouse
        mirrorPos = mirroredPosition;
        Quaternion mirroredRotation = Quaternion.Euler(0, 0, Shield.transform.rotation.eulerAngles.z + 180);

        GameObject mirroredBullet = Instantiate(BulletPrefab, mirroredPosition, mirroredRotation);
        mirroredBullet.GetComponent<Rigidbody2D>().AddForce(-Shield.transform.up * shootForce, ForceMode2D.Impulse);
        Debug.DrawLine(player.transform.position, mirrorPos, Color.cyan, 1f);
#

😭

naive pawn
#

i meant the cs and the backticks

#

it still needs a newline after

#

also you can edit messages

#

from this, you have stray spaces

tidal needle
#

ahh is this it?

naive pawn
#

there we go, nice

#

yep

tidal needle
#

cool

glass summit
#

I'm getting another error

#

Failed to find entry-points

naive pawn
#

show the actual error please

glass summit
naive pawn
#

fix the other compile error first

glass summit
#

Line 470?

#

Wait nvm there's nothing there

#

Uh what compile error?

naive pawn
naive pawn
#

it's expecting a }

#

{} need to go in pairs, right now you have some { that isn't paired

glass summit
naive pawn
#

you have to add } somewhere to make sure they're paired

naive pawn
#

go find the one that isn't paired

strange jackal
#

next issue:
My ray cast from my camera hits my character. I was told I can put the player object in a different layer and the ray can ignore it, how to I make a ray ignore a layer?

digital stone
#

since charachter conteroller doesnt have a rigid body i cant give it a certain amount of force in a direction right ?

naive pawn
#

you can set the layermask from the inspector if you serialize it

naive pawn
digital stone
#

oh F

glass summit
strange jackal
naive pawn
naive pawn
naive pawn
#

layers will make this easier

naive pawn
glass summit
naive pawn
#

yes

glass summit
#

Idk what's wrong

tidal needle
#

like those x values are both opposite sides of the player in this case when a bullet is shot

naive pawn
hexed terrace
# glass summit

Your visual studio isn't setup to work with Unity. If you do this, it will make finding and fixing errors a hell of a lot easier.

#

!vs

eternal falconBOT
#
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

Visual Studio (Installed via Unity Hub)
Visual Studio (Installed manually)

glass summit
#

I'm never getting Unity's help ever again

#

I clicked on the Red underlined text and told Unity to auto adjust. Big mistake 💀

naive pawn
#

huh?

tidal needle
#

😂

hexed terrace
#

"auto adjust" -> what?

naive pawn
#

the unity extension?

glass summit
naive pawn
#

why do you think it's necessary

glass summit
#

Fair point

naive pawn
#

i mean it seems to be closed

#

idk the issue tbh but it's such a massive file

glass summit
naive pawn
#

make them not be in update

glass summit
#

Should I just delete void Update()?

naive pawn
#

no definitely not

glass summit
#

What?

naive pawn
#
  void Update()
  {
-   void OtherMethod()
-   {
-     /* ... */
-   }
  }

+ void OtherMethod()
+ {
+   /* ... */
+ }
hexed terrace
#

void Update() is the method , if you delete that the chunk of code below it will be an error and your code won't do anything

glass summit
naive pawn
#

your.. other methods..

hexed terrace
#

game dev is hard, you have to be able think and extrapolate things from the information provided

glass summit
#

🤯

hexed terrace
#

"OtherMethod" is obviously just an example used because Chris doesn't knkow your other methods and isn't going to go and find out

hexed terrace
naive pawn
#

you need to, in order,

  1. rest
  2. learn c# basics
  3. learn unity basics
glass summit
#

I'm aware about a little bit of Unity's basics

#

Nothing abt C# basics tho

naive pawn
#

you asked if you should delete the update method

glass summit
#

Man, Unity help screwed my script big time 💀

hexed terrace
#

because method signatures have the same structure. You can look through your code, without understanding it and see, from pattern recognition, where the methods are.

You're fighting an uphill battle.

Your VS isn't configured and you have no idea about the very basics of C#. Do yourself a favour and look at the links in the beginner resouces section of the pinned messages, and do/read them

strange jackal
naive pawn
low goblet
#

What is recommended logic for rotating a player via current mouse positioning in 3d space?

Right now I'm using RaycastNonAlloc on a configurable timer (currently running 1/10th of a second). It feels like using this is a bit redundant due to the infinite possibilities of ScreenPointToRay though.

Is there a better, more efficient way I can do this?

languid pagoda
#

I have a list of VehicleInstances. This list represents all the vehicles that the player owns. VehicleInstance is a scriptable object. The vehicleinstances that are being stored in the list represent what vehicles the player owns and references other scriptableobjects depending on what parts have been installed on the car. How would I serialize that list of VehicleInstances to json and then restore an instance to the same object when the games reloaded? Can I just call ToJson and FromJson and be done or?

wintry quarry
#

It's similar to referencing a sound clip or a texture. You could theoretically serialize all the data directly but most likely what you intend is to serialize a reference to the asset

#

You can use the Addressables package for this

#

Or roll your own

languid pagoda
wintry quarry
#

You could do that but it seems unlikely that's what you want

languid pagoda
#

well the scriptable objects are created at runtime too. IE the car has a base tune, player can edit properties like ride height and camber, and to prevent other instances of the car from being effected it creates a new instance of base tune scriptableobject and then user can modify the values in game.

#

So I would kinda have to serialize the data itself i think

wintry quarry
#

In these cases I use a setup like:

  • A SO base data object
  • a serializable runtime and storage time POCO/DTO object

The so is just there to create the runtime object more or less

#

There's no reason to deal with the SO overhead for the object that mutates at runtime and gets serialized

languid pagoda
#

That sounds like a lot. Is the overhead of scriptable objects that much?

wintry quarry
#

This would all be during your boot up and loading process

willow axle
#

can someone help me with my problum

wintry quarry
#

The gameplay scripts would only interact with the runtime data

cosmic quail
willow axle
#

this is my problum

languid pagoda
# wintry quarry No just have to SO produce the runtime object itself

So are you suggesting something like this?

using UnityEngine;

//[CreateAssetMenu(fileName = "NewSuspensionData", menuName = "Vehicle Physics/Suspension Data", order = 1)]
//[CreateAssetMenu(menuName = "VehiclePhysics/Suspension Data")]

public class RuntimeSuspensionData
{
    public float antiRollbarStiffness;
    [Header("Hit Detection - Inputs")]
    public LayerMask layerMask;

    [Header("Suspension - Inputs")]
    public float restLength = 0.33f;   // 35cm rest
    public float travel = 0.15f;       // 15cm usable compression
    public float minLength => restLength - travel;
    public float maxLength => restLength + travel;
    public float springStiffness = 55000;
    public float damperStiffness = 5000;
}

public class SuspensionData : ScriptableObject
{
    public RuntimeSuspensionData data;

    private void Awake()
    {
        data = new RuntimeSuspensionData();
    }
}

and then the runtime scripts would use a reference RuntimeSuspensionData

willow axle
glass summit
#

@hexed terrace @naive pawn may I add you both? Yall have been really helpful today

cosmic quail
plush bronze
#

Do anybody know a course and a project for learning Unity under a week

It has been 3 days and I have build a basic project by watching a video in the YouTube.

It's just a simple flappy bird game, at the end of the video, the Creator challenge us to add game start screen and other challenge that I can't really understand

wintry quarry
#

Basically the SO is only for design time

languid pagoda
wintry quarry
#

When you save youre game and load it you're only dealing with the runtime object

wintry quarry
languid pagoda
#

alright

wintry quarry
#

When you need it

#

E.g. when the player chooses their car or whatever

languid pagoda
#

alright awesome! Thank you for your advice. I like this design a lot better

#

Ill use assetbundles for things like GameObject and sprite and then store the path to the asset bundle in the scriptable object and a reference to the gameobject in the runtime portion.

keen dew
eternal falconBOT
#

:teacher: Unity Learn ↗

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

plush bronze
languid pagoda
keen dew
plush bronze
languid pagoda
plush bronze
#

Yeah I immediately realized this after making something by watching a tutorial in YouTube,

I felt like I just copy and paste the thing by watching someone else doing the big thing,

It doesn't teach me the most of the scripting part but I do now understand the fundamental of the Unity game engine.

To clear my doubts I joined this server and started asking you all,

And it really helps me to clear my doubts thanks for guiding me.

plush bronze
#

Code that thing without a clear explanation

iron otter
#

why OnTriggerEnter is called multiple times on single trigger?

languid pagoda
hexed terrace
#

It used to be, and probably still is, an awful lot of YT vids were from beginners who'd learnt a thing (often done in a bad way) and then thinking they know what they're doing and produce a vid showing the same poor ways

iron otter
tidal shuttle
#

You all are so smart in ts Im not gonna lie

keen dew
languid pagoda
# plush bronze Code that thing without a clear explanation

A good youtube video is going to spend more time explaining the core concept of what you're coding and will have charts and visual representations of whats going on without much time being spent on how to actually implement it.
For Example: https://youtu.be/MrIAw980iYg?t=1618

eternal needle
iron otter
eternal needle
#

Theres definitely an issue in your setup somewhere, or maybe you're expecting different results from what is really supposed to happen

iron otter
# eternal needle What are you logging specifically?
    private void OnTriggerEnter(Collider collider)
    {
        GameObject obj = collider.gameObject;
        // if (curTrigger == obj) return;
        // else curTrigger = obj;
        Debug.Log(obj);
        GameObject newObj = Instantiate(obj, trayTransform);
        newObj.transform.position = itemPlacePos[trayCurRow++][trayCurCol++];
    }```
languid pagoda
iron otter
languid pagoda
#

is the collider already intersecting with the trigger when you enter into play mode or enable the object the collider resides on?

plush bronze
iron otter
#

got to go, be right back

eternal needle
# iron otter forgot to mention, this script only runs on player and the only collider with is...

I'm not sure of your exact setup, but I do suggest looking at this
https://unity.huh.how/physics-messages/trigger-matrix-3d
Physics messages for OnTriggerEnter arent only limited to other colliders with isTrigger, depending on the setup. Not sure if thats your issue but I do also have to go. Otherwise it could be beneficial if you setup another scene with minimal objects (2 cubes) and test how trigger messages work.
Another thing is I would add logic so this code doesnt just instantiate anything it touches. Like use layers, tags, or a script on the other object to denote its valid to be instantiated via this logic

iron otter
#

back

iron otter
naive pawn
eternal needle
#

If thats a limitation you want on your side, you can check if the other collider has isTrigger set to true

iron otter
#

rather than that, I am now checking if the object I am detecting is the right one

#

I think that half solves my problem

#

thanks I will figure out the rest

smoky ruin
#

Guys, quick chat, I'm using the kinematic character controller and I noticed that when I'm standing still on a slope, its speed never resets, and I wanted to know how I can fix this, sorry for the inconvenience.

pearl frigate
#

Hey, where would I learn the coding of games (movement etc..)? I'm not interested in making the maps or anything lol 😅

Is there a channel or am I in the right place here 😄

rich adder
eternal falconBOT
#

:teacher: Unity Learn ↗

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

rich adder
#

also the resources posted in pinned

pearl frigate
#

cheers nav

neon glade
#

helo anyone able to help me out?

#

i have like multiple things i gotta do for my project but not sure how to implement them

slender nymph
#

!ask

eternal falconBOT
normal hearth
#

I've been working on a 3D Boxing game and the part I've been stuck on his making the glove not go through the head or body. I though of trying to make it so as soon as it collides with the head or the body the punch pulls back but obviously this issue makes it pull back in a sluggish unrealistic way.. What would be the best approach to make the glove not phase through the opponent?

eternal needle
normal hearth
#

Yeah so the animation plays then once it collides the punch retracts

#

I might be better off doing it with a raycast though if I had to guess?

eternal needle
normal hearth
#

Yeah

#

It's only slow pulling back when it collides. When it has no collision it's perfectly fine

fringe steppe
#

Is there a way to make game objects inside of my player be flipped every time the player does without them staying in the same position?

wintry quarry
fringe steppe
#

So because I have a 2D game in my player script I have a part where for example my default character position is to face right and I made it so when I look left and walk left the player sprite gets flipped to look left. But since I have game objects inside my player for some reason when my character looks left the game objects stay looking in the default direction (right)

wintry quarry
#
  • How are you flipping the player? Are you using the SpriteRenderer's "flip x/flip y" property? Are you rotating the Transform on the Y axis? Are you inverting the x axis scale?
fringe steppe
#

I use the SpriteRenderer's flip x

wintry quarry
#

that doesn't affect anything except how the renderer renders the sprite

#

if you want to automatically have all the child objects and everything else flip, use a different approach. For example rotate the whole object 180 degrees on the y axis

#

for some reason
The reason is you're not doing anything that would cause them to flip

fringe steppe
#

Alright I will try this and let you know if it works

eager stratus
#

So how would I go about overlaying dynamic text over a 3d object's materials? I saw something about using a RenderTexture, but surely there has to be a simpler way

strange jackal
#

I can only get this to execute if both game objects have rigid bodies, I have tried turning on the Is Trigger on the colliders, but nothing.

#

any ideas?

#

void OnCollisionEnter(Collision collision)

heady trench
#

hola fellow coders

#

its good to be here

wintry quarry
strange jackal
wintry quarry
eager stratus
#

It won't exactly look pretty, but it'll get the job done

#

It's worth noting that, depending on what you're trying to do, it may not be as simple as just that. This is a starting point, though

strange jackal
eager stratus
strange jackal
#

it seems to be working... when I attack the animation moves the sword through the object and triggers it. I had the OnCollision working, but it had to have a rigid body, which has physics

#

I am useing a mesh collider on the sword

eager stratus
#

If you keep testing you might find that there are some hits that definitely SHOULD register, but aren't

strange jackal
eager stratus
#

The way Unity's animator works and how fast hit frames tend to be, there's a good chance you might find some enemies where one frame has the sword just before hitting the enemy and the next just after with nothing registering in between. Almost like your enemy used King Crimson

eager stratus
strange jackal
#

ok, thanks!

eternal needle
eager stratus
strange jackal
#

a direct physics query ?

eternal needle
#

a box would make the most sense in this case

strange jackal
#

ok, I'll be back in about 45 minutes, off to pick up my son from work

eager stratus
eternal needle
#

so the swords location is being updated more than physics is being checked

eager stratus
frigid sequoia
#

Any idea why this is not loading the thing when I am basically coping the asset's path??

eternal needle
cosmic dagger
frigid sequoia
#

Yeah, it wasn't working without that either

eternal needle
#

my message included more than just the file extension

#

the docs describe it quite clearly

for example loading a GameObject at Assets / Guns / Resources / Shotgun.prefab would only require Shotgun as the path

frigid sequoia
#

I see, it looks directly on the resources folder

cosmic dagger
#

Was just about to say, you don't include "Assets" or "Resources" . . .

eternal needle
#

there is also a ScriptableSingleton, though ive never used it. Maybe itll work for your case

frigid sequoia
#

If an object in scene is a prefab, can I get the reference to the prefab directly from the object itself?

north kiln
#

No

#

Instances have no connection to their prefabs

frigid sequoia
#

Is this not what I am looking for???

keen dew
#

no

burnt rose
#

hello, is it possible to just put the box collider on the "grid" component so that it'll automatically apply to all the tiles underneath it? or is there a much more efficient way to do this?

fast heron
#

can you still use git/github with unity? or does it have to be the new unity version control

keen dew
#

You can use whatever you want

north kiln
grand snow
frigid sequoia
#

It was kinda the idea. I want my items to be stored into a list/dictionary database. This is done by clicking on the big button once all the values are set to add it into the database, which stores only the id and the prefab. The thing is I wanted this to, in the case I somehow forget later and click the button on an isntantiated object rather than on the prefab, it would just search for the prefab of that item and add it instead

#

I also wanted it to be able to ask the database for its id, but that's kinda redundant cause basically the database already ask the object for its id when adding it anyways, so there is no point and I am just dumb lol

grand snow
#

Is this an edit time automation?

#

If so yes you can use PrefabUtility to find the prefab asset an instance is linked to so you can then perform this operation

#

e.g.

string prefabAssetPath;

prefabAssetPath = AssetDatabase.GetAssetPath(gameObject);

if(string.IsNullOrEmpty(prefabAssetPath))
{
    //Check if this is an instance in a prefab stage
    PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
    if (prefabStage != null && prefabStage.prefabContentsRoot == gameObject)
    {
        prefabAssetPath = prefabStage.assetPath;
    }
    else
    {
        //Get prefab asset path from nearest instance root
        prefabAssetPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(gameObject);
    }
}
#

(prefab stage has to be accounted for specially because thanks unity)

frigid sequoia
#

What is even a prefabStage?

grand snow
#

thats when you open up a prefab asset to edit

#

that is known as a "prefab stage"

rigid swallow
#

I recently watched unity's video on game architecture with scriptable objects so I tried making an input system paired with simple movement but when moving the player it seems like the OnMove only gets called once even when the key is held, meaning I'd have to mash the key to get my player moving in a straight line. Is using a scriptable object a good idea for this or nah?

keen dew
#

Those are two separate questions. The movement issue has nothing to do with SOs

rigid swallow
#

I see, so whats the problem with the movement?

keen dew
rigid swallow
#

alright

#

thanks

inland flame
#

ive decided to use godot

grand snow
#

😆

knotty tiger
#

im trying to export my new unity build on mobile and i cant update my sdk platform tools. i get the same errror every time

Error building Player: Win32Exception: ApplicationName='powershell', CommandLine='-ExecutionPolicy Bypass -File "C:/Program Files/Unity/Hub/Editor/6000.2.2f1/Editor/Data/PlaybackEngines/AndroidPlayer\Tools\RunElevatedCommand.ps1" -ArgumentList Ignored "C:\Program Files\Unity\Hub\Editor\6000.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\cmdline-tools\16.0\bin\sdkmanager.bat" "C:\Program Files\Unity\Hub\Editor\6000.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK" ""cmdline-tools;16.0" "platform-tools" "build-tools;34.0.0"" "C:\Users\admin\Doppler\Temp\AndroidSDKTool"', CurrentDirectory='', Native error= The system cannot find the file specified.

Anyone know a fix or any sort of suggestions, been trying to fix it for a week now

wintry quarry
knotty tiger
grand snow
#

unity hub should let you right?

wintry quarry
#

from unity hub

#

same place you add modules

knotty tiger
#

Is it withing here?

vagrant cave
#

Hey, I'm interested in making a 2.5D pixelated game on unity however i'm struggle to find any tutorials on making such a game. Anyone know where i can look for these tutorials?

timber tide
#

No different than 2D really. You can still use spriterenders on a 3D scene

hallow acorn
#

hey what would be the correct way to calculate the uv coordinates for my 2d mesh used for displaying background of my softbody system? my x and y coordinates are between (-1, -1) and (1, 1). this is what it looks like right now

tall bridge
#

Does anyone know any good YouTubers to learn C# from—especially ones that go into abilities like flying? If not Anyone will do.

grand snow
hallow acorn
grand snow
#

in both cases it should work to judge the bottom left bound as 0,0 and the top right as 1,1
then use this to figure out the uv for a vert

naive pawn
#

there are pinned resources in this channel

hallow acorn
grand snow
#

if you know the bottom left bound, subtract from the vert position
Then divide by the bounds size to make it be from 0 to 1.

#

you can make a Bounds object and use Encapsulate() to make it fit all verts or calculate the min and max yourself.

hallow acorn
digital jacinth
#

how do i change a scale of an gameObject in a code?

grand snow
#

transform.localScale

#

someObj.transform.localScale = new Vector3(2f, 2f, 2f);

digital jacinth
#

thanks

knotty tiger
#

These are all my external tools path if that helps.
Is there maybe a setting i could've accidentally turned on that causes this error or is this purely an installation issue

meager ginkgo
rocky canyon
#

nothing really's in screenspace but mouse cursor..
it all needs converted to either world space or viewport space (if UI)

grand snow
knotty tiger
grand snow
#

!logs

eternal falconBOT
#
📝 Logs

Documentation

Editor logs

Windows: %LOCALAPPDATA%\Unity\Editor\Editor.log
MacOS: ~/Library/Logs/Unity/Editor.log
Linux: ~/.config/unity3d/Editor.log

Unity Hub

Windows: %UserProfile%\AppData\Roaming\UnityHub\logs
Mac: ~/Library/Application support/UnityHub/logs
Linux: ~/.config/UnityHub/logs

knotty tiger
tidal shuttle
#

For some reason Auto comment doesn't work for me

knotty tiger
# grand snow check above

unfortunately looking at the errors i didn't find anything different. Is there a way too check if you accepted the SDK license or a way to re accept it?

grand snow
#

if you use android studio to manage the sdk if can be easier as you can accept the license via that

grand snow
tidal shuttle
#

but what is sdk

grand snow
#

plz uses google next time

#

software development kit

tidal shuttle
#

ok thank you

exotic turtle
#

Why does this script crash my entire pc https://pastebin.com/gTP1WjyG ? I don't have any error messages because it just closes every program on my pc and doesn't show anything. I have tried restarting my pc and reinstalling my packages.

rich adder
#

line 59

fast fern
#

why does this happen? will unistall and reinstall fix it?

slender nymph
#

that package is no longer used. see the instructions for configuring vs code below 👇 !IDE

eternal falconBOT
fast fern
#

thanks✨

exotic turtle
hallow acorn
# grand snow you can make a Bounds object and use Encapsulate() to make it fit all verts or c...

ok i have looked at my code for 2 mins and i fixed to lines now it works. the formula converting the -1 to 1 coords to 0 to 1 coords was correct but i had to cast a value into a float so it doesnt get divided into an int, also i added an extra uv coordinate for the center point which wasnt listed before as it was outside of the for loop managing verts and uvs before.now it works perfectly fine

#

also a big thanks to you because no one has helped me as much with this topic as you. i learned a lot and would have never been able to do all that with out your help

grand snow
hallow acorn
#

i still have one question though, what would be the best to stop them intersecting? can i mmoify points of a polgon collider or something lke that?

hallow acorn
grand snow
knotty tiger
grand snow
summer wren
#

This Grid Layout Group for desktop items isn't playing well with drag and drop re-arranging. I'm using sibling indexing and anchor positions while accounting for the layout group grid.padding, grid.cellSize, and grid.spacing properties.
Snap to grid cell works perfectly, but only for the last item in the layout group.
Any desktop item dragged before it will instead select and drag the last item.
It must be the layout group re-organising itself right?
All cells are being recognised correctly, so the Math is correct. It's to do with OnEndDrag and my PlaceItem function surely.

I tried temporarily removing it from the layout group upon dragging and then re-placing it after dropping, but it does not fix the root issue.
What is the simplest way for dragging and dropping my Desktop Items so that they align with the grid layout group cell space of 12 rows and 5 columns while having the desktop items independent of each other? (I can post my DesktopItem and DesktopGrid code if you're fine with looking through it for me.)

grand snow
summer wren
# grand snow Do it yourself is the simplest answer. You can round the position to some grid

Yeah was curious whether there are easier ways to just be like "hey grid layout what is the position for all cells, even those which are currently empty?".
The whole cell thing is working fine as it is though, so this part is okay. It's just the OnEndDrag and PlaceItem functions I'm sure.
I realise after some debugging that it actually does recognise the dragging of other items in the group, but it'll only actually select and move the most recent item.

cold willow
#

Has anybody used Vivox and tried to leave all channels and log out before the application quits?
I'm trying to do this for when you exit playmode in the editor, but I can't figue it out 🧐
I would love to hear how this is supposed to be done if anyone knows

timber tide
#

gridlayout is just garbage in general and doesnt resize like the other layouts correctly

#

more of an issue for different resolution ratios

summer wren
# timber tide If gridlayout is the problem you can try your luck at using a combination or hor...

Yeah I'm thinking about this all too much. The grid layout group helps with both keeping columns and rows for my desktop items, and while providing responsive design. Like, in future, I'll have a button where players can toggle to new "desktop" pages to hold more items/programs, so the grid layout seems important here.
Really want it to be as flexible and as responsive to different screen sizes as possible.
It's just one issue which surely cannot be more difficult than the drag and drop snap-to-grid torture that I had endured (lmao).
It'll be solved - just frustrated at the moment and took some short breaks too xD

knotty tiger
grand snow
# knotty tiger sorry for bothering again, I've been searching for a while but where would i fin...

https://developer.android.com/tools/sdkmanager#accept-licenses
try this in the SDK folder
If using android studio it asks when you download an sdk in the UI so after that you can just change unity to use that instead

Android Developers

The sdkmanager is a command-line tool that allows you to view, install, update, and uninstall packages for the Android SDK.

pine dove
#

Hey! For anyone that uses UI toolkit, do you have any idea how I can change the text/background color of a tab?

rocky canyon
# hallow acorn

aye! perfect example of "keep at it" until u get a good result

#

pretty impressive progression i must say

hallow acorn
polar cedar
#

Hello everyone, I'm a beginner and I started my 3D game yesterday. When I reopened my project, it said that my URP is too old, and now none of my objects can be seen in the scene and the materials do not load.

hallow acorn
grand snow
grand snow
daring flax
#

hey yall, I'm starting out learning unity by doing chess following Etredal's youtube series on it, but instead with the new unity input system. I've followed chonk's youtube detect clicks guide, made an InputHandler script and object and can verify a click through the debug board.
How do I have the piece itself know that I've clicked on it and do stuff with that? The only tutorials I can find use a single object that is designated as player, instead of multiple pieces in an array that a player owns

#

if this question is better in input system please let me know

grand snow
rocky canyon
muted geyser
#

good luck 🫡

daring flax
grand snow
#

using components is a core concept of unity

#

Too bad this tutorial looks a bit shit

#

(using the gameobject name to then assign a sprite using a switch case is pretty shit design)

daring flax
#

do you know of a better tutorial for a board game?

grand snow
#

I dont but do they not do anymore?

#

Doing tutorials is a good way to learn but at some point you want to start doing things yourself (else you will be in tutorial hell as its known)

daring flax
#

I was going to use the chess implementation to make my own board game. My problem is every single tutorial for the new input system that I see is platformers with one moveable character when I want to be able to place and move pieces

rocky canyon
#

tutorials are always a good way to expose urself to new ideas/ new systems/ new components
but always need to be supplemented w/ ur own research to learn about the core concepts and adapt them to your own use-cases

grand snow
#

input is just a small part and tbh you can easily swap one for the other

#

anyway i can tell this tutorial is gonna teach you some bad habits

rocky canyon
#

^ very much so.. inputs are a considerable piece of the puzzle for all games..
once u figure out the input system ur using either new or the old.. you can pretty much adapt that as u like as well..
plus alot of table-top games are mostly gonna be based on Mouse-Input

grand snow
#

A person who can actually code and use unity who made chess: https://www.youtube.com/watch?v=U4ogK0MIzqk

My attempt at creating a little chess playing program!
Think you can beat it? Give it a go over here: https://sebastian.itch.io/chess-ai

Support my work (and get early access to new videos and source code) on Patreon or Nebula

Source Code:

  • GitHub:...
▶ Play video
#

its not a tutorial but shows his thinking and some code for how things get created

rocky canyon
devout socket
#

In my rigidbody-controlled player, I have a if-statement in a function called in Update() that looks like this:

float cameraSpeedLimit = 0.2f * m_CurrentSpeed;
if ((m_KatamariRigidbody.linearVelocity.magnitude < cameraSpeedLimit) && m_IsTouchingSomething)
{
    ...
}

In short, as long as the player isn't moving above a certain speed and they're touching a surface, the if-statement's code is executed
It works well, but before I make the player move, the first statement always returns false, despite the fact that my player's speed is 0 (and I have a constantly-updating debug variable set to rb.linearVelocity.magnitude that corroborates this)
Normally I would assume that it meant the linear velocity wasn't assigned yet or something, but the player starts in the air and falls down to the ground, so I don't think that's it
Does anyone know why this is happening?

warm iris
#

I'd like to learn unity, I have some prior programming knowledge but not C#, what are some good courses which are free / cheap?

grand snow
#

not sure why you arent using FixedUpdate

daring flax
rocky canyon
eternal falconBOT
#

:teacher: Unity Learn ↗

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

warm iris
rocky canyon
#

yes..

warm iris
#

ok thanks

grand snow
rocky canyon
warm iris
#

unity learn or this

rocky canyon
#

unity - learn is hands-on.. text/vid courses.. its slower but lets u experience it hands-on step by step..
the video just goes over the basics, code, the editor, concepts of programming..

#

two different things really.. you'll probably end up doing a little of both.. (if u want)
but if u want one that will cover everything its unity learn...
but theres multiple pathways.. and it'll take quite a bit of time to do em all

#

unity learn is Unity's official stuff

warm iris
#

do u think watching the youtube course first to even see if unity is for me and then watchin unity learn to know more about different fields is a good approach?

rocky canyon
#

you'll most likely need to
do unity learn stuff
experiment urself inside the engine
watch some YT videos
check out the Unity Documentation
read Unity Discussion Threads/ Stackoverflow posts
ask questions and learn from people here
rinse and repeat

#

using as many sources as possible..

rocky canyon
#

if u watch the first couple.. you'll already be getting an idea of whats to come

#

nothing wrong wth jumping around either..
burn-out can occur even whilst learning... soo may be benificial to switch it up
but also we all learn differently..

warm iris
#

ok thanks that was really helpful

rocky canyon
#

the first few are enough to judge for urself

warm iris
#

I appreciate it

red rover
#

Will a non-async function still wait for an async function?

public void Start()
{
    print(Time.time);
    
    SignIn();

    print(Time.time); // Will this be later?
}

public async void SignIn()
{
    // example
}
rocky canyon
grand snow
#

you have to await it to delay execution of things after

red rover
#

Can I set start to be asynchronous?

grand snow
#

yes but its recommended to use UniTask or Awaitable instead of Task

rocky canyon
#

lol.. username made me chuckle

grand snow
#

unitask/awaitable offer ways to wait within the unity update cycle correctly + other things

devout socket
# grand snow velocity has to build up over time even if it "starts" in the air and the veloci...

Sorry, I should have said
This if-statement's contents are listeners for player input events (specifically, entering different camera modes) - nothing happens unless the player presses a button
I've only tried to press the button after the player has landed, so I doubt the problem is that I'm pressing the button frame 1 before there's any velocity
Can you provide guidance based on that?

grand snow
ashen sorrel
#

Help please``` External Code Editor application path does not exist (C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe)! Please select a different application
UnityEditor.DefaultExternalCodeEditor:OpenProject (string,int,int)
Unity.CodeEditor.CodeEditor:OnOpenAsset (int,int,int)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

onyx hemlock
#

Any reccomendations for learning player input events? I want to do many things with mouse and button clicks.

#

I graduated college with a minor in game design and development. I still want to continue to learn coding C#! What's the best route?

teal viper
teal viper
eternal falconBOT
#

:teacher: Unity Learn ↗

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

summer wren
rough sluice
#

How can we make our unity game multiplayer?

sour fulcrum
#

code

red igloo
teal viper
#

And don't forget that it would make your game a "WoW killer"

cyan gulch
#

How to change the distance from the walls

#

I found it, no need

nimble apex
warm iris
#

💬 This was a ton of work to make so I really hope it helps you in your game dev journey! Hit the Like button!
🌍 Course Website with Downloadable Assets, FAQ, Related Videos https://cmonkey.co/freecourse
❤ Follow-up FREE Complete Multiplayer Course https://www.youtube.com/watch?v=7glCsF9fv3s
🎮 Play the game on Steam! https://cmonkey.co...

▶ Play video
mint swift
# warm iris Which one do you guys think is better for learning unity? https://www.youtube.co...

It wont stop on one course or one video like 1 year into game dev and i still find a lot of stuff i have to learn... then i suggest you to start with the code Monkey video to get general information about coding and then you could start by getting into more and more tutorials but be aware don't copy and paste what you are learning but instead learn it in depth to not fall into tutorial hell.
If anyone got another opinion am glad to hear it out.

willow walrus
#

👋 Unity dev here – I do bug fixes, custom scripts & multiplayer (Mirror/Photon).

naive pawn
silver lance
#

Yall r mega minds

low goblet
#

if you understand basics of programming or are coming from a different language however, no need

grand snow
#

Learn C# as is without unity, learning with shit tutorials wont do you much good

silk comet
#

I need help, I'm __instantiating __an object called wallPrefab, my prefab has a BoxColllider2D and a ShadowCaster2D. I'm setting all my objects parent as an object with CompositeShadowCaster2D, but when trying it, my Light2D don't cast any shadows, it's very bright and not dark at all... what can I do? (my ShadowCaster2D is already set to my BoxCollider2D in my prefab)

        GameObject map_obj = new GameObject("Map");

        GameObject shadowParent = new GameObject("Shadows");
        shadowParent.transform.SetParent(map_obj.transform);
        CompositeShadowCaster2D composite = shadowParent.AddComponent<CompositeShadowCaster2D>();

        foreach (Boundary wall in map.walls)
        {
            GameObject wall_obj = Instantiate(wallPrefab);
            wall_obj.transform.SetParent(shadowParent.transform);
            wall_obj.transform.localPosition = new Vector2(wall.pos.x, wall.pos.y);
            wall_obj.transform.localScale = new Vector2(wall.size.x, wall.size.y);
        }```
steel lantern
#

Trying to do the "Tanks!" tutorial. When I get to the step of adding a level to the scene the levels are all just pink shapes on pink backgrounds like some texture or color information is missing. Any ideas on how I goofed this up?

polar acorn
steel lantern
#

It would be just like me to miss a step where I was supposed to change the render pipline. Thanks. I'll check for that.

grand snow
#

most old things still use the Standard shader which is non functional in URP or HDRP

#

newer things often use URP or have a URP version too

worthy raptor
#

Just installed it, when I run it it says 'Must Fix All Compiler Errors'

steel lantern
#

The instructions call for the project to use the Universal 3D which I did. So I guess it's just non-functional? I'll find a different tutorial.

olive pine
#

I don't know if you have tried this, but when you upgrade to URP you need to select all the materials and go to Edit -> Rendering -> Materials -> Convert Selected Built in Materials to URP

steel lantern
#

The "Convert..." is greyed out for me.

rich adder
steel lantern
hexed terrace
#

code channel 😬

steel lantern
#

The general problem is when I import the assets for the tutorial I get this sort of pink rendering of assets. Since I only installed Unity 3 days ago, I'm mostly clueless about what this means.

rich adder
polar acorn
steel lantern
#

Checked a few and they say "Universal Render Pipeline/Lit".

rich adder
#

you can can look under Project Settings -> Graphics and double check

steel lantern
rocky canyon
#

usually you don't.. this is a new Universal 3D template.. typically comes assigned..
with a few presets in the project folder

neon forum
#

for dragging UI objects out of the canvas, how can I make it so that the object won't disappear when I drag it outside of the canvas viewing port?

#

Like I want it to be on the screen when I move it out still

hexed terrace
neon forum
#

so even if I remove it from the canvas it won't work?

neon forum
#

darn

steel lantern
hexed terrace
neon forum
#

I figured it out, thank you Carwash that hint was good

dense dirge
#

Hey, I need some help for making animation. I drew a player punching sprite sheet for 5 different costumes. I wanna add customization to my game so I need to animate 5 different costumes and their 3 parts. But idk how to use animation layers. Also, do I need to add more conditions for each part like (bool)char1headPunch, (bool)char2headPunch.....

rich adder
dense dirge
#

Ehh yeah sorry

#

Where do I need to ask

red igloo
rich adder
red igloo
#

Why does it do "That" when its on?

rich adder
#

particularly kinematic

hasty hearth
#

sorry, I'm a complete beginner and I don't quite know where to put this, but why isn't the main camera showing??

#

i searched everywhere and can't find an answer still

grand snow
#

showing what? the sky? did you change any settings on it?

hasty hearth
#

the UI itself

#

I can't get past the first tutorial cause I don't know if I have a camera or an empty object

rich adder
gentle bone
#

!learn

eternal falconBOT
#

:teacher: Unity Learn ↗

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

rich adder
#

unless you somehow removed the skybox material in the Lighting tab

gentle bone
#

would be a good idea to start..

grand snow
# hasty hearth

If in the inspector it has a camera component then its fine.
The gizmo icon may not be showing as the scene cam is too far away (press F to focus on it)

gentle bone
#

and it doesnt help much if you just shjow the camera view.. the settings are more important

hasty hearth
gentle bone
#

try this

grand snow
#

(somehow you turned them off)

#

but its a small thing to worry about, the inspector told you what you needed to know

hasty hearth
# gentle bone try this

That makes a lot more sense, I think it starts off with the gizmo bar and everything else tuned off unless you turn it on in the overlay menu

gentle bone
#

ps your settings are on orthographic...

hasty hearth
#

i thought that would fix the UI problem

#

part of my 34 tries

gentle bone
#

ah ok then its okay

#

3d view orthographic as i understzand is good for 2d things..^^

#

2d -< 3d games^^

#

or it gives 3d a 2d look^^

#

simple said

grand snow
#

that was not clear

#

perspective is for 3d
orthographic is 2d (no perspective)

next reef
#

please could someone help a namespace i know is correct and is the same in other scripts is saying the namespace doesnt exist

gentle bone
#

yeah i know english is not my native language probably i used the wrong words^^

#

just trying out chaingeing makes it simpler to understand^^

grand snow
next reef
grand snow
#

well if thats the case and its not in a different assembly then there is no other reason

rich adder
#

unless namespace was part of a package you don't have

grand snow
#

hmm yea what does "other scripts" mean

next reef
#

agh nevermind i figured the reason one of the scripts was in the editor folder

gentle bone
#

if you just copied and pasted .. probably you dont need the amespace just delete the line... and the { } brackets at start and end

grand snow
#

easy fix!

gentle bone
#

if its just 1 script doesnt matter

next reef
#

its a very big script

#

but i fixed it anyway

neon forum
#

Would the use of subroutines for resolving card game logic(when a card asks for a target or requires a player decision) be a good idea?

shell sorrel
#

unless concurrent stuff can happen as far as these decisons i think i would just control that flow with a really simple state machine

eager stratus
grizzled copper
#

Can some one help me pla

#

I want to creat game rp online for every jops police army ems all but i dont know how to make

hexed terrace
eternal falconBOT
low copper
#

I'm a beginner trying to implement a scene management system. My game is going to have a large number of scenes. As I am coding it now, I have my scenes call the scenemanager and tell it to go to the next scene. Is this ok? The other option I see is having some flag that says when the scene is "done" and having the scenemanager check for that constantly and handling calling the next scene. Seems more complicated but maybe better design practices? Is there a standard practice for this? I watched 5 or 6 youtube videos and they seemed like they had different approaches and were more complicated than I was hoping for. Any thoughts would be apprecaited.

hexed terrace
#

It's never standard practice/ good to constantly be checking for some event to happen.

#

Your first idea is the simplest way

red igloo
stuck current
#

Nvm

#

I need help with a shader

dusty vale
#

does anyone have good video tutorials on how to code in unity?

eternal falconBOT
#

:teacher: Unity Learn ↗

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

dusty vale
rocky canyon
# red igloo I am having this small issue where when I try to go and pick up an object I have...

yes, don't nest ur Inputs inside the raycast
right now your WasPerformedThisFrame() check is inside the raycast, so it only fires if you’re both hitting something and pressing the button that exact frame

thast why u have to keep spamming the button (until u get a perfectly aligned situation)

you should instead use a boolean... or assign the object to a variable..
and for ur input u can just check if ur raycast has assigned an object
if it is then u do ur interaction

it'd be like me putting if(Input.GetKeyDown) inside an OnTriggerEnter
the only possible way that would ever work is if i press the Key at the exact same frame we entire the trigger..
instead we'd want to change a variable when we enter the trigger.. and remove it when we leave the trigger
and then have the Input work independently of that (just checking if the variable was assigned)

dusty vale
#

how long did it take you guys to learn how to code? i wanna start learning but i dont know how long itll take or if i have to time

#

obviously it might take me longer or quicker than other people but it can give me an estimated time

rocky canyon
# red igloo I am having this small issue where when I try to go and pick up an object I have...
    // Check input
        if (Input.GetKeyDown(KeyCode.E))
        {
            if (currentTarget != null)
            {
                currentTarget.Toggle();
            }
        }```
for example my input is running in update ^ ... it doesn't *have* to be sync'd to the raycast
the currentTarget is either assigned or it isn't

or like
```cs
   private Rigidbody cachedInteractable;

    void Update()
    {
        if (Physics.Raycast(_camera.transform.position, _camera.transform.forward, out RaycastHit hit, maxDistance))
        {
            if (hit.collider.CompareTag("Interactive"))
                cachedInteractable = hit.collider.attachedRigidbody;
            else
                cachedInteractable = null;
        }
        else
        {
            cachedInteractable = null;
        }

        if (interactAction.action.WasPerformedThisFrame())
        {
            if (cachedInteractable != null)
                Debug.Log("Interacted with: " + cachedInteractable.name);
        }
    }```
#

the raycast did that for me... (so when i go get my input it doesn't care about the raycast at all)

rocky canyon
dusty vale
tall heart
#

How do you actually "learn" the coding from videos i just watched and recreated a flappy bird game and just know what 2 lines do

rocky canyon
#

rinse and repeat..
if u watch another tutorial.. u might know what 4 lines do..
and if u watch another.. u might know what 8 lines do..

polar acorn
rocky canyon
#

but basically u need structured practice..
pick a goal... practice that goal..

#

learn from that practice

rocky canyon
#

if it was as easy as just watching a video
i'd have a black-belt in karate
be a professional race-car driver
and so-on lol

neon forum
#

Maybe dont watch a video

#

Maybe just read the manual and figure it out

rocky canyon
#

watching videos are good at exposing urself to new ideas and concepts..

neon forum
#

"Today I will do X, how will I figure it out"

rocky canyon
#

but u never want to leave it at that...
use what u heard or seen in the video.. and go look up the things urself..

neon forum
#

And like train your brain for problem solving

brave robin
#

If anyone is familiar with UniTask, can someone tell me why this method executes all of the tasks immediately, rather than doing them in sequence and waiting on each one before starting the next?

private async UniTask DoTaskList(List<UniTask> uniTasks)
    {
        for (int index = 0; index < uniTasks.Count; index++)
        {
            await uniTasks[index];
        }
    }
polar acorn
#

Watching a video can help you learn, but the point is to use the video as a tool to solve a problem you have identified and defined.

There is a difference between "Hm... I don't quite understand the description of the cloth component, I think I need to see this in action to know how the settings affect the visuals" and "Making DOOM ETERNAL in Unity! (Part 417)"

grand snow
#

make sense?

brave robin
grand snow
#

you actually want a list of functions that return UniTask

#

List<Func<UniTask>>

brave robin
#
private async UniTask Shrink(Image image)
    {
        Debug.Log("Shrinking " + image.gameObject.name);
        float timer = 0f;
        float duration = UnityEngine.Random.Range(1f, 2f);
        while (timer < duration)
        {
            await UniTask.Yield();
            timer += Time.deltaTime;

            image.rectTransform.localScale = Vector3.Lerp(new Vector3(2, 2, 2), new Vector3(1, 1, 1), timer / duration);
        }
        Debug.Log("Shrinked " + image.gameObject.name);
    }

I made these for testing

grand snow
#

then you can invoke and await each in sequence

brave robin
#

Ahh, list<func<unitask>>, that's what I needed

grand snow
#

So the solution is to have a list of function references instead of Task objects

brave robin
#

List<Func<UniTask>> taskList = new List<Func<UniTask>>();
Not sure how to add a method to this list though, as befoire I was doing
taskList.Add(Stretch(image0));

grand snow
#

thats calling the function and adding the returned object to the list

#
private async UniTask AsyncThing()
{
}

taskList.Add(AsyncThing);

add the function itself

#

for things with args you need a lamda to wrap the call

taskList.Add(async () => {
  await Shrink(image);
});```
brave robin
#

Just now stuck on how to await an item in that list of func unitask

grand snow
#

you will invoke the Func and await it
await tasks[i]();

#

Action and Func are pre made delegates that let us have references to functions
therefore we can invoke them and await them if they return a task

brave robin
#

Success! Thank you! Was trying to get it to run multiple lists of tasks concurrently (do A, B, and then C on object 0, while simultaneously doing A, B, and then C on object 1, and then continuing when all tasks are done on both objects)

grand snow
#

you can also do await UniTask.WhenAll(A(), B()); if you dont need a collection

brave robin
#

Unfortunately I do need a collection, but I can use WhenAll on the methods that processes a collection to get the right result

grand snow
#

you can check the unitask readme for more info on what other things they offer

#

but most things that exist with Task also do in UniTask

smoky ruin
#

Guys, what's the best controller for creating a fast paced game? Like Ultrakill, Doom

naive pawn
#

there is no best

#

figure out what you need and what you want it to handle and what you want to control

timber tide
#

Well, you've a choice between the Character Controller or Rigidbody controller. For Doom you probably don't need rigidbodies so Character Controller is a good start, otherwise Doom controller isn't that hard to recreate yourself.

#

Quake controller is a bit more fluid though and not the easiest to recreate. I'd look around for projects that have attempted a controller for it

noble matrix
#

Can somebody teach me the basics of Unity Vr game creating?

vast matrix
#

Is there any way I can get Vector2.Distance to recognize the distance between the player and a transform that's not listed in the variable list. Cuz Im tryna make a system where you can pick up items, but not tryna make 100 different if statements based on every single different item

naive pawn
#

Vector2.Distance just does some math on 2 Vector2s

#

it's irrelevant to what you're asking

#

you need to get references to stuff you want to access

vast matrix
#

Rn I have a system where you can only pick stuff up based on the distance between the player and the object

naive pawn
#

if you have a ton of items you want to get the distance to, perhaps have them all register into a central list you can iterate through instead of a serialized list

naive pawn
vast matrix
#

ok

#

On another note. I have no idea how lists, triggers or casts work

eager stratus
#

Then inside the function you put what ever you want to happen when the two colliders intersect

naive pawn
#

now's a great time to learn then, because these are really useful tools

#

first though you should probably design out the behavior you want to have

eager stratus
#

Although the item's collider has to be a trigger for this to work (It's a toggle in what ever collider component you have for you item)

vast matrix
eager stratus
#

As I recall, either the player or the item also needs a rigidbody for the physics system to work at all

vast matrix
naive pawn
#

for something like this with triggers, you would have a larger trigger volume on the player so the item doesn't have to be inside you for it to work

#

the item could also be a trigger but that's a separate thing

naive pawn
#

this is about detecting items to begin with, presenting the option to equip them

vast matrix
#

ok

cosmic dagger
#

If you want to be more accurate, you should only allow the player to pickup the item if they're close enough and the player is looking at it . . .

gaunt cipher
#
public TileIndex TileFromObject(GameObject piece)
{
    TileIndex tile = null;
    foreach(GameObject t in tileMap)
    {
        TileIndex tempTile = t.GetComponent<TileIndex>();
        if(tempTile.Piece?.gameObject == piece)
        {
            tile = tempTile;
        }
    }

    return tile;
}

if the piece has been destroyed, and my normal program flow is interrupted (which usually sets .Piece to null), the reference is 'missing' in the inspector. But it still causes a reference error whereas null does not. How do I guard against this?

cosmic dagger
#

Oh, I confused the piece parameter with the Piece field, but the same thing applies; if Piece is a Unity object, you can't use the null propagation or null coalescing operator . . .

gaunt cipher
#

Piece is a TileIndex class

cosmic dagger
#

Also, you don't check if tempTile is null before accessing it . . .

gaunt cipher
#

I can be reasonably assured that all the objects in tilemap have tileindex components

#

no need

cosmic dagger
#

Oh, so the Piece object on tempTile is the issue . . .

gaunt cipher
#

sure, if Piece is null or a valid GameObject reference everything works fine, but when I click a bugged tile in the inspector it says "missing" in the field.

#

it's still related to GameObject because it only bugs out when a GameObject is destroyed and Piece = null wasn't called

cosmic dagger
#

Okay. What do you mean by bugged tile?

gaunt cipher
#

I read a little bit about fake nulls and the == override but didn't really understand it.

random lodge
#

The Unity website seems to be missing code in its explanations.

gaunt cipher
#

well it's a chess game so each tile has a reference to the piece and well I'm sorry but I just checked and it's a ChessPiece class which is also mine but it extends monobehaviour

#

a gameobject with a chesspiece class will be destroyed and that makes the Piece reference say missing instead of null

#

but really I just need to know what to do instead of what I was doing. I don't know how to check for 'missing'

#

fake null?

rocky canyon
cosmic dagger
gaunt cipher
#

I can't believe I didn't think of that, but a more robust method would be nice too..

cosmic dagger
languid pagoda
#

If I have public Wheel: WheelBase and wheel base inherits from monobehavior will start be called in both classes? and what order will they be called in?

random lodge
#

Should FixedDeltaTime be factored into this? (Moves a 2D ship left to right).

timber tide
#

Just toss it in fixed update and you're fine

random lodge
#

Is it possible when you have a tiled background to move the tiled BG in the Y but not physically move it, instead kind of scroll it while it also "regenerates" so it's acting like it's a ribbon that's just turning. Basically a background of star tiles that slide down. If that makes any sense. I don't want to physically move the tiles because it's only slightly larger than the camera.

eager stratus
#

So I have enough of these little canvas objects in the scene that I'm pretty sure are tanking performance. Is there any way I can do that occlusion culling thing I've heard so much about with them to increase performance? Will such a thing even work to increase performance if it's even possible at all?

keen dew
#

The first thing to do would be to remove the "pretty" from "pretty sure" by confirming with the profiler what the problem actually is

eager stratus
keen dew
#

Yes but there's more to objects than just rendering. For UI objects rendering is very rarely the bottleneck or the rendering problems are caused by something else like excessive text updates

eager stratus
keen dew
#

Not in that sense but that means you do have scripts on them (or scripts acting on them) so that might just as well be the source of the performance issues

eager stratus
keen dew
#

Use the profiler

eager stratus
#

Or rather it's struggling really hard

#

And the data I get from it is stuff I can't make sense of

keen dew
#

Then ask about that first, there's no point in trying to solve a problem when you don't even know what the problem is

eager stratus
keen dew
#

Ok but I can't help with that if all you can tell is "bunch of objects with scripts on them"

eager stratus
keen dew
eager stratus
keen dew
#

ScriptRunBehaviourUpdate is what runs the Update methods. And you can see that rendering only takes 8.35ms so it's not the problem (and therefore the answer to the original question is that occlusion culling would not help.)

eager stratus
keen dew
#

The screenshot shows only a small part of the output but what's there you could consider if all the UI elements really need to react to input

random lodge
#

Tried to follow a guide on using particles to make stars and the person cut off half the code on the website. Oof.

stiff ocean
#

hello

i have a very peculiar issue

//bar.tick is false.
    public void Left()
    {
        if (bar.tick) 
            --curr;
        dl.cont = true; //this works
    }
    public void Right()
    {
        if (bar.tick) 
        ++curr;
        dl.cont = true; //this fails, but only on one particular sentence
    }
simple kite
stiff ocean
simple kite
stiff ocean
simple kite
#

show full code

stiff ocean
# simple kite show full code
public IEnumerator createDialogue(Speak speak)
{
    charbg.gameObject.SetActive(true);
    dialogue.transform.parent.gameObject.SetActive(true);
    character.text = speak.name;
    character.rectTransform.anchoredPosition = new Vector2(0, 0);
    charbg.anchoredPosition = new Vector2((-speak.side) * 120, 220);
    charbg.anchorMax = new Vector2(speak.side / 2 + 0.5f, 0);
    charbg.anchorMin = new Vector2(speak.side / 2 + 0.5f, 0);
    dialogue.text = "";
    bool special = false;
    highlight = "";
    type = "None";
    for (int i = 0; i < speak.text.Length; ++i)
    {
        if (speak.text[i] == '|')
        {
            special = true;
            dialogue.text += "<color=green>";
            type = "Evidence";
        }
        else if (speak.text[i] == '#')
        {
            special = true;
            dialogue.text += "<color=orange>";
            type = "Question";
        }
        else if (speak.text[i] == '@')
        {
            special = true;
            dialogue.text += "<color=#00ffff>";
            type = "Agree";
        }
        else if (speak.text[i] == '\\')
        {
            special = false;
            dialogue.text += "</color>";
        }
        else
        {
            if (special)
            {
                highlight += speak.text[i];
            }
            dialogue.text += speak.text[i];
        }
        if (!cont)
            yield return new WaitForSeconds(GameManager.delay);

    }
    while (!cont)
    {
        yield return null;
    }
    cont = false;
    foreach (Evidence evi in speak.reveal)
    {
        rooms[evi.room].Add(evi);
    }
    foreach (var kvp in speak.unlock)
    {
        if (characters[kvp.Key].limit < kvp.Value) characters[kvp.Key].limit = kvp.Value;
    }
    FindObjectOfType<RoomMenu>().refresh = true;
    yield return null;
}
#

dl.cont points to cont here

simple kite
#

it's not full code lol

stiff ocean
#

anyway this is the only code that reads from dl.cont

#

oh
wait

the only reason the left button worked is because it was overlapping a different trigger
my bad

cosmic dagger
eternal falconBOT
patent wedge
#

i have an issue with my ui where i can hover on two things at once my scrolling using a gamepad and then hovering using a mouse.

grand snow
#

or a debugger

void dawn
#

i need help fixing a weird bug

so im making a first person shooter, and i put the guns in a way that would appear good for the camera that renders the weapons (second image) it also looks fine in the editor (show in the first image) but when i try to test it in game the guns always appear far away from the player (shown in the third picture) and i don't know how to fix it, i tried changing the code but it didn't work, the gun in game spawns far away from the player and it moves along with it, i dont know whats going on, can anyone help?

grand snow
eternal falconBOT
patent wedge
#

what's the correct way of doing this?
selectable.OnPointerEnter += OnHover();

grand snow
#

you subscribe the function instead of the returned value of the function when called:
selectable.OnPointerEnter += OnHover;

#

notice how () is absent because we dont want to call it?

patent wedge
grand snow
#

then wtf are you trying to do

#

if OnPointerEnter is a method then this isnt possible

#

did you think it was an event?

naive pawn
#

you've basically come to ask us this

"what's the correct way of doing this"
2 = a + b
we have no idea about any context here

patent wedge
grand snow
#

then lets step back. what type is selectable?
If this is UGUI or UITK both have easy ways to respond to cursor events such as pointer enter

patent wedge
grand snow
#

you can also use the EventTrigger component to do this but it may eat the event for the whole object so I do not recommend it.

patent wedge
grand snow
#

Dont say I didnt warn you

void dawn
dull grail
#

Hello, i'm trying to make enemy and got stuck with a problem. When i'm calling method from context menu my object jump too eager at first moment, almost like teleporting and only later it look like normal jump toward target. How can i make it more smooth

private void Ram()
        {
            Debug.LogWarning("Reminder: targeted player is hardcoded");
            var direction = Mathf.Sign(player.transform.position.x - _rb.position.x);
            ramPower.x *= direction;
            Debug.Log(ramPower);
            _rb.AddForce(ramPower, ForceMode2D.Force);
        }

Also for some reason it require a lot more power compared to player to make a move (Vector2 (300, 200) vs Vector2 (15, 7)). I know that player movement is in Update() but i still feel like it's not a normal behavior

nvm, i've used wrong forceMode

grand snow
drifting badge
#

I don't know if someone could help me with a behavior tree, I'm making a boss, the player has to place 4 fragments in their 4 corresponding altars and I want that when placing a fragment, 25% of the boss's life is removed. How could I make the behavior tree?

#

Each fragment will also be linked to an elemental power of the boss. If I place the fire fragment on its corresponding altar, I want the boss to not only lose 25% of his life but also not be able to use the fire ability. I don't know if it's too complex. Maybe I should make it simpler

silver fern
#

can I change transform.position to a fixed value somehow? I need the z coordinate to be 0

naive pawn
#

you can assign whatever values you want to it and it'll stay like that unless something else modifies it

silver fern
#

I have an object that I rotate by 90 degrees, but then it seems to clip through the background so I have to reset the z to 0 I think

naive pawn
#

you shouldve started with the actual issue

#

make sure your pivot is set appropriately

#

are you working in 2d or 3d

silver fern
#

2d

#

I'm just doing transform.Rotate(new Vector3(0f, 0f, 90f));

naive pawn
# silver fern 2d

have you tried just using separate sorting layers for the background and the foreground then lol

#

how are you determining it to be clipping?

#

is it half cut off or something

silver fern
#

I dont know how to describe it, let me try and record a video

polar acorn
devout socket
#

I have a player rigidbody in the shape of a sphere that I want to rotate in the air when the player jumps or falls
I experimented with setting the angular velocity directly (since normally the player keeps its old angular velocity when jumping or falling, which tends to be 0 or too small), but I found that when the player hit the ground with the added angular velocity, it bounced in the direction of its rotation instead of just up and down
Does anyone know of a way I could rotate the player in midair without causing it to bounce in the direction of its rotation when it hits the ground?

silver fern
#

looks like it stopped doing that for some reason

random lodge
#

"Destroying assets is not permitted to avoid data loss" uh

silver fern
#

what are you destroying

rich adder
polar acorn
random lodge
#

Thought I was destroying instantiated object

polar acorn
#

You probably don't want to destroy an asset file

plush chasm
#

For some reason my input suddenly stopped working in my game. I tried reverting to an older working commit but the input doesn't work there either. I tried opening another game and the input works there. Then I tried creating a new scene in my broken input game with just a plain UI button and the button doesn't work. I created a new scene repeating the exact same steps in my other game and the button works there. What could be the problem........?

rich adder
plush chasm
rich adder
plush chasm
rich adder
rich adder
plush chasm
#

My game does have a "Input System UI Input Module" attached to the event system which I think is the new UI but in my game settings I have it set to use both input systems so I don't think if something broke there it would matter. I also have that module in my other working game and compared the settings for it and they are the same.

#

I use the event system UI thing..

#

In a new scene I just create canvas (which creates an event system game object) -> create button -> enable raycast on the image -> change the highlight color to yellow to make very clear its working or not. That works in my old game but not my new one.

#

I also tested if( Input.GetKeyDown(KeyCode.Mouse0) ) which is detecting clicks so my mouse is working...... but I don't use that for anything

rich adder
plush chasm
#

UI isn't working but I also use the event system on my sprite with Physics 2d raycaster to detect clicks that also isn't working

#

wait... I just switched to device simulator and my clicks are working there.. they just aren't working under "game"

silver fern
#

is there a good way to move a 2d object forward a set amount independent of time?

rugged ledge
#

How do I set the rotation Y of a transform?

wintry quarry
#

You are dealing with quaternions

#

The y part of a quaternion has nothing to do with the y axis of rotation

rugged ledge
#

I'm trying to set the Y rotation of the player to the Y rotation of the camera when moving

silver fern
wintry quarry
# rugged ledge How do I set the rotation Y of a transform?

you probably want this:

// Get a "flattened" forward vector for the camera's look direction
Vector3 flatForward = Vector3.ProjectOnPlane(Camera.main.transform.forward, Vector3.up);
transform.rotation = Quaternion.LookRotation(flatForward, Vector3.up);```