#💻┃code-beginner

1 messages · Page 757 of 1

paper delta
#

oh you mean scripting?

#

ooo

#

this looks like a great website

scarlet pasture
#

i would give u a 7, u can make a paralaxx effect, and a small eye animation like he is closing hes i and open it. i dont know whats the name in englisch for that

hot wadi
#

Then those documents are no good in the meantime
I can try to list a few things u have to complete before programming in Unity
First is the syntax, types, loop, etc. specific to C#. Different languages have different settings
Second is OOP, understand what a class is, how to implement its features
Last is data structure and algorithm, this is a bit advanced so u can save for later, after u have a solid experience with Unity scripting. But u should take a look at some simple data structures at the beginning of the course.

paper delta
#

i believe it shows most of the stuff you listed

#

cause if not i wouldnt know where to find that stuff

#

it also seems easy to understand on the website

vital barn
#

A few years

hot wadi
paper delta
#

but im also sure you gain knowledge over time scripting

hot wadi
#

Yeah, writing functional code is one thing. Optimizing it is another

radiant voidBOT
#
<:error:1413114584763596884> Command not found

There's no command called if.

paper delta
toxic crypt
#

guys is there any way to block the access of our game if someone downloaded a mod version or downloaded our game's apk from anywhere other than google play store?

ivory bobcat
toxic crypt
hot wadi
#

There are like millions pirated products out there

toxic crypt
#

like my player data is stored on unity cloud

ivory bobcat
toxic crypt
#

yeah how to identify

#

because I dont want anyone to change the rss amounts

vital barn
ivory bobcat
#

What exactly would you be concerned about relative to cheating/modded?

toxic crypt
#

players data like email is also on the cloud

ivory bobcat
#

Clients would only have access to client side data.

vital barn
rough granite
# toxic crypt yeah how to identify

A few ways, you could keep a local copy in another encrypted file and compare them after each load, you could also keep a cloud file that you compare after and loaf

toxic crypt
#

because I want to implement rewarded ads and IAPs

#

or should Ifind a publisher to handle security?

rough granite
ivory bobcat
fast relic
toxic crypt
#

rn my game is simply writing game resources when game closed, and reading from cloud when game starts

#

if I use cloud code

#

will it be better?

toxic crypt
#

yeah , resource generations is happening on client

vital barn
fast relic
hollow rampart
#

hi guys, do you recommend buying courses to learn unity like this one? i want to learn at least the basics.

toxic crypt
#

then .... cloud code to triggern resources from server or the unity economy will handle the things itself?

fast relic
#

!learn

ivory bobcat
radiant voidBOT
hollow rampart
#

ok, thank you

#

i m sorry for bothering

slow blaze
vital barn
paper delta
hot wadi
paper delta
#

im also reading the same page twice to get it implemented to my head

#

oh yeah im getting syntax down pretty good

ivory bobcat
paper delta
#

got the quiz right

paper delta
vital barn
ivory bobcat
paper delta
#

ive learned syntax and output so far

#

very nice

#

and easy

hot wadi
vital barn
scarlet pasture
#

hey does sombody knows how to debug the force applyed to the Player, i build a knockback but its not working. i want to debug if the player gets any Knockback applyed => `

ivory bobcat
paper delta
#

my friend learned C# in 2 days😭

scarlet pasture
#

u mean after the "."??

wind apex
#

i used chatgpt to create an game and i wanted a script for when if the player touches an object the screen will fade and change to another scene. using UnityEngine;

public class GlowingObjectTrigger : MonoBehaviour
{
    public SceneFader fader;
    public string nextSceneName = "DreamScene"; // change this to your scene

    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            StartCoroutine(fader.FadeAndLoadScene(nextSceneName));
        }
    }
}

this is what it came up with. however i do not get teleported to the other scene

scarlet pasture
#

i will try it

#

u right

scarlet pasture
hot wadi
cosmic dagger
wind apex
scarlet pasture
#

yeah but for a commercial game it would not be enaugh

wind apex
#

i have 0 experience in C#

#

its for a school project

scarlet pasture
#

yeah use ai but try to learn with it. im also new and im also using AI like here =>

hot wadi
#

Germany?

scarlet pasture
#

yeah

wind apex
wind apex
#

ty

#

for now i just want to get finished with this project and then work on some of my OWN ideas and leanr with it

naive pawn
#

it's a tool that needs experience to be used correctly - you don't have the necessary experience as a beginner

#

it will hallucinate, that is part of how LLMs are designed - you need extensive experience to be able to filter the bullshit

#

it will do far more harm than good. just use reputable sources instead

#

cc @wind apex ^

wind apex
#

Ok

scarlet pasture
#

90% asking here, 10/% AI

sour fulcrum
#

do 90% google, 10% ask here

scarlet pasture
#

hahaha

sour fulcrum
#

(not a joke)

naive pawn
#

yeah that's pretty good advice

#

just cut AI out

#

it will harm you in the long run

tired python
#

i got a problem. I want to make a highscore label which correctly logs the highscore everytime the player dies. thing is, it does not work because it ends up starting from 0 all over again when i press restart. should i make the highscore a global variable outside of the public class player? will that work? or is it that everything in unity requires to be made inside the derived class

cosmic dagger
#

Facts. It has been proven that 90% of questions — here — can be answered through a Google search. The other 10% is where we actually get involved (and conduct our own Google search), lol . . .

paper delta
#

wow

#

C# is so fun and easy to learn

#

well

#

the basics

#

ig

#

im learning about variables it is so easy

#

i dont even have to write code inside visual studio

hot wadi
#

I suppose all the method of ‘Physics’ must be kept inside FixedUpdate, right?

paper delta
#

do i have to code this while learning the basics cause i honestly just have it stored in my brain

hot wadi
#

I never noticed when I use them in Update and now it’s causing some weird glitch when I ‘teleport’ my character

hot wadi
paper delta
#

alright ill make something basic rq with all my knowledge

tired python
paper delta
#

damn it

#

i forgot the thing before WriteLine

hot wadi
paper delta
#

wasnt it console?

tired python
# hot wadi Try PlayerPrefs
void CheckHighScore()
{
    if (Score > PlayerPrefs.GetFloat("HighScore", 0))
    {
        PlayerPrefs.SetFloat("HighScore", Score);
    }
}```
#
void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Asteroids"))
    {
        HighScoreText = UIdoc.rootVisualElement.Q<Label>("HighScore");
        HighScoreText.text = ($"High Score: {HighScore}");
        PlayerPrefs.GetFloat("HighScore");
    }
}```
hot wadi
#

U are setting the “HighScore” to the ‘Score’ variable

tired python
#
{
  private Label HighScoreText;

private float HighScore = 0f;
}```
hot wadi
#

No wait, I’m on phone. This is hard to look at

tired python
#

still not working

tired python
tired python
#

this might be a bit easier to look at

#

these are all the codes which work to make the highscore work

paper delta
#

i might just be stupid

tired python
paper delta
#

but i have no clue whats wrong with the code

#

💔

tired python
hot wadi
paper delta
#

OH WAIT

tired python
#

do you want to print 15 or 76

paper delta
#

i just realized that

#

15

sour fulcrum
paper delta
#

so im cooked

tired python
paper delta
#

mhh

#

i messed up

#

bad

#

for my first ever script

tired python
#
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;

public class Player : MonoBehaviour
{
     Label HighScoreText;

    private float HighScore = 0f;
    
    void Start()
    {
    }
       
    
    // Update is called once per frame
    void Update()
    {

        
    }

    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Asteroids"))
        {
            HighScoreText = UIdoc.rootVisualElement.Q<Label>("HighScore");
            HighScoreText.text = ($"High Score: {HighScore}");
            PlayerPrefs.GetFloat("HighScore");
        }
    }

    void CheckHighScore()
    {
        if (Score > PlayerPrefs.GetFloat("HighScore", 0))
        {
            PlayerPrefs.SetFloat("HighScore", HighScore);
        }
    }

    void ReloadScene()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}
#

@hot wadi

paper delta
#

yup im getting nowhere

hot wadi
#

Lol, u have to put your code in Start and Update

#

Otherwise they dont run

sour fulcrum
#

yesnt

tired python
#

but think about it, i have another variable called score

sour fulcrum
#

you dont have to use those two

#

but something does need to call CheckHighScore

paper delta
hot wadi
#

Yeah well they are not calling checkhighsore anywhere at the moment

#

All u did was defining the function

tired python
sour fulcrum
#

something calls it

#

that isnt shown in those screenshots

#

what do you do that makes it call?

tired python
#

wait a sec

paper delta
#

ive fixed lua scripts before

tired python
#

oh ya, sry it is called

paper delta
#

now that i think of it

tired python
#

so i need to make a call inside update?

sour fulcrum
#

call when its needed, which could or could not be update

#

when should checkhighscore run? logically

tired python
sour fulcrum
#

your not wrong but your a little early

#

why would you want to run checkhighscore

tired python
#

because i have been updating score up until now, and then once the collision which ends the game occurs, i wanna use whatever is stored inside score to be stored in highscore

sour fulcrum
#

right

paper delta
#

OH

#

i see the problem here now

tired python
#

and that highscore needs to be stored globally

sour fulcrum
#

so you would want to do this check when score changes

#

which right now is in oncollision, hence not being wrong

#

but just in general try to think about the logic step by step here

tired python
#

wait lemme try

sour fulcrum
#

OnCollisionEnter -> Check if it's the interaction you want -> set score as a result of that check -> check high score as a result of the score being set

paper delta
#

im kinda getting mad

#

it says y does not exist

sour fulcrum
#

OnCollisionEnter is one of the initial jumping off points for code in unity but its not the only one (eg. start and update)

tired python
#

lemme try that

#

bruh, i haven't been calling checkhighscore up until now anywhere when a collision occurs

#

i am dumb

sour fulcrum
#

anyone trying to learn isn't dumb

tired python
#

i thought CheckHighScore worked like OnCollisionEnter2D(Collision2D collision)

paper delta
#

im so confused

tired python
#

didn't know that OnCollisionEnter2D(Collision2D collision) is in-built

tired python
sour fulcrum
#

yeah its not uncommon for newbies to be confused by that

#

unitys kinda "magical" functions

paper delta
#

im really new so

tired python
paper delta
#

its my first ever script

#

basic i know

tired python
#

which symbol do you use to make the compile know that?

paper delta
#

; this

tired python
#

yes

#

are you ending all the lines with this?

paper delta
#

no cause some i dont see on

tired python
#

but you should right?

paper delta
#

some

paper delta
tired python
paper delta
#

this is so bad for my first scriptnotlikethis

tired python
paper delta
#

namespace?

tired python
#

also, before anyone says, yes you should go to a C# server for this but just for now...it's aight

balmy vortex
#

is there any easier way to do this or like wat's going on

paper delta
tired python
#

also, this is for unity related question, go to a C# discord server...

paper delta
tired python
hot wadi
balmy vortex
#

the player dashes miles on the y axis but only inches on the x and z axis

#

tldr

tired python
#

@sour fulcrum still doesn't work?

#

i did call CheckHighScore() when a collision occurs

paper delta
tired python
keen dew
#

Either look up how to properly shorten the vector or have a separate multiplier

tired python
#

even i am new to this

balmy vortex
#

@keen dew

balmy vortex
#

oki

tired python
#

i even changed when the HighScoreText was getting the visual but it's not working

balmy pelican
tired python
balmy pelican
slender nymph
tired python
#

its a label

#

i am declaring private Label HighScoreText; in player class

tired python
hot wadi
#

This is a visual tree asset. I'm not familiar with this. Try looking it up

balmy pelican
#

Not gonna lie I have no idea what a label is. Do you not use textmeshpro inside a canvas?

tired python
#

no

slender nymph
slender nymph
tired python
#
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;

public class Player : MonoBehaviour
{
    public float Thrust = 1f;

    Rigidbody2D rb;

    public float maxspd = 15f;

    public GameObject boosterFlame;

    private float ElapsedTime;

    private float Score = 0f;
    
    private float ScoreMultiplier = 10f;
    
    public UIDocument UIdoc;
    
    private Label scoreText;

    public GameObject ExplosionEffect;

    private Button RestartButton;

    public GameObject CollisionEffect;

    private Label HighScoreText;

    private float HighScore = 0f;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        scoreText = UIdoc.rootVisualElement.Q<Label>("ScoreLabel");
        RestartButton = UIdoc.rootVisualElement.Q<Button>("restartButton");
        RestartButton.style.display = DisplayStyle.None;
        RestartButton.clicked += ReloadScene;
    }
       
    
    // Update is called once per frame
    void Update()
    {

        ElapsedTime += Time.deltaTime;
        Score = Mathf.FloorToInt(ElapsedTime * ScoreMultiplier);

        scoreText.text = ($"Score: {Score}");

        if (Mouse.current.leftButton.isPressed)
        {
            //Calculate mosue direction
            Vector3 MousePos = Camera.main.ScreenToWorldPoint(Mouse.current.position.value);
            Vector2 direction = (MousePos - transform.position).normalized;

            //Have player move in direction
            transform.up = direction;   
            rb.AddForce(direction * Thrust);
            
            if (rb.linearVelocity.magnitude > maxspd){
                rb.linearVelocity = rb.linearVelocity.normalized* maxspd;
                
            }
        }
balmy pelican
tired python
#
    {
        boosterFlame.SetActive(true);
    }
    else if (Mouse.current.leftButton.wasReleasedThisFrame)
    {
        boosterFlame.SetActive(false);
    }
}

void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Asteroids"))
    {
        HighScoreText = UIdoc.rootVisualElement.Q<Label>("HighScore");
        CheckHighScore();
        HighScore = PlayerPrefs.GetFloat("HighScore");
        HighScoreText.text = ($"High Score: {HighScore}");

        Destroy(gameObject);

        Instantiate(ExplosionEffect, transform.position, transform.rotation);

        RestartButton.style.display = DisplayStyle.Flex;
    }
}```
slender nymph
#

!code

radiant voidBOT
tired python
#
    {
        Debug.Log("Static was called.");
        if (Score > PlayerPrefs.GetFloat("HighScore", 0))
        {
            PlayerPrefs.SetFloat("HighScore", Score);
        }
    }

    void ReloadScene()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}```
#

done

#

thats the whole thing

slender nymph
#

instead of spamming a bunch of code blocks across several messages and flooding the chat, you are expected to share large code blocks via a link to a paste service

#

anyway, since you don't want to post the code correctly i'll just say this: make sure your scene is actually saved in the correct state before you enter play mode.

tired python
#

what the hell

slender nymph
#

why are you sharing an htm file

#

did you do something dumb like download the page instead of clicking the in-website save button to share the link?

tired python
tired python
#

!code

radiant voidBOT
tired python
# slender nymph do this ^

i assume you are telling me to tinker smth in void ReloadScene() { SceneManager.LoadScene(SceneManager.GetActiveScene().name); }

slender nymph
#

no, i'm telling you to save the god damn scene before you enter play mode

tired python
#

oh, i don't know how to do that, lemme look it up

balmy pelican
#

dawg

naive pawn
#

you've never hit ctrl+s before?

balmy pelican
#

its file + save at the top left

tired python
#

oh saving the scene in the case means saving the code

reef dune
#

Howdie! im making a flappy bird like game for practice and ive made the script and all works fine , but theres something weird happening
everywhere the score is set to 0 , but when i boot up the game it automatically adds 1 , and the first pipe doesnt give any points , it only starts adding points from the second one ```using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class LogicScript : MonoBehaviour
{
public int playerScore = 0;
public Text scoreText;
public GameObject gameOverScreen;
public AudioSource dingSFX;
[ContextMenu("Increase Score")]
public void addScore(int scoreToAdd)
{
playerScore += scoreToAdd;
scoreText.text = playerScore.ToString();
dingSFX.Play();
}
public void resetGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

public void gameOver()
{
    gameOverScreen.SetActive(true);
}

}


and this is the call to the function
```using UnityEngine;

public class PipeMiddleScript : MonoBehaviour
{
    public LogicScript logic;
    public Birdscript birdscript;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        logic = GameObject.FindGameObjectWithTag("Logic").GetComponent<LogicScript>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!collision.CompareTag("Player"))
            return;

        Birdscript bs = collision.GetComponent<Birdscript>();
        if (bs != null && bs.birdIsAlive)
        {
            if (logic != null)
                logic.addScore(1);
        }
    }
}
tired python
#

i thought it was smth to do in the unity hub

naive pawn
slender nymph
tired python
#

i did

#

it's not working

slender nymph
#

the SCENE not the code

tired python
#

O_O

slender nymph
#

screenshot your entire unity editor then outside of play mode

naive pawn
#

in the hierarchy tab, does the scene name have an asterisk beside it

tired python
#

ohh

#

i saved it

tired python
# paper delta

you don't need to initialise z because you don't end up using it

kind aurora
#

Heyyyy guys

naive pawn
tender mirage
#

Does anyone know why i can't apply my physics material into my rigidbody? this is the first time i'm experiencing this.

slender nymph
reef dune
naive pawn
slender nymph
reef dune
#
  • the second one and every one after that works perfectly
tender mirage
#

i clicked on the one below

slender nymph
# reef dune

in that case make sure the method isn't being called twice by having more than one collider on one of the relevant objects

hot wadi
tender mirage
slender nymph
reef dune
slender nymph
#

if the UI already says 1, then it won't be changed until the score reaches 2 because it isn't updated to say 0 ever and when the score reaches 1 it's just going to be updated to say 1

hot wadi
#

It's the default text u put in the Inspector of the UI text

reef dune
#

ok it works now but why does the ding happen?

#

Its supposed to only activate the audio source on point added

slender nymph
#

make sure that Play On Awake isn't selected on the audio source

reef dune
#

I guess i got fooled by my own code 😭

#

Unity is confusing in comparison to godot

#

but feels so much better

hot wadi
#

What seems to be code-related may not be code-related at all

reef dune
slender nymph
#

yeah in this case it was stuff in the inspector causing issues

reef dune
#

I need to learn writing tests in c#...

balmy pelican
#

oh mb someone answered

slender nymph
# tired python I sent it btw

okay, well first off you circled the wrong thing. that's the project name, i was referring to the scene which is in the hierarchy. and show what is happening now

tender mirage
#

did someone ping?

scarlet pasture
#

hey how can i progeamm a hit stop? like if the player attacks someone the Game frezzes for a short time

balmy pelican
rugged beacon
#

why dont you just disable the box

scarlet pasture
#

can u show me a short exapmle`?

balmy pelican
#

ok

scarlet pasture
#

Thank U!

balmy pelican
#

IEnumerator PauseTime()
{
Time.timeScale = 0f;
yield return new WaitForSecondsRealTime(Amount of time you want to pause for);
Time.timeScale = 1f;
}

rugged beacon
scarlet pasture
balmy pelican
#

btw make sure to run it with StartCoroutine(PauseTime())

#

since it's a coroutine

radiant voidBOT
scarlet pasture
#

and if i frezze the time? what happens with my swicht states? i increse values with time.deltatime

fast relic
#

just for the future, makes it easier to read

scarlet pasture
#

they also get frezzed right?

balmy pelican
#

!code

radiant voidBOT
fast relic
scarlet pasture
#

perfect

#

thank u

fast relic
balmy pelican
#

i meant i didnt know how to do it before

fast relic
#

well now you do

balmy pelican
#

yes

tired python
rugged beacon
#

disable it how you want
but you need to do something to make to hide it

limber turtle
#

i've been a bit stuck on how to make my pseudo-pathfinding system and i've realised that i could potentially use dijkstra's algorithm or a breadth-first search to find routes between nodes at the start and then store them for use, only changing them if the terrain changes (which probably won't happen). would this be difficult to implement?

tired python
limber turtle
#

and would it be possible to have it navigate through every empty/non-contact tile on my tilemap?

tired python
#

I am assuming this thing makes it visible

rugged beacon
#

thats just you getting the text reference

rough granite
fast relic
rough granite
#

Just reference the GameObjdct and set it to inactive

fast relic
#

you're just getting the object, not doing anything with it

tired python
#

oh, I am just referencing the ui doc then

#

What part of the code displays it then??

#

Like for restart I get, it's setting false then true

rugged beacon
#

from the video you sent, that thing already enable on the scene

tired python
#

but for label, that ain't the case...atleast not for the scoree

fast relic
#

are you turning it off anywhere? ui documents are enabled by default

tired python
#

But how will it display when collision occurs?

rough granite
rugged beacon
#

enable it back when you collide

rough granite
tired python
tired python
rugged beacon
#

idk uitk

rough granite
tired python
tired python
#

Wait

fast relic
#

you can just change the ui document's enabled property to show or hide the entire thing

rough granite
limber bolt
#

hello

tired python
#

Wow u can read the ui damn

fast relic
limber turtle
#

can someone provide me a decent example of dijkstra's algorithm or a breadth first search implemented in unity/c#?

tired python
limber turtle
#

i want to make a flying enemy navigate to a good sightline towards the player through multiple vantage points

#

and i think if i can figure out how to do that properly i can find all the routes at the start of the game and then just use them until the terrain changes at all

#

which might happen but isn't guaranteed

#

i've kinda given up on a* because i had no idea how to implement it properly

#

so i'm thinking i might as well find a way to implement an easier but worse version myself

tired python
rough granite
tired python
#

This might help

#

Dunno for sure though

fast relic
limber turtle
#

it's for a computer science project

#

if i don't make it myself i have to document it

swift crag
#

It does not do anything else

limber turtle
#

and i'm just looking for a really really basic pathfinding system

limber bolt
#

Listen, I'm trying to make a top-down restaurant game like penguin dinner, but I'm afraid I'm not pretty sure what to do next. I set everything up, so everything has collision and even the player moves. However, I'm not sure what to do next. I'll probably need to make the clients system, when like in Penguin Dinner when you click the client and next you click a table, the client walks to the table. However I have no clue how to do that in code, so any help would be appreciated

tired python
#

how do I disable itbthoguh?

swift crag
#

ah, Cookie got it

#

changing its "display" style to None will cause it to disappear

tired python
#

And then only true for when collision occurs

#

Gotcha

swift crag
limber turtle
#

i don't want to use aron granberg's solution

#

it's good

swift crag
#

That's the more annoying part here

limber turtle
#

but i can't use it properly

swift crag
#

i'd start out by just making the enemy fly towards the player and steer away from walls

#

it might get stuck in corners, but it's a reasonable first step

limber turtle
fast relic
limber turtle
#

i might just do it with all the tiles and their adjacencies, then make shortcuts based on what my enemy can directly see

#

make a route first and find shortcuts on the way

swift crag
#

for flying enemies in a sparse level, you don't need much more than "charge the player"

limber bolt
limber turtle
#

the flying enemies shoot projectiles

limber turtle
#

and if they can already see the player, they run on different movement code

tired python
limber bolt
fast relic
# limber bolt Yeah, and moves the character

well for detecting clicks, google (or your search engine of choice) is your friend
as for moving the character, you can just change its position in a straight line towards the table or move it between a few preset key points, should work fine for a static map

scarlet pasture
#

hey can sombody pls help we why my player dont gets any KnockBack

#

everthink work like, damage or HitStop

naive pawn
#

have you tried debugging where the code gets to

fast relic
scarlet pasture
#

i only debuged the value and i checked if the code really gets to the last ApplyKnockBack code

scarlet pasture
naive pawn
#

what do you mean by "last ApplyKnockBack code"

fast relic
#

well the player script

naive pawn
#

the AddForce call?

scarlet pasture
naive pawn
#

so does it?

scarlet pasture
#

i also get a Knockback but exremly weak even i set the vlaues above 5000

naive pawn
#

have you tried logging the resulting totalForce you're applying?

#

what's the mass and body type of the player RB?

scarlet pasture
wary egret
#

how to learn unity ?

scarlet pasture
naive pawn
#

it's the same

naive pawn
radiant voidBOT
wary egret
#

thx

tired python
#

private Label HighScoreText; i have been searching for ways to make this Label visible and invisible but i can't find any method

naive pawn
fast relic
scarlet pasture
naive pawn
#

that wasn't the question

tired python
tired python
scarlet pasture
#

here is a picture

fast relic
fast relic
tired python
scarlet pasture
#

its over 900 lines

#

i can u show how i handle the gravity in my player script if u want

naive pawn
#

how are you moving the player?

scarlet pasture
#

wiht Rigidbody2d

naive pawn
#

ok, yeah no

wary egret
#

is it possible to make gta 6 in unity?

naive pawn
#

charactercontroller and rigidbodies are not meant to be used with each other

scarlet pasture
#

my bad

naive pawn
#

character controllers aren't even meant for 2d

naive pawn
scarlet pasture
fast relic
scarlet pasture
#

i mean i only use a Rigidbody2d and a CapsuleCollider2D

wary egret
naive pawn
fast relic
#

are you modifying the velocity directly?

scarlet pasture
#

ahhhh wait

naive pawn
fast relic
wary egret
thorn verge
#

hello i don't know if this is allowed
am looking to commission someone to make an anti-cheat protection
dm me

radiant voidBOT
# naive pawn !collab

: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**

scarlet pasture
#

here i move my Player wiht vel

tired python
frail hawk
#

you could reset your velocity before the knockback maybe.

scarlet pasture
#

i love u bro

#

i totally fiorget that

rough granite
# scarlet pasture

As far as i know you shouldn't use fixed update for rigidbody movement as it already has its own update timing

fast relic
scarlet pasture
#

i read the values and inputs with Update and handle the movement with FixedUPdate

#

so i use both

rough granite
naive pawn
#

rigidbodies live on FixedUpdate (or more accurately, the fixed time step)

scarlet pasture
naive pawn
#

i don't know what you're on about in terms of timing

scarlet pasture
#

i use a swicht that makes everthing ready if he is in KnockBack so i can add Forced etc

rough granite
scarlet pasture
#

Switch are so OP

#

10000 times better than if

fast relic
scarlet pasture
#

for Enums they are great

fast relic
#

also I think what you're referring to is a simple state machine

tired python
#

my first game is over

fast relic
limber turtle
#

can someone send me an example of someone using dijkstra's to find paths through a tilemap? i just want to make sure i'm doing this at least somewhat efficiently instead of instantiating one gameobject for every space in my tilemap

naive pawn
#

why do you need to instantiate a gameobject for every space

#

the nodes would just be Vector2Ints

limber turtle
#

ok can you send me an example of that

scarlet pasture
#

hey can i tell unity "Hey use the Rigidbody2D from the Player" without to say "u need to get the referenc from the Players Rigibody"?

#

thanks for any help

naive pawn
limber turtle
naive pawn
#

the access is already fine

#

the assignment is not

scarlet pasture
naive pawn
#

then assign the speed, not the body

#

did you read the error message

scarlet pasture
rocky canyon
#

whats it say?

fast relic
scarlet pasture
#

but i did somthing like that alot of time i just forget how, i did somthingf with vector.zero

naive pawn
#

you assign it to the thing you want to have that value

fast relic
#

you probably want to set its linearVelocity instead

naive pawn
#

read your code

scarlet pasture
#

YEAHHH

#

thank u

naive pawn
#

you're trying to assign the body a vector2

#

that doesn't make sense at all

scarlet pasture
naive pawn
#

you gotta put a little thought into it instead of just giving up every time you get an error

scarlet pasture
#

i only now setting the linearveloctiy to zero

scarlet pasture
frail hawk
#

is attachedRigidbody something or did you just type it

naive pawn
#

it's a prop of colliders

frail hawk
#

ok

frail hawk
#

must be new, never seen it before

naive pawn
#

it's not new, it's just.. relatively niche, i guess

#

"versions with this page" goes all the way back to the end of the list, 5.2

tired python
ivory bobcat
#

Should probably include a question if you're looking for help

tired python
#

the outline appears only when i crash

slender nymph
# tired python

you should show the entire UI builder so we can see the actual hierarchy of elements

tired python
slender nymph
#

oh god, i'm guessing you are abusing tf out of absolute positioning?

tired python
#

nice way to put it though abusing it

slender nymph
#

aligned it how

#

because that's probably what's causing this issue

tired python
slender nymph
#

yep, so because it's positioning is based on the things around it, it will only ever be positioned correctly with that setup when your other objects are being displayed as well

tired python
#

then why is score displaying?

slender nymph
#

you should consider looking through the documentation pinned in #🧰┃ui-toolkit to learn how to actually use it

slender nymph
tired python
#

so i need to place both of them in the same hierarchy level or smth

slender nymph
#

in fact, i can see in that channel that someone already told you what to do an hour ago and you did something different anyway

tired python
hexed terrace
#

You ask for clarification rather than assume.

scarlet pasture
#

hey, do u have a channel for posting game things for feedback

#

my enemy fells like shit and its not funny

#

like posing a short video

naive pawn
#

or if you have a specific issue you need help with, you can just ask in the appropriate channel

scarlet pasture
#

okay i will post there, i actually need some tipps

fickle plume
fossil swift
#

hey im trying to find a way to make an object go in the direction the cursor or joystick is facing using the new unity input system. Are there any tutorials?

slender nymph
#

which part are you stuck on? because the only difference between how it works with the new input system and the input manager which most tutorials teach is just how to get the mouse position, but even then it's still pretty similar

fickle plume
scarlet pasture
#

hey, i use for my Spider 5 Scripts, i need to Debug currently the way he is living, he AI better said. but, he hast Mutliply Attack Choices Like Spitting at the Player, or Bitting a the Player, He also hast a Survial wish to life, if he is low but currently this lays on him very week (under 5% to break out of his current Attack State) to run away from the Player. for Debug porpuse can i make a SINGELTON, that search in the Scene every GameObject maybe with the Tag "Spider" and make a list of "Scripts" he detect whitch hast a Specifall name like "SpiderBrain". and Disable them all and Enable them via Runtime, with a simple bool in the Inspektor?

#

i never did somthing like that but i think this would help me in the future ALOT

#

or are they simpler ways to achive that?

#

i dont want to make a bool for each Script that return the code if its fals, i maked my first enemy and my Code is Spagethi type shit

wintry quarry
scarlet pasture
#

DAYUMN

#

bro i try my best englisch skills i have

#

is my englisch really that bad

#

From AI

wintry quarry
#

You said "or are they simpler ways to achive that?"

But in your entire first paragraph I have no idea what the thing is that you are trying to achieve

scarlet pasture
#

Hey, I’m currently working on my spider AI. I use around 5 scripts (like Brain, Movement, Combat, etc.) and I need a way to debug how it behaves.

The spider can do multiple attacks — biting or spitting — and has a survival instinct (it should run away if its HP is too low). But right now, everything is kind of weak and spaghetti-coded since it’s my first real enemy.

For debugging, I was thinking: could I make a singleton that finds every spider in the scene (maybe with a tag like "Spider") and stores all their scripts (like SpiderBrain, SpiderCombatSystem, etc.) in a list — so I can enable/disable them all at runtime with a single bool in the inspector?

I’ve never done something like that, but I feel like it would help a lot in the future.

Or is there a simpler way to achieve this?

wintry quarry
scarlet pasture
#

i want to make, "Enemy dont move"

#

"dont do somthing"

#

"Dont Attack me if in near"

wintry quarry
#

Sure you could do that. But I wouldn't use tags necessarily.

#

Do you have some singleton that is spawning all the spiders int he first place?

#

That would be the best place from which to track all of them

scarlet pasture
timber tide
#

Ideally the manager system that creates the spiders would create the list and knows all about them, but if you wanted to have it such that each object is more independent, you would do a singleton with some subscription system that you would subscribe to on start

dry hawk
#

whats the best site that generate ai 3d models?

wintry quarry
wintry quarry
wintry quarry
#

no

scarlet pasture
#

and how can i leanrn that

wintry quarry
#

which thing?

dry hawk
wintry quarry
scarlet pasture
#

i mean i now how to search scripts, but how can i use code to say "Disable u self"

scarlet pasture
#

i now this, i ony want to now how i can disable them via Script

scarlet pasture
scarlet pasture
#

wow nice

#

do i need to code that, i actually saw this Box also

wintry quarry
#

if you want to do it in code you need to code it. If you want to just click that box, you are free to do so

scarlet pasture
#

its the same?, but i think im gona code that for learning

#

and if i do thatß? i dont need to make a Singelton?

#

i mean why should I?

wintry quarry
#

I thought you wanted one central place to do it from

#

If you manually are clicking the boxes in the inspector, you need to do it for all the spiders manually

#

(or select them all at once)

scarlet pasture
#

but i also should work with a normal MonoBeahvoir, i used this => FindObjectsByType for finding all active Scripts and maked trhem in a var Variabel. Than i used a "for" locig that enableas them all

#

Tanks for u Help!

cedar geode
#

can someone help me with this one i just dont understand why my script neverworks

slender nymph
#

!input

radiant voidBOT
# slender nymph !input
How to Set Input

To set Active Input Handling, go to:
Project Settings > Player > Active Input Handling

• Input Manager (Old): Use the original Input settings.
• Input System Package (New): Uses the new input system package.
• Both: Use both systems.

cedar geode
#

?im using both to what should i change i to ?

hot wadi
#

Just use one

slender nymph
cedar geode
#

what ?

naive pawn
#

do you mean you're using both systems in your code/project, or do you mean you have it set to "Both" already

scarlet pasture
cedar geode
#

butin the project settings tehn player i have set it both

#

yeah that

slender nymph
#

did you change it to both then prevent it from restarting the editor? because the restart is necessary

cedar geode
#

wait a sec ok ima trym that

#

yes!!!!!!!! thank you al so so so much

#

im like a begginer so thanks guys

scarlet pasture
#

hey is it normal to use a bool as a debounce, i have the feeling there are better ways to manage that the player dont revice more Damage as he should per collision, right now the player csn revice 2-3 times the Knockback and Damage in the Frames between

#

i want to understand some ways how to manage that, and are there better ways than bools?

rich adder
scarlet pasture
#

i want to get my code better, step by step

rich adder
#

for the most part, if its clear to you , and it works.. thats all it matters

scarlet pasture
#

so its dont harm me in the future

rich adder
#

bools are pretty efficient as a starting point. If they are working, no reason to touch them

scarlet pasture
#

okay, i understand what u mean. i will use Booliens, Thank u!

rich adder
#

remember the KISS principles still apply

scarlet pasture
#

Keep it simple...???

hot wadi
#

What is the last S?

naive pawn
#

"stupid"

#

as in, "Keep it simple, stupid"

vital barn
limber bolt
#

Keep it stupid, simple

scarlet pasture
#

i think i understand it...

regal isle
#

learn like you'll live forever

#

and live like you'll be replaced by Skynet tomorrow

#

then enslave Skynet and make it do the work for you

#

and don't take advice from pseudo-intellectuals

scarlet pasture
#

u mean me?

rich adder
#

@regal isle we can do without the spam of offtopic

regal isle
scarlet pasture
regal isle
scarlet pasture
#

thorfinn type shit

naive pawn
#

cool paradox bro

#

let's not have the spam here

rich adder
vital barn
#

Spam is Debug.Log in IJobParallelFor

rich adder
fallen mountain
#

Hi can anyone help me with my game because the joystick doesn't work anymore and I don't understand why and chatgpt couldn't help me 😅

naive pawn
fickle plume
rich adder
stray fog
fallen mountain
naive pawn
#

is it an on-screen joystick?

fallen mountain
#

yes

naive pawn
#

!code

radiant voidBOT
fallen mountain
#

okey

naive pawn
#

where are those logs from?

fallen mountain
#

i tested if i get an input from the joystick but i get always 0

naive pawn
#

right, but where

fallen mountain
#

in the PlayerController

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    [Header("Movement Settings")]
    public float moveSpeed = 2f;

    [Header("Joystick Reference")]
    public Joystick joystick;

    private Rigidbody2D rb;
    private Vector2 movement;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();

        // Auto-find joystick if not assigned
        if (joystick == null)
        {
            joystick = FindFirstObjectByType<Joystick>();
        }
    }

    void Update()
    {
        // Get input from joystick
        if (joystick != null)
        {
            movement = joystick.GetInputDirection();
            Debug.Log($"Joystick Input: {movement}"); // Add this line
        }
        else
        {
            movement = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
            Debug.Log($"Keyboard Input: {movement}"); // Add this line
        }
    }

    void FixedUpdate()
    {
        // Apply immediate velocity-based movement (no acceleration)
        if (movement.magnitude > 0.1f)
        {
            rb.linearVelocity = movement * moveSpeed; // Changed from rb.linearVelocity
        }
        else
        {
            // Stop immediately when no input
            rb.linearVelocity = Vector2.zero; // Changed from rb.linearVelocity
        }
    }
}
naive pawn
#

again, see the "large code blocks" section in the bot embed

fallen mountain
#
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class Joystick : MonoBehaviour, IDragHandler, IPointerDownHandler, IPointerUpHandler
{
    [Header("Joystick References")]
    public RectTransform joystickBackground;
    public RectTransform joystickHandle;

    [Header("Joystick Settings")]
    public float handleRange = 1f;

    private Vector2 inputVector = Vector2.zero;
    private Canvas canvas;
    private Camera cam;

    void Start()
    {
        canvas = GetComponentInParent<Canvas>();
        cam = canvas.worldCamera;

        // Center the handle initially
        joystickHandle.anchoredPosition = Vector2.zero;
    }

    public void OnDrag(PointerEventData eventData)
    {
        Vector2 position = RectTransformUtility.WorldToScreenPoint(cam, joystickBackground.position);
        Vector2 radius = joystickBackground.sizeDelta / 2;

        inputVector = (eventData.position - position) / (radius * canvas.scaleFactor);
        HandleInput(inputVector.magnitude, inputVector.normalized);
        joystickHandle.anchoredPosition = inputVector * radius * handleRange;
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        OnDrag(eventData);
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        inputVector = Vector2.zero;
        joystickHandle.anchoredPosition = Vector2.zero;
    }

    private void HandleInput(float magnitude, Vector2 normalised)
    {
        if (magnitude > 1)
            inputVector = normalised;
        else
            inputVector = normalised * magnitude;
    }

    // Public method to get joystick input
    public Vector2 GetInputDirection()
    {
        return new Vector2(inputVector.x, inputVector.y);
    }
}
naive pawn
# radiant void

again, see the "large code blocks" section in the bot embed

rich adder
hot wadi
#

I have a feeling this ain’t gonna be code-related

fallen mountain
rich adder
#

lol

fallen mountain
#

i dont understand how to send the code from the link

rich adder
#

paste code on the site, save send the generate Link

#

that site also allows you to have multiple tabs / files in 1 link

fallen mountain
tacit grove
#

I'm also sure that lastHit isn't null because Im debugging it and its equal to anything I look at

tacit grove
#

its at the top, its a script I can send

rich adder
#

I don't see it assigned anywhere

tacit grove
#

It's declared as private RayCasting rayCasting;

rich adder
#

private RayCasting rayCasting; ?

#

thats declaring it, where do you assign it ?

tacit grove
#

in another script

rich adder
#

not possible

naive pawn
#

well, that's not true.

rich adder
#

its like saying " I want a box of Apples" but putting nothing in the box

tacit grove
#

did I not reference the script properly?

naive pawn
#

you did not reference it at all

#

you have a variable that can hold a reference

#

but it's not holding anything yet

rich adder
#

it has no value right now

tacit grove
#

how do I assign the variable to a script then?

rich adder
#

= or the inspector

tacit grove
#

Do I have to call the class?

rich adder
#

computer : Okay you want a RayCasting to do stuff with
computer: Which RayCasting instance do you want ?

naive pawn
#

you can't call classes, that's not a thing you can do

tacit grove
#

Okay so would it be like private Script rayCasting = RayCasting;?

naive pawn
#

@fallen mountain have you debugged any of the methods inside Joystick to see if they're receiving events? are you perhaps missing an EventSystem or a raycaster?

naive pawn
#

you're only using 2 there, and your IDE should be telling you that

tacit grove
#

I just haven't refined the code yet and deleted unnecessary libraries or fixing my nested if statements

naive pawn
#

your list initialization also seems.. off

fallen mountain
scarlet pasture
#

 hey is this a correct way to play sounds in Unity

#

i did some research and saw this, does looks really strange. Why do we use "UnityEngine"?

rich adder
#

you already have using statement for it, you don't need to

#

hence why its grayed out

scarlet pasture
#

so i only can say Random.Range?

rich adder
#

yes

scarlet pasture
#

because im using "using UnityEngine"

#

i dont neeed to do that?

rich adder
#

right

#

it can help with sometimes ambiguity between UnityEngine.Random and System.Random
but thats easy to solve with adding using Random = UnityEngine.Random

scarlet pasture
#

ahhh its like i would say System.Collection.IEnumerator etc.

#

so its not necessery?

rich adder
#

no

scarlet pasture
#

thank u!

tacit grove
scarlet pasture
#

can sombody pls also expalain me why every time i try to use a Method like this it never actually worked

#

what exactlly do i wrong?

rich adder
rich adder
stable coral
#

Hi everyone, I am new to programming and was starting out my beginner console projects in VS code. I'm now using visual studio and notice that the color of my code is not the same as VS code. is there an extension or a setting I need to change to get the same effect? visually its appealing and helps me when looking at the code.

radiant voidBOT
rich adder
#

its not so much about the colors, yes thats a gauge usually but also when you type you should see Unity api stuff

scarlet pasture
#

excusy me nav, i just forget to add the Reference

#

why is it bad to make a fallback reference... i mean cant it not be that i dont no the Computer forget to use the References from Unity and dont find the Reference. i now u all tryd to expain that so me but i really need to understand that.

rich adder
rich adder
scarlet pasture
# rich adder what do you mean a fallback reference ?

like i used in awake a if(!abc) abd = get... etc, in Awake call to be sure unity dont have to 100% all references needed. i did that all the time but im not doing that, ´because alot of perople telled me thats not a nessery stepp i can use the Inspektor

rich adder
#

cases where its not possible for example, the object is a prefab and needs scene reference

#

but doing Awake () myThing = GetComponent<>(); is unecessary and there is a very tiny performance cost, so multiply that with many components over many objects and they add up

scarlet pasture
#

but why does awake call even exist?

#

what would need to be load so fast, faster than start call

rich adder
#

to setup objects usually

#

think of it as unitys component to a Constructor

#

You setup your values there, Awake run once, always (unless gameobject is disabled)
Start does not run if the Script itself is disabled (checkMark on the component only shows if you have Start, Update etc.)

#

for example You want to setup a singleton, You usually do that in Awake
so other scripts are ready to access it in their Start

#

if you did both on separate sripts Awake you will have Order of script cause a Null Reference, that objects Awake (singleton setup) may have not finished running before the other scipts tries to access it

scarlet pasture
#

AI

#

**“What if I reference everything in the first scene using the Inspector, but then I create a new scene — Unity will lose all those references, right? Let’s say I don’t have any fallback logic, so I’d have to manually set every reference again for each GameObject.

Would Unity actually save those references per scene? For example, if I build my game, does Unity understand that in the first scene, Field A is referencing the Player, but in the second scene, that same field should only reference a Transform instead of the Player?”**

rich adder
#

Inspector references are saved per scene not globally

scarlet pasture
#

so unity also never new about the Player from scene 1

#

okay i understand what u mean

rich adder
#

when you load a new scene, scene object references are lost unless you handle them manually
If you want persistent references across scenes use DontDestroyOnLoad.

scarlet pasture
#

when i change the scene? and unity losses all of the references? did this mean unity deletet them all of the memory?

rich adder
#

everything from scene1 will be deleted unless its carried over DDOL

#

memory clears

scarlet pasture
#

so how can unity then switch from scene 1 to 2 and than back to 1 again

rich adder
#

it creates a " new scene "

#

settings from scene 1 will not carry over to scene2 and when you switch back to scene1

#

as far as unity is concerned you are starting them brand new again

#

unless we implement data persistance / DDOL objects

scarlet pasture
#

okay nice, i understand everhting alittle better

#

tank u nav!

rich adder
rich adder
scarlet pasture
#

thanks u bro

tired python
#

I am trying to use the collision sound when player crashes. I can't seem to be able to get it right.

radiant voidBOT
tired python
rich adder
#

you knnow you can like bookmark the link so you don't have to always invoke the bot command

#

FindGameObjectsWithTag

scarlet pasture
#

hahaah i make this same alot of the time

tired python
#

FindGameObjectsWithTag

scarlet pasture
#

no s

tired python
#

O_O

scarlet pasture
#

only FindGameObjectWithTag

#

HAHAHAA

tired python
#

ahh shoot me

scarlet pasture
#

i also make that too

tired python
#

pls

rich adder
#

btw you can search directly for a component if only 1 exists

#

skips the GetComponent / tag search

tired python
#

how right am i to say that this game is structured in an absolutely dog way?

rich adder
#

I mean first projects are always gonna be like that

scarlet pasture
#

i feel u pain

tired python
#

this is a pain in the neck

rich adder
#

that is a major reason why most first projects are meant more for learning than production ready

tired python
#

i will need to theory the shii out of that book for solids after this is over

rich adder
#

SOLID are good concepts but they are not Law

#

you can break SOLID and still write good clean code

tired python
#

i mean yeah, but that's a good baseline for me. Do you think there's an optimal way to study architecutre?

#

or is it just experience?

rich adder
#

imo practical uses

#

yes it comes with experience, you eventually create your own system based on those that have worked in the past such as SOLID

tired python
#

O_o

rich adder
#

but understanding WHY you would even use anything in SOLID and alike, imo is much more important

#

You will not see a benefit if you start writing SOLID out the gate, it will not make sense

tired python
#

so everyone has a personal template they follow? how do people even begin collaborating then?

rich adder
#

they establish a baseline / specific to the project and Team

tired python
#

oh...so its more standardised

rich adder
#

yea, consistency is the real importance

#

even as basic as "lets write our variables with the C# standard" eg everyone writes Methods as PascalCasing etc.

#

so if you personally use camelCasing for everything, thats for your own consistency as solo. But in a team everyone conforms to the same standards

swift bane
#

Can you help me on how to make a first person player with 3D capsule in Unity 6.2? The input system confused me a bit. While people were saying that it needed to be activated, I did not see the activation part in the tutorials.

rich adder
scarlet pasture
#

hey, have this dc a "Connect" channel, for finding somone for a game. I want somone thats want to draw for me.

rich adder
#

on the forum

#

!collab

radiant voidBOT
# rich adder !collab

: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**

scarlet pasture
#

Thank u!!

rain solar
#

is triplanar UV calculation suppose to be glitchy?

public static float[] CalculateTriplanarUVs(Vector3 position, Vector3 normal) {
    Vector3 absN = new Vector3(Math.Abs(normal.x), Math.Abs(normal.y), Math.Abs(normal.z));
    if (absN.x > absN.y && absN.x > absN.z) {
        return new float[] { position.y, position.z };
    } else if (absN.y > absN.z) {
        return new float[] { position.x, position.z };
    } else {
        return new float[] { position.x, position.y };
    }
}
cosmic dagger
scarlet pasture
cosmic dagger
rain solar
shell sorrel
#

where you would do it with 3 texture samples and blend between then with your normal and mapping directions dot product

rain solar
shell sorrel
#

well what are you trying to do, but in my experience triplanner mapping is something you will be doing in the shader so you can blend things

#

and also so you do not have to worry about a meshes uv's since its most often applied in world space coords not object or uv

rain solar
#

im trying to get UVS to apply a texture

rocky canyon
rain solar
rocky canyon
#

2.3 Blending Based on Normal

shell sorrel
#

yeah 3 texture samples on the 3 different planes

#

blend by doting a normal with one of those plane normals

rocky canyon
#

im just barely holding on 🤣 catlikecoding is boss-level material for me.. i don't get into shaders that much

#

basically what my clip up top shows the back cube doing 👇

rain solar
#

i have to write shader code for this 😭

shell sorrel
#

its simple to do in shader graph as well

rocky canyon
#

^ i think they even have an awesome Mapping node that takes care of alot of it for you

shell sorrel
#

has a node for it, even if not, its just 3 texture samples 2 dots and 2 lerps

rain solar
#

i dont think its just a blending issue cause look at these weird spots

rocky canyon
rocky canyon
shell sorrel
rocky canyon
#

i'd say try shader or shadergraph first ^ before beating urself up anymore

rain solar
rocky canyon
#

just to see what the outcome would be

shell sorrel
#

it does work and look better with more organic looking things

shell sorrel
rain solar
#

i thought UVS were texture coordinates

shell sorrel
#

the terms get fuzzy, often wehn people here uv's they think of the uv data on a mesh

#

the input on texture sample is also called uv but also you can feed other stuff into it like world coords

rain solar
#

so what data besides UVs would i be passing to the shader for the texture to latch onto

shell sorrel
#

you do not need them for triplanner

rocky canyon
#

with triplanar mapping you can basically generate them on the fly in teh shader instead of relying on any of the mesh's uv

shell sorrel
#

the shader will calculate its own texture coords via world coords

rocky canyon
#

every point in space gets a valid texxture coordinate automatically

rain solar
#

so its the exact same thing as what im doing now but happening in the shader

#

i dont see how that fixes it

shell sorrel
#

because it can blend

rocky canyon
#

b/c they spend tons of resources making it work as good as it does..

shell sorrel
#

its doing 3 texture samples and blenidng the result

rain solar
#

but i could also blend in my cpu code right?

shell sorrel
#

but why would you

#

this is literally what shaders are for

rocky canyon
#

reinvents the wheel lol

rain solar
#

cause i dont know shader language, i dont know how shaders work, i dont know what to put the shader on, and i dont want to define a fully custom material render pipeline node

shell sorrel
#

we showed its literally a node

#

you can do it in shader graph with 1 node

#

to do this all cpu you would be rendering textures

rain solar
#

i can compute the UVs with blending

#

and let default pipeline take care of it

shell sorrel
#

and it would be much more complicted then doing it in shader

sour fulcrum
rocky canyon
shell sorrel
#

you would just not computing blended coords not sampling 3 things and blenidng the resulting color

#

those are very different things

rain solar
#

mk lemme try this

shell sorrel
#

shader graph is nothing like doing shaders by hand, its more or less just acting as input to a more complicated shader

rocky canyon
#

TL;DR: generating UVs is trivial; proper triplanar mapping requires per-pixel texture sampling and blending, which is why shaders are used.

shell sorrel
#

it is meant to be useable even by just artists

rocky canyon
#

you should really just learn and dabble in shader-graph regardless

#

opens up a whole ton of possibilities for you

#

ur over there re-inventing the wheel..
while shader-graph is 🎵 ridin' spinners.. lol.. just kidden ofc.. but yea it is a pretty awesome tool-set

rain solar
shell sorrel
#

its currently clamped

rain solar
#

upping the scale factor makes it less grey. Thank you! ❤️

shell sorrel
#

yeah has 2 blending modes too and a few other options

rocky canyon
rain solar
#

can triplanar just not do sharp edges?
i had to use a pow(64) scale factor

shell sorrel
#

i feel you are aksing for a impossible thing

#

like if you want things mapped in a 100% perfect to the shape way you have to do that in a 3d pacakge by hand

#

since triplanner its in the name its making 3 projections and blending them togeather

#

it works best on organic textures or things with more noise in them

rain solar
#

what would you use for sharp objects?

#

not that i have sharp objects, im just curious

shell sorrel
#

well first i would need to know why you are doing this and its usecase

rain solar
#

procedural meshes

rocky canyon
#

welp, that rules out what i was typing..

shell sorrel
#

and generated how?

#

and for what purpose

rain solar
#

manifold dual contouring

#

minecraft without blocks

shell sorrel
#

yeah i would likly stick with the triplanner then for that

#

for other types of procedural meshes i would just make appriorate uv's when i generate the mesh

rocky canyon
#

you'll probably just need to find a happy medium

#

this manifold contouring stuff looks wild lol

shell sorrel
#

pros and cons of it all, have to find the best balance for the usecase then make the art work with the used approach

rain solar
#

can triplanar sample from a texture atlas or does it need to use the same texture for the whole mesh

rocky canyon
#

Abstract—Dual Contouring is a feature-preserving iso-surfacing method that extracts crack-free surfaces from both uniform and adaptive octree grids.
🫠 melted my brain there for a second lol

daring obsidian
#

sorry I'm like really new, but I have the foundation for C# but I'm really lost for actual unity scripting, whats the best way to learn?

rocky canyon
#

check the pins

rain solar
shell sorrel
daring obsidian
#

tysm

shell sorrel
rocky canyon
#

unity learn is the most common answer.. u can find that in the pinned section ^

shell sorrel
#

and that knowing other approaches like ray marching would help reason about it

rocky canyon
#

just start with one of the pathways

regal geyser
#

do my maze generator looking good? using recursive backtracking algorithm

wintry quarry
#

I don't see an exit though

slate summit
#

same

rain solar
cosmic dagger
#

or do they start in the middle?

slate summit
#

my sphere falls through the ground did i do something wrong?

rain solar
#

does the ground have a collider

slate summit
#

yeah

wintry quarry
#

so yeah

cosmic dagger
#

it's a trigger . . .

slate summit
#

oh trigger causes that?

#

why though

wintry quarry
#

trigger makes it non physical

#

triggers are just there to trigger code

shell sorrel
#

its the point of triggers is they do not collide

regal geyser
wintry quarry
#

I would expect one entrance, one exit

regal geyser
rain solar
#

idk if its the best but its a really cool algorithm and beats recursion

regal geyser
regal geyser