#💻┃code-beginner

1 messages · Page 320 of 1

queen adder
#

but now its saying "cannot assign move position because it is a method group"

deft grail
#

👆

queen adder
#

ooo

#

rb.MovePosition(respawnPoint.transform.position);

#

is that right?

deft grail
queen adder
#

looks good so far!

#

damn. i think it works

steady helm
#

Hey! Is anyone able to help me with an issue I'm encountering?

My script works; however, it's doing something I don't want it to do. I've created a script that uses OnTriggerEnter to detect collisions with any mesh. It's supposed to check the material of the mesh and play an audio clip from an audio source. The audio clip should be different for each material. However, the problem I'm facing arises from my meshes having multiple materials. When I tap a mesh with multiple materials, instead of my script playing the audio clip set for the material "Tiles", it plays the material that's located at the top of the MeshRenderer's Materials list. I don't quite understand why it's doing this, and I'm also not sure how to fix this issue. If anyone can help me with this, I would greatly appreciate it.

Basically if thats too much to read (i yap too much) my script needs to check what material its touching correctly to play an audio clip based on that material but im having issues getting it to detect what material its touching... cus im not good at coding lol.

summer stump
#

But to answer your actual question, I don't know how to do that, sorry

steady helm
#

😭

steady helm
hardy maple
steady helm
#

i just remembered my friends unity project uses what im looking for 😏

slow pecan
#

can enyone help me with my code

deft grail
slow pecan
#

im trying to make it so it teleports you to the next scene

summer stump
deft grail
#

and whats the actual problem

summer stump
#

And any errors or bugs

slow pecan
# summer stump Show the code

what is wrong with my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.sceneManagement;

public class NewBehaviourScript : MonoBehaviour

{
void onTriggerEnter(Collider other)

{
sceneManager.LoadScene(1);
}

}

deft grail
#

whats wrong with that

slow pecan
summer stump
#

Ah. See what gr4ss said

deft grail
#

and whats wrong with using UnityEngine.sceneManagement;

hardy maple
slow pecan
rocky canyon
#

!ide ?

eternal falconBOT
deft grail
#

and sceneManager.LoadScene(1)

summer stump
#

Lots wrong here. Definitely configure your ide. Also keep in mind that c# is case sensitive

#

Also, loading scene 1 would be the second scene (just to be clear)

hardy maple
#

also, this syntax error will definitely show up in the console

summer stump
slow pecan
#

ok ill try and fix it

deft grail
eternal falconBOT
deft grail
#

otherwise just fix the errors you have and encounter the same problem 100 times

slow pecan
#

ok thank you

dusk minnow
#

I am fairly new to Unity I am taking C# classes rn and am trying to make a game, I followed taroDevs tutorial on a trajectory line and tried to tweak it to suit my golf game, however it needs optimization and I was wondering if anyone had any tips on how to optimize it

#

If I could send my project to have someone check it out that would be great I want to make sure I am structuring my project well.

deft grail
#

however people can look at your code

acoustic arch
#

anyone got tips for programming an enemy battle ai? for a card battling game etc

#

using abilities

hardy maple
acoustic arch
#

each card has 3 abilities to choose from in battle, and can swap between cards

timber tide
#

well, depends how complicated you're making it but if you wanted to just make it pure rng

hardy maple
#

It's hard to give "Quick Tips" on AI approaches. I would probably use a filter based approach as that would give you the ability to configure different AI Players, but there's lots of ways to do it, and it's all VERY dependent on the granular details of your game.

acoustic arch
#

like how in pokemon games some trainers are less smart than others

acoustic arch
timber tide
#

I can image pokemon AI pretty straight forward

acoustic arch
timber tide
#

use best move, or throw the die

acoustic arch
#

that'll likely be how my battle works but different style of battling

#

the battling is like the game Teeny Titans that is on mobile from the cartoon shows

#

but cards instead and other mechanics

steady helm
teal viper
#

He should've put the code in bank if he didn't want it to get stolen.

steady helm
teal viper
#

Well, then he shouldn't complain about it being stolen.

steady helm
#

ong!

supple needle
#

My game can only manage upto 20 FPS? Can anyone tell me why?

steady helm
# supple needle My game can only manage upto 20 FPS? Can anyone tell me why?

u mean it depends on how your game is made sometimes a game may lag cus its in the unity editor and not a build.
but you could try using occlusion culling, Render distances,

you can use the built in Unity profile to find bottle necks to see what in the game causes lag.
you can try compressing your textures, the polygon count of your models can cause lag you can try reducing them
you can try Batch Rendering
and static batching

#

idk theres alot you can do but its hard to just determent the issue thats causing you lag.
It's hard to know you will have to run some tests most likely

supple needle
#

So the number of trigs and verts arent abnormal right? This is all new to me so

#

Ok thanks! I'll see what i can do

steady helm
summer stump
summer stump
teal viper
#

You have a crazy amount of batches. And looking at the profiler graph, rendering seems to be taking quite a while.

#

The editor is taking a lot as well, though.

hardy maple
# supple needle Im seeing this

The verts and tris may or may not be a problem depending on what hardware you're targetting. I'm guessing your issue is the crazy number of batches and setpass calls.

#

I think you need to mark pretty much your whole scene "Static" and then use Baked GI

supple needle
#

Static huh, ok will look into it

supple needle
lofty dome
#

i have just begun using unity and i am having a hard time figuring out how to open this door via animation

grizzled fulcrum
#

I've been having a little issue with some box stuff. I made the code so that my character may not jump if he's holding the box, with the SetHoldingBox value. But for some reason, even when he's just standing right next to the box (That has two Box Collision 2Ds for both hitbox and for pulling the box), the character is not allowed to jump, even if he is not grabbing the box. Any clues on how I could fix this?

maiden parcel
#

hey can anyone help me with a code?

#

im doing a school proyect and my code doesnt work, basicly i need unity to get a int information from one scene to another, but it isnt working

green ether
#

Theres alot of ways to do that

#

What exactly do you need?

maiden parcel
#

im doing with GetInt

maiden parcel
green ether
#

Static Variables/ Static class
Or a singleton
is what I would do, depending on what fits your need, but im no expert by any means

nimble apex
#
  public int m_iTableID
  {
    get
    {
      return tableid;
    }
    set
    {
      tableid = value;
      this.gameObject.name = value.ToString();
    }
  }```
will this property by itself have big problems? because i just found out a stack overflow error that blows up the whole editor
maiden parcel
green ether
#

Sure, post it here

gaunt ice
#

i dont see thing thats causing stack overflow

maiden parcel
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System;

public class GetValue : MonoBehaviour

{
 string Puntuacion = "Puntuacion";
 public int CurrentScore { get; set; }
 public void Awake ()
  {
    CurrentScore = PlayerPrefs.GetInt(Puntuacion);
  }
  public void SetScore(int score)
  {
    PlayerPrefs.SetInt(Puntuacion, score);
  }
}```
#

Thats for getting the information

green ether
#

put the code in three `

#

3 before and 3 after

#

and add c# after the first three `

#

for proper formatting

#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System;

public class GetValue : MonoBehaviour

{
 string Puntuacion = "Puntuacion";
 public int CurrentScore { get; set; }
 public void Awake ()
  {
    CurrentScore = PlayerPrefs.GetInt(Puntuacion);
  }
  public void SetScore(int score)
  {
    PlayerPrefs.SetInt(Puntuacion, score);
  }
}
maiden parcel
#

and i got this for getting information

using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class Score : MonoBehaviour
{
    public TextMeshProUGUI textMesh;

    void Start()
    {
        if (PlayerPrefs.HasKey("Puntuacion"))
        {
            int GetValue = PlayerPrefs.GetInt("Puntuacion");

        }
        
    }
}
nimble apex
#

i dont even know why tho

#

after i commented it out everything works perfectly fine

#

"this" made the overflow

#

its really about that keyword itself

green ether
#

Is that what your problem is?

#

I wouldnt use playerprefs for a score though

#

Just a static class I guess

gaunt ice
#

i dont believe the this pointer can cause stack overflow but let me try

maiden parcel
nimble apex
green ether
#

Dont really know, I dont use playerPrefs so I cant tell you if its better or worse

#

But what exactly is the problem/ why is it not working?

maiden parcel
#

the text in gameover screen its not changing

#

its not getting the information

green ether
#
public void SetScore(int score)
  {
    PlayerPrefs.SetInt(Puntuacion, score);
    CurrentScore = score;
  }
#

Add this line to Setscore

maiden parcel
#

the code doesnt print any error, but when player dies, the puntuation in gameover screen stays in 0

green ether
#

yeah because you never update CurrentScore

#

you only get it once in Awake() right?

maiden parcel
gaunt ice
#

no stack overflow

green ether
#

But you dont need the whole playerPrefs I think

maiden parcel
green ether
#
public static class Score
{
 private static int _currentScore;

 public static void SetScore(int score)
 {
    CurrentScore = score;
 }
 public static int GetScore()
 {
    return CurrentScore;
 }
}
#

I wouldve probably done something like this

Im not at home so not sure if the syntax is correct

maiden parcel
gaunt ice
#

run successfully

maiden parcel
green ether
#

i think it would be easier

#
public class Score : MonoBehaviour
{
    public TextMeshProUGUI textMesh;

    void Start()
    {
        if (PlayerPrefs.HasKey("Puntuacion"))
        {
            int GetValue = PlayerPrefs.GetInt("Puntuacion");

        }
        
    }
}

What is this even supposed to do?

#

it doesnt do anything rightnow

nimble apex
maiden parcel
#

i should get the other code information for showing it in the other screen

green ether
#
public class Score : MonoBehaviour
{
    public TextMeshProUGUI textMesh;

    public int GetScore()
    {
        if (PlayerPrefs.HasKey("Puntuacion"))
        {
            return PlayerPrefs.GetInt("Puntuacion");
        } 
    }
}

This at least does something

#

Now GetScore() returns the score

#

but the static class I posted makes more sense than splitting it in 2 classes

gaunt ice
maiden parcel
nimble apex
#

mainly like this

#

definitely not about backup field tho

#

yoooooo its backup fields

#

aight problem solved thx lol

maiden parcel
green ether
#
public class Score : MonoBehaviour
{
    public TextMeshProUGUI textMesh;

    public int GetScore()
    {
        if (PlayerPrefs.HasKey("Puntuacion"))
        {
            return PlayerPrefs.GetInt("Puntuacion");
        } 
        else
        // Return whatever you want if the Key "Puntuacion" doesnt exist
        { return 0; }
    }
}
#

add the else

#

If no key exists it still needs to return something

maiden parcel
#

im trying it

#

the puntuation still not changing staying at 0

green ether
#
public static class Score
{
    private static int _currentScore;

    public static void SetScore(int score)
    {
        _currentScore = score;
    }

    public static int GetScore()
    {
        return _currentScore;
    }
}
#

I would just do this

#

its much simpler and less error points, unless you absolutely need to use PlayerPrefs

maiden parcel
#

its not necesary player perfs jaja

green ether
#

try this static class then

#

it should work already like this

#

you can add an extra method like

maiden parcel
#

that should go to the code whos need to get the information, no?

green ether
#
public static void AddScore(int score)
{
  _curentScore += score;
}
#

to add score instead of setting it

green ether
#

create a new file

#

Name it whatever you want

#

Score or something

#

ScoreHandler

#

if score is already taken

#

something like that

#

Remove the monobehaviour

#

make it static

#

Then you can use it from all scenes

maiden parcel
#

ooooooh

#

ok

green ether
#

It doesnt need to be attached to any gameObject

#

it cant actually

#

and then you can do ScoreHandler.GetScore() or ScoreHandler.SetScore() from anywhere

maiden parcel
#

i gotta leave, im gonna try later

#

thanks for all

#

sorry for inconvinience

polar grail
#

hey guys im trying to instantiate a prefab by using Resources.Load but it's giving me "The object you want to instantiate is null"

polar grail
#

GameObject bulletInstance = Instantiate(Resources.Load("/Assets/prefabs/projectile"), firePos.transform.position, Quaternion.Euler(0, 0, AngleDeg - 45f)) as GameObject;

hardy maple
#

To use Resources.Load. the prefab must be in the Resources folder

polar grail
#

oooohhh

#

works now thank you!

hardy maple
# polar grail oooohhh

You should consider why you are using Resources.Load. There are certainly good reasons for it. But if you don't already have a Resources folder, it may be better not to use it.

polar grail
#

I have my reasons

west sonnet
#

How can I immediately stop a gameobject from moving? I tried doing Rigidbody.velocity = Vector3.zero; but the object still slides a little before stopping

west sonnet
#

I'm guessing that changes it from Dynamic or Kinematic?

#

and would I still need to change the velocity to zero?

languid spire
#

no, once it's kinematic it removes it from any physics calculations

west sonnet
#

I should specify that the object is actually the player, but when a trigger is enabled, the players movement script is disabled and the velocity set to zero

#

and now IsKinematic set to true

tawdry quest
polar grail
#

whats wrong with it

green ether
#

And I havent had a reason to use it yet anyways

tawdry quest
#

If you want to spawn different prefabs its better to do public Prefab myPrefabBullet public Prefab myOtherPrefab and attach the prefab in the editor

polar grail
#

the thing is, i dont want to attach it in the editor

tawdry quest
#

The thing is Resouce.Load takes about 10-15x the amount of time and you load it from disk every time you instanciate

polar grail
#

oh

#

😢

green ether
#

2nd: You have to refer to everything in there by string which is prone to error

tawdry quest
#

Yeah attaching the script to a gamemanager and then dropping the prefabs onto the fields in the Inspector is way better

green ether
#

3rd: I think the whole resources folder is packages in the build no matter if you use it or not and fully loaded into memory

#

which is bad if its alot

#

If you absolutely have to use it, dont use Resources.Load over and over again, cache it on startup or something

fringe plover
#

!code

eternal falconBOT
tawdry quest
green ether
#

But then I learned and knew better xD

polar grail
#

is there other ways

tawdry quest
polar grail
#

to instantiate my prefab without having to assign it

green ether
#

I cant imagine having so many prefabs that you cant just assign them

tawdry quest
#

Explain why and if it makes sense i explain how

green ether
#

You shouldnt have so many that its too much work

#

if you do you are probably doing something wrong and should design your prefabs in a different/ better way

polar grail
#

i guess so

burnt vapor
#

Considering it was all inlined here I doubt it was needed

tawdry quest
#

I have one PrefabManager that has my PrefabManager script that has like 200 prefabs attached

#

Lol

burnt vapor
#

But if this is some common prefab then they should just load it beforehand

polar grail
#

i guess i have to do that then

burnt vapor
#

Also nice for loading things like JSON by the way, it definitely has its uses

tawdry quest
#

Not with Resouces

timber tide
#

cant stop me from using it :)

burnt vapor
#

That's why I mention common prefabs

tawdry quest
burnt vapor
#

It's very nice to just Load some prefab that is used literally everywhere, and there is no shared instance possible

tawdry quest
#

But we can advise against bad decisions

burnt vapor
#

And even if it's 10x slower that whatever you specify, doing it just once doesn't make your app unplayable and choppy lol

timber tide
#

im not making the next skyrim yo

tawdry quest
burnt vapor
#

There's definitely room for a better alternative with things, and I assume with the inlined code it's the same case, but this method definitely has use cases so it should not be shot down because it's super slow

burnt vapor
languid spire
tawdry quest
#

You should just not use Resouces.Load unless you really need it. As the other options are way more performant and dont require string literals (references by string)

tawdry quest
languid spire
#

no it is not

tawdry quest
#

As it loads from disk by string search

#

Uh yeah it is ?

polar grail
#

uh oh!

tawdry quest
#

Its known that Resources.Load is worlds slower then loading by Script Reference

#

Could even spin up a benchmark if i was home to tell you exactly how much slower

#

Last time i saw someone talk about it it was about 10x slower

green ether
#

There is just no need for it

tawdry quest
#

Sure if you only load it here and there its not that bad, but then you also have the string references, which is also abysmal

green ether
#

Pretty sure the official docs say to avoid it aswell

tawdry quest
languid spire
#

you will find no one more anti string than me but, if I have 200+ prefabs and I only want to load 1 of them you can be damn sure I will use Resources.Load and I will be faster and more efficient than loading all 200+ in one go

eternal needle
#

I wouldnt say a prefab manager with 200 references is much better. And calling a game unplayable and choppy because it uses resources is silly

tawdry quest
#

Then you only reference that one on the script

#

Where in the world is Resources.Load better there

#

My example with the 200 prefabs is cuz i need them all at runtime as its a shooter and every player could have a different prefab as player, outfit or gun, so i need them loaded at all times.

languid spire
#

you are saying that is is better to have a script that prereferences all of the 200 prefabs rather than use Resources.Load to access 1 of them

tawdry quest
#

I said doing 200 references is way better then 200 Resouces.Load

tawdry quest
languid spire
timber tide
#

I don't use resource folder cause it's better, I use it cause im lazy

tawdry quest
#

Now please stop talking about it, im out.

timber tide
#

if I was making games composed of hundreds of these high res 8k textures I'd probably build some decent bundles

tawdry quest
#

Use it if you want to. We explained enough why it bad.

timber tide
#

but I can't be bothered with the asset browser at times haha

eternal needle
#

You can explain why it is bad, but please do not suggest a prefab manager as an alternative when you have 200 stored in there.

#

There is literally no reason for such a script to exist

tawdry quest
eternal needle
#

Ok by that same logic then there is a reason for resources to exist. Both reasons may be shitty though.

tawdry quest
#

Resouces.Load would be fatally slower in the case of my script, that was the example for the speed.

Both of you just go in read half and then try to comment on it...

Use it if you want, im not here to try to defend why its better, if you dont believe me, then feel free to use it UnityChanThumbsUp

#

Are we done ? Good then i go back to work on my Multiplayer thats haunting me since days.

green ether
#

I mean, i also never needed a prefabmanager with 200 prefabs

#

That seems like alot

#

Whats the difference between all these prefabs?

tawdry quest
#

I can look into a better way, but for now i have no other way i can think of how i can have the player have them all loaded, so if they encounter a player with that equipped that they see them correctly.

eternal needle
tawdry quest
languid spire
tawdry quest
#

Completly normal

green ether
timber tide
#

prefabs are just pennies in terms of mem, it's the textures and audio that you'd want to be loading and deloading.

tawdry quest
# green ether No

Yes it is, go start fortnite, valorant or splatoon and tell me how many different clothes and guns you find that people could have equipped

green ether
tawdry quest
#

Not just skins

green ether
#

My game is multiplayer with alot of different equipables/ races/ etc and i only have one player prefab

#

On there is a script that Syncs the IDs of each equipment between players

tawdry quest
green ether
#

not for me

tawdry quest
#

How do you spawn them then, directly the model ?

timber tide
#

and the models too, yeah. But you can always manage a lot of the loading on the fly instead all at once

green ether
#

I have one basic weapon GameObject inside of my player

#

I change model/ textue depending on the Id of that equipment/ weapon

tawdry quest
#

Thats why im preloading them, and prefabs so they have their animation scrips and other stuff already attached

timber tide
#

I mean you load async it shouldnt be a problem

green ether
#

Same with the player, instead of switching out prefabs i just switch the visuals depending on selected gear/ race

#

On the same prefab

#

And all players perfectly see what everyone else has equipped

teal viper
#

You don't want your whole game assets loaded at the same time. That's a recipe for disaster.

tawdry quest
#

That looks bad too

timber tide
#

well, for one I wouldn't load exactly when encountering that object

teal viper
green ether
#

ah ok

timber tide
#

I'd be a bit smarter on your loading manager and have some idea of when and where to start loading your assets, even outside of a loading zone

tawdry quest
#

But you do made me think about my approach with the 200 prefabs, maybe when the people are loading into the new server they get told what different objects are in the round and then they load that

#

Before the game starts

eternal needle
tawdry quest
tawdry quest
#

Load what the server says can appear ingame

#

But then i have to use Resouces.Load and thats kinda slow, but again when you are in the loading screens who cares about the 50-100ms more

#

What i dont know how to is that the main menu i wanted to do like fortnite where people could just join, then i would need to load the stuff while they are already appearing

green ether
#

But does that make a difference?

#

All things in resources are loaded into memory on startup anyways no?

#

Regardless of theyre ever actually used

#

Thats why its not recommended

tawdry quest
green ether
#

I didnt check my usage ever, but my game is very simple so i doubt ist uses alot

green ether
tawdry quest
#

So i should be good like rn and i dont have to load them when they are needed

tawdry quest
#

Once they are loaded into memory it stays the same

green ether
#

yeah thats what Im saying

#

So there is no point for Resources.Load

tawdry quest
#

But loading them is prolly more intense on Resouces.Load

green ether
#

yes, and you have stringreferences

tawdry quest
#

Cuz you do string searches for files and then load them different

#

Didnt i say i wanted to leave and suffer with networking

green ether
#

What are you using for networking?

tawdry quest
#

@eternal needle @timber tide thanks for the headsup about the 200 prefabs, i will look into if its better to load them async when needed or all at once at start

tawdry quest
green ether
#

Ah okok

#

Im using mirror

#

Whats causing more problems is steam and the horrendous documentation for alot of things on steamworks

tawdry quest
#

I found mirror horrendously bad to understand / use and while looking i found fishnet

#

So far really easy and it comes with neat stuff predone

green ether
#

Took a while but I understand alot now

#

The devs are very helpful in their discord and the docs are not bad

#

Also alot of examples etc there

tawdry quest
#

I like that i dont have to do clientside prediction or lag compensation, that comes with FN

#

The lag thing only with Pro tho

#

Anyways i go back to suffering how to do scene stacking properly

near wadi
#

!code

eternal falconBOT
kindred halo
#

Is there any way to detect If an object has been activated
not talking about checking if it's active or not
I want to trigger an animation only when the object is activated

gaunt ice
#

on enable

near wadi
#

I am trying to get this to watch for *.uxml also, but i have not found the proper syntax to do that.

watcher = new FileSystemWatcher(dataPath, "*.cs")
//I have tried 
watcher = new FileSystemWatcher(dataPath, "*.cs | *.uxml")
//and also 
watcher = new FileSystemWatcher(dataPath, "*.cs; *.uxml")

i have even tried making a new watcher, but nothing i do seems to make things work. It Does work if i use *.cs or *.uxml independently though, so the surrounding code is doing its job
IDK why the hell the code blocks do not want to work for me, and i am done trying.

kindred halo
gaunt ice
#

what object?

kindred halo
#

I mean

actions.gun.OnEnable.SetTrigger("WeaponSwitch");```
It's not possible
kindred halo
#

I know
but I need it to be that way I showed above
As it's done in another gameobject's script

languid spire
gaunt ice
#

then when another object is activated, call back to the object

languid spire
near wadi
languid spire
#
 string path = Path.Combine(project.path, "Assets");
            watcher = new FileSystemWatcher(path);

            watcher.InternalBufferSize = 32768; // 16384;

            watcher.NotifyFilter = 0 //NotifyFilters.Attributes
                                             //| NotifyFilters.CreationTime
                                             | NotifyFilters.DirectoryName
                                             | NotifyFilters.FileName
                                             //| NotifyFilters.LastAccess
                                             | NotifyFilters.LastWrite;
            // | NotifyFilters.Security
            // | NotifyFilters.Size;

            watcher.Changed += OnChanged;
            watcher.Created += OnCreated;
            watcher.Deleted += OnDeleted;
            watcher.Renamed += OnRenamed;
            watcher.Error += OnError;

            watcher.Filter = "*.*";
            watcher.IncludeSubdirectories = true;
            watcher.EnableRaisingEvents = true;

near wadi
#

I'll give it a shot and see how it goes. Thanks

quartz igloo
#

Hey guys, I'm trying to make movement for my rigidbody2D (the player) with inputs. I followed a guide on Youtube, but his script doesn't work at all for me

#

Here's the script:

using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public Rigidbody2D body;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        float xInput = Input.GetAxis("Horizontal")
        float yInput = Input.GetAxis("Vertical")
        body.velocity = new Vector2(xInput, yInput);
    }
}```
near wadi
#

@languid spire Ok, for some reason i thought it was going to get strange on me when i made new assets, or created a new thing in the hierarchy, but that seems to be fine. Thanks again

green ether
#

surely
cause you are missing some semicolons

quartz igloo
quartz igloo
#

I will try now

languid spire
green ether
#

if it still doesnt work, my next 2 guesses from what the first error was will be that

  • The script is not on the gameobject at all
  • the rb is not assigned
quartz igloo
#

It send me an error when I hit play:
UnassignedReferenceException: The variable body of PlayerMovement has not been assigned.
You probably need to assign the body variable of the PlayerMovement script in the inspector.
UnityEngine.Rigidbody2D.set_velocity (UnityEngine.Vector2 value) (at <39c25c7743074133aa8a65861b64bb60>:0)
PlayerMovement.Update () (at Assets/PlayerMovement.cs:19)

green ether
#

lol

green ether
#

But this is really basic stuff, you should probably go back to some basic programming tutorial in general to understand the basic principles and what the errors mean/how to use use/read them

quartz igloo
#

I guess I should

green ether
#

almost

#

Plain english text that tells you what to do

#

Like

You probably need to assign the body variable of the PlayerMovement script in the inspector.
quartz igloo
#

I know it's a problem about a missign variable in the inspector, that's what I'm trying to do

languid spire
#

do you know how to set variables in the inspector?

quartz igloo
#

I think yes, I created a variable called xInput of type float by adding a new component

languid spire
#

no, that is declaring a variable for use in the inspector (maybe) that is not setting it's value

quartz igloo
#

I can set the value in the inspector if I'm unserstanding correctly

#

I set the value to 4

languid spire
#

then that is what you need to do here.
You have declared a variable 'body'

public Rigidbody2D body;

So now you need to give it a value in the inspector

green ether
#

you could set a string to "bananas" but im not sure how that will affect your playermovement

#

body is the name of your RigidBody2D component

#

its not assigned on the gameObject where the playerMovement script is

#
  1. Add a Rigidbody2D to the gameObject if it doesnt have one
  2. Drag that Component into the field body of PlayerMovement
#

or alternatively you can do

body = GetComponent<Rigidbody2d>();
#

in your start method

tawdry quest
#

@languid spire i wanted to say sorry for the condesending way of talking to you earlier, i just had a bad example and i shouldnt have talked like that

burnt mantle
#

Hi guys i have a question why when i add a camera to a gameobject the pivot position change like my object is in 0,0,0 and visualy on 0,0,0 and when i add my camera the position don't change but visualy not in 0,0,0

warm cove
#

hello guys! So I just downloaded a death animation and created a transition from "any state" to it, with the requirement of a bool named "alive = false". To set the bool to false, I used a private void OnCollisionEnter2D(Collision2D collision and then a gameobjectcomparetag and the tag of the enemy to set it to false. Unfortunately this doesn't seem to work, as now my character repeats the die animation constantly without having touched the object but when he touches it it stops. Could this be because the if with comparetag enemy is in the same private void as another comparetag?

burnt mantle
tepid summit
#

i have this here script that desnt give any errors but it doesnt call the debug nor does it instantiate anyhting. i was wondering if anyone could help

 public Vector3 Tree;

 void Start()
 {
     DropBranches();
 }

 IEnumerator DropBranches()
 {
     yield return new WaitForSeconds(Random.Range(1, 18));
     ItemPrefab = Instantiate(ItemPrefab, Tree, Quaternion.identity);
     Debug.Log("Dropped");
     Start();
 }```
#

i originally had it set to Update()

burnt mantle
#

its a coroutine so you have to have to put in StartCoroutine(DropBranches());

tepid summit
#

ohh yeahhh

#

my bad

#

easy mistake

#

tysm

warm cove
burnt mantle
warm cove
#

alright

#

private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Platform")) { anim_grounded = true; grounded = true; // Man nuddar marken jumps = 2; // Refreshar mängden hopp du har när du väl nuddar marken } if (collision.gameObject.CompareTag("enemy")) { alive = false; } }
earlier I have a private bool for alive set to true and anim.SetBool("dying", alive);

#

could it just be an issue with me having two different comparetag ifs in the same method?

burnt mantle
warm cove
#

alright

#

btw sorry for swedish comments, this is a school project of mine ^^

burnt mantle
#

What is the bool alive for ?

warm cove
#

I use it as a condition for an animation transition

burnt mantle
#

because if you want to change the bool in the animator you just need anim.SetBool("dying", alive);

warm cove
#

so that when I touch a certain object the character enters the dying animation

#

oh

burnt mantle
#

so if you don't use the bool alive for an other check you can just put anim.SetBool("dying", alive); in you condition

burnt mantle
#

like anim.SetBool("dying", true);

warm cove
#

👍

#

tysm ^^

quaint anchor
#

What does this error mean?? It keeps showing up and appearing and I can't do anything

burnt vapor
#

Try reloading your editor if this keeps popping up

quaint anchor
#

okasy

burnt vapor
#

Otherwise it's possible something does influence it but there's simply not a clear exception build in to explain it, so try finding something related to these nodes it mentiones

quaint anchor
#

okay reset and its working fine it seems

#

thank you

scenic saffron
#

I need to assign the transform of my player to my prefab and cant open both in inspector at the same time, can anyone help me?

scenic saffron
#

yes

green ether
#

cant assign

#

those to prefabs

languid spire
#

you cannot put scene objects into prefabs

green ether
#

You never need to. What are you trying to achieve?

scenic saffron
#

i just made the player a prefab too it fixed

languid spire
#

oh, no. I can see what comes next

scenic saffron
#

did u see that i tell that it just takes the positions from the prefab and not actually from the Object in the scene?

hollow dawn
#

im trying to download my game to my phone but it wont let me, how do I fix this?

languid spire
#

and what makes you think that the transform of the player in the Scene will be the same as the Player pefab?

scenic saffron
#

brain not braining

languid spire
green ether
languid spire
#

I am so tired of people that do not read messages

green ether
#

it must be easier to read one sentence rather than posting a screenshot here and writing a question no?

languid spire
#

obviously not

#

reading take effort and thought, man that is too much to ask

green ether
#

one step ahead would be to then google what you read before asking here

#

but thats like

#

very advanced already

languid spire
#

but google isn't youtube and if it aint on youtube it don't exist

scenic saffron
#

so im even more stupid

languid spire
split dragon
#

Hi. I have a problem: I have a float "Hi", and from its values I need to get certain numbers: 300 = 0.1, 200 = 0.5, 100 = 1. This is just a rough example, I still need to take data between these numbers (250, 175. 63, etc.). What formula or function should I use for this?

wintry quarry
#

if it's 0.1, that's not a linear function so the question to ask would be what kind of curve do you want?

#

One option is to use an AnimationCurve.

split dragon
wintry quarry
#

then that's just a remap function

split dragon
#

Thanks

wintry quarry
#

i.e. remap(Hi, 300, 100, 0, 1)

#

Alternatively:
1 - Mathf.InverseLerp(100, 300, Hi)

scenic saffron
#

Is there a really simple way to get the direction from one transform to another transform?

wintry quarry
#

(to.position - from.position).normalized if you want a normalized direction vector

scenic saffron
#

that gives me smth like this: (0.42, 0.15, -0.89) and what do i do with it now? like what number means what?

wintry quarry
#

Why were you wanting the direction in the first place?

#

You can do whatever you'd like with it. Make an object face that direction. Fire a projectile in that direction

#

whatever

green ether
#

you could even revert it and go the opposite way

#

endless possibilities!

scenic saffron
#

i dont know how to do math with vectors we havent had that in school yet, but i'll try to figure it out

wintry quarry
#

You don't generally have to do any math

#

There must be some reason you asked for a direction vector

#

Those numbers are just the x, y, z parts of the vector

silk night
#

Vector is basically a distance but in 2/3 dimensions 😄

scenic saffron
silk night
#

If you want an easy imagination

wintry quarry
#

it's always a 3D engine

scenic saffron
#

makes sens

wintry quarry
#

if you have a non-zero Z component it's because your objects are at different z positions

scenic saffron
#

if i make it a Vector2 instead of a vector3 can i just forget about z?

wintry quarry
#

that depends

#

it depends on when you make the conversion and whether you're normalizing or not

#

If you convert first and then normalize, then yes

summer stump
wintry quarry
#

if you don't normalize at all, then yes

silk night
#

if you are working in 2d, why are your objects different on the Z axis anyway, did you accidentially move one on Z?

wintry quarry
#

(one object might be the camera!)

summer stump
#

Ah of course.

scenic saffron
wintry quarry
#

ok then generally they should all be at z = 0 but not always

scenic saffron
#

but the second object was created by the camera so the z was messed up

#

i'll just subtract Vector3(0, 0, 10)

#

it works

silk night
#

var newPosition = new Vector3(cameraTransform.x, cameraTransform.y, 0) would be enough to get the camera position with 0 on Z

silk night
#

whats wrong with var?

willow scroll
#

They are hard to read

silk night
#

Not really 😄

#

also any IDE will annotate it for you, if the type isnt obvious in the first place

willow scroll
#

Changing the var by the actual type and simplifying the type assigned looks better

Vector3 newPosition = new(cameraTransform.x, cameraTransform.y, 0)
silk night
#

Its preference

#

there is no better or worse for that

willow scroll
#

Sure it is, that was merely my opinion 😅

scenic saffron
silk night
#

wait are you moving your player based on the camera position?

scenic saffron
#

no

scenic saffron
#

and i want the strength of the attraction to decrees exponentially as the distance increases

#

and i want to unalive myself

willow scroll
#

The last piece of information was redundant

silk night
#

Oh, then what I would suggest is creating a plane that is on Z = 0, send a ray from camera to cursor position and get the intersection with the plane, put the black hole position on the intersection point

#

will automatically give you Z = 0 for your black hole position

willow scroll
silk night
#

as for the attraction to the black hole, sounds like you need help with that? 😄

scenic saffron
#

but when the distance increases it gets exponentially slower

willow scroll
# scenic saffron yes

Create a hole GameObject and set its position to the position of the cursor in the world space

private void Update()
{
   Vector2 mousePos = Input.mousePosition;

   if (_mousePosPrev != mousePos)
   {
       blackHole.position = _mainCamera.ScreenToWorldPoint(Input.mousePosition);
       _mousePosPrev = mousePos;
   }
}
scenic saffron
#

i allready have a hole

#

that works

#

i just need the attraction part

final kestrel
#

!code

eternal falconBOT
silk night
#

physics would be less predictable and harder to controll but might look better

final kestrel
final kestrel
#

editor

silk night
#

Try building, editor is funky with the mouse sometimes

final kestrel
#

All right thanks.

willow scroll
scenic saffron
silk night
scenic saffron
willow scroll
#

The delta time is necessary here, as we're moving the rigidbody continuously

silk night
#

AddForce already factors in deltatime

raw ledge
#

Hey how could I do a wall such that some objects go through it but some no?

silk night
raw ledge
#

Thanksss

willow scroll
summer stump
long jacinth
#

How do i access a boolen from a database

polar acorn
long jacinth
#

'CharacterDataBase' does not contain a definition for 'IsColor' and no accessible extension method 'IsColor' accepting a first argument of type 'CharacterDataBase' could be found (are you missing a using directive or an assembly reference?)

long jacinth
polar acorn
#

Show CharacterDataBase

long jacinth
slender nymph
#

that's not CharacterDataBase

polar acorn
long jacinth
#

oh wait sorry wrong one

polar acorn
polar acorn
#

So then what are you trying to get IsColor from?

long jacinth
#

im confused

#

i followed a tutorial for this

#

why does this work with the sprite renderer and not a boolen

summer stump
long jacinth
polar acorn
# long jacinth im confused

You have a variable that holds a reference to a CharacterDataBase. You can see all the things that CharacterDataBase has in the code here. It doesn't have anything named IsColor so what are you actually trying to get

slender nymph
polar acorn
#

CharacterDatabase doesn't have a sprite renderer either

summer stump
slender nymph
#

this is a code channel

polar acorn
#

Find the button that looks like this in your image editor of choice

long jacinth
polar acorn
#

They are trying to get it from a Character

long jacinth
polar acorn
#

But you're not trying to get IsColor from that

polar acorn
#

You cannot tell what color a pair of shoes are by looking at the shoebox

#

Your variable characterDB is a shoebox full of Characters

#

The shoebox itself is not shoes

summer stump
long jacinth
#

hmm okay

#

its not showing up in unity

polar acorn
long jacinth
summer stump
long jacinth
summer stump
long jacinth
slender nymph
polar acorn
summer stump
#

If you did, there is likely an error

long jacinth
tame delta
#

Hello guys, I'm trying to make a project following a Youtube video, however this video is dated. in the code it states csharp public override void OnActionReceived(float[] vectorAction) { if (vectorAction[0] == 1) { Thrust(); } } But since Im using the newer version I have to use ```csharp
public override void OnActionReceived(ActionBuffers actions)
{
}

summer stump
long jacinth
#

i saved

#

now it shows up inside unity

long jacinth
#

but i dont know how to make isColor in the database equal to IsColor in the character

sand silo
polar acorn
#

Why does your database have an IsColor

long jacinth
summer stump
polar acorn
slender nymph
eternal falconBOT
long jacinth
slender nymph
#

double kill

polar acorn
summer stump
polar acorn
#

Do you want the IsColor boolean to belong to the Character or the Box the characters are stored in

long jacinth
#

which now it shows

summer stump
polar acorn
#

What is the point of that

#

what value does that represent

long jacinth
#

i removed it

summer stump
#

Imagine a big box. It contains a piece of paper with some information, and other boxes.
The other boxes also have information inside.
You are trying to look in the big box for information in the little boxes.
Just open the smaller box

polar acorn
# long jacinth i removed it

Okay. Now that it's gone, if you want to get IsColor from a character, you need to actually do .IsColor on a character. Not the database. Look at how you're getting the sprite renderer

#

You are not getting it from CharacterDB

whole narwhal
#

Super quick can you have 2 yield(s) in 1 coroutine?

summer stump
#

Yes

whole narwhal
#

It's giving me an invisible error when I try to do it

summer stump
#

You can have as many as you want

wintry quarry
summer stump
#

"Invisible error"?

wintry quarry
#

maybe just share your code and your error

whole narwhal
#

In VisualStudio there is no errors but I can't drag it onto my objects in unity over a compile error or class issue (I took out the 2nd yield and it worked fine)

wintry quarry
#

unity console is the source of truth for compile errors

#

Also double check that your class name matches your filename

summer stump
#

maybe just share your code

whole narwhal
#

Nvmd NOW it want to cooperate

#

All good

#

Ty

chrome tide
#

whats the difference between OnCollisionEnter and OnTriggerEnter ?

frosty lantern
#

I figured out I can search the debug statements and apparently my assignment to the dictionary isn't working

polar acorn
polar acorn
orchid trout
#

How do I wait for a unity Animator animation to finish playing before executing some code?

#

I cannot seem to find a way to detect state to wait for that, the code keeps returning true that its not animating even when it is

rich adder
#

or maybe Exit state

orchid trout
# rich adder check animator state, or you can do Animation Event

        private bool IsAnimationPlaying(string animName)
        {
            AnimatorStateInfo stateInfo = atlasAnimator.GetCurrentAnimatorStateInfo(0);
            if (stateInfo.IsName(animName))
            {
                if (!stateInfo.loop || (stateInfo.loop && stateInfo.normalizedTime % 1.0f < 0.999f))
                {
                    return true;
                }
            }
            return false;
        }```
#

this is how I am trying to check state but its returning False when I expect True

#

How would you suggest checking animator state?

rich adder
orchid trout
#

Yes

#

Because I couldnt figure out how to wait for the animation to finish

polar acorn
rich adder
#

OnExitState couldhelp if you got transitions

#

When I know the Animation Event wont be skipped I usually use that

#

just be careful with adding AnimationEvent at the end if you have long transition, as this can make it skip

orchid trout
#

I was just about to say/ask - its important that the Animation Event not get skipped and in the past almost always some kind of bug occurs where its being skipped to the point that I don't trust using them for critical game logic (or any game logic really)

#

I do have transitions for this one particular animation so Ill google into looking for OnExitState 🤔

polar acorn
orchid trout
#

Will it proc on just any animation end, or I suppose If I google how OnExitState works Ill get my answer

polar acorn
rich adder
#

basically its a special script

#

ah yea beat me to link,

silk night
#

Is it possible to have a script as a property in a ScriptableObject without things like Odin? I wanna be able to plugin in a "check if active" script to my powerups that all base on the same interface

polar acorn
#

A ScriptableObject is an asset that exists on disk, and it can't reference scene objects for the same reason a prefab can't

#

So, you could have a field of your interface type, you'd just have to set it in-game after that object is spawned or when the scene is loaded

silk night
#

well looks like odin auto-references that by default in my project i did that in before, for this one i dont have odin available, im gonna think of a different solution then 😄

timber tide
#

if it's only a single SO instance you can probably just check a singleton ref?

silk night
#

I have 5 powerups, 2 of those have an option to be turned of in a settings menu, i just wanna check on load if those 2 should be loaded or not and wanted to attach a script to their data each that checks for that setting

astral basin
#

why is it not working

queen adder
#

Sorry for being rude, but will somebody else address the problem I have? I've marked every section in Publish your project as complete, yet it won't let me continue.

astral basin
#

object with script has box collider
other has box collider too

willow scroll
polar acorn
ripe shard
polar acorn
# astral basin why is it not working

The Three Commandments of OnCollisionEnter:

  1. Thou Shalt have a 3D Collider on each object
  2. Thou Shalt not tick isTrigger on either
  3. Thou Shalt have a 3D Rigidbody on at least one of them
queen adder
silk night
willow scroll
astral basin
silk night
willow scroll
timid hinge
#

hi can someone help me

#

i dont know what animator isnt running

polar acorn
#

You need to assign an Animator Controller

willow scroll
silk night
#

And I certainly dont want to do a hard-code check on their names, I need to build a condition into their properties

willow scroll
willow scroll
silk night
#

I have 5 ScriptableObjects that hold powerup data, they get loaded into a list on startup + the list gets reloaded on settings-save. I want to have a dynamic option on each powerup to disable them when certain conditions are met (in this case option to disable them is checked) in runtime

willow scroll
silk night
#

I found a way now though, each powerup has an active bool now and the settings save proecess will change the active on the two i need disabled to false

silk night
# willow scroll Should the option be stored via a `Func`?

The option should be a function if possible, yes, in my previous project (with odin available) i just added a check script that got auto-referenced by odin, without it seems to not be available so easily

But i found a solution now, so doesnt matter anymore 😄

willow scroll
silk night
willow scroll
#

Alright, you have found a solution now anyway. That's great UnityChanThumbsUp

vapid lintel
#

Hello guys i want to make an AR app and link it with a flutter app can someone please tell the steps on how to do that or what do i need for it ?

rich adder
vapid lintel
#

For exemple you enter the app made with flutter (user interface) then click on play and you are in a the AR

#

Made using unity

ivory bobcat
rich adder
rich adder
#

just saying, its an option

#

there are many ways to do something :p

ivory bobcat
timid hinge
#

whys is this like that

#

isnt supost to be like that

rich adder
#

huh what is that? and what is the code part

honest haven
#

GameObject effectInstance = Instantiate(effectPrefab, this.transform.position, Quaternion.identity); this works ok but i need to move it up alittle as soon as i do GameObject effectInstance = Instantiate(effectPrefab, this.transform.up * 1.5f, Quaternion.identity); it moves it up but seems to instanciate at the wrong location

#

Where as the first one does it in correct place

languid spire
#

transform.up is a direction not a position

honest haven
#

So do i need a local var Vector 3? or would this be the same as transform up

languid spire
#

do you not understand what I wrote?

polar acorn
honest haven
#

ok so transform.up is a postion or not a postion

#

sorry direction

languid spire
#

it is a direction like I said

#

here and there are positions, left and right are directions

honest haven
#

so to achive it to move up on the y axis by 1.5 it would need to be a vector postion

polar acorn
languid spire
#

so to go up on the transform Y axis you want
position + (up * 1,5)

honest haven
#

ok and not var newPos = new Vector3(transform.position.x, 1.5f, transform.position.z);

languid spire
#

that goes to 1.5 not up by 1,5

summer stump
honest haven
polar acorn
polar acorn
radiant merlin
#
public class CameraController : MonoBehaviour
{
    Transform orientation;
    Transform pOrientation;
    Transform camera;
    [Header("Variables")]
    public float camSpeedX = 5.0f;
    public float camSpeedY = 3.0f;
    void Start()
    {
        orientation = gameObject.transform.GetChild(1).transform;
        camera = gameObject.transform.GetChild(0).transform;
        pOrientation = gameObject.transform;
    }

    void Update()
    {
        float camX = Input.GetAxis("Mouse X") * camSpeedX;
        float camY = -Input.GetAxis("Mouse Y") * camSpeedY;

        Quaternion rotation = Quaternion.Euler(camY, camX, 0);

        camera.rotation *= rotation;
    }
}

so i have this code for my camera but how do i stop my Z axis from changing? it leads to the camera tilting at odd angles after a few movements

young fossil
#

Testing an Android APK build and getting the error "App Not Installed" while trying to open the APK.

  • Admin permissions granted on the OS
  • Last build worked fine.
  • No debug information... Unity says it "succeeded" while the app cannot be opened

Any ideas?

young fossil
#

So now when I reinstall, it wont allow it due to the left over corruption

loud mango
#

hello, i want to make it so that whenever the zombie has velocity > 0, it will start an animation

#

how could i do something like

languid spire
loud mango
#

if(rb.velocity > vector3.zero)

summer stump
eternal falconBOT
#

:teacher: Unity Learn ↗

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

loud mango
polar acorn
loud mango
loud mango
#

no like

languid spire
young fossil
loud mango
#

idk what code i could write. ik i have to use if

polar acorn
#

setting it directly is unrealistic but also fine if realism isn't your goal

summer stump
loud mango
#

oh sorry, didnt notice it

polar acorn
#

So, what is the condition you want to check for?

radiant merlin
young fossil
polar acorn
#

You're just checking how fast the object is currently moving

summer stump
loud mango
young fossil
summer stump
polar acorn
young fossil
polar acorn
#

but checking that it's non-zero is completely fine. I would probably set a bit of a higher threshold though

young fossil
summer stump
summer stump
languid spire
young fossil
summer stump
young fossil
languid spire
#

you are still using the word unreliable which is incorrect in this context

#

the values are reliable just not exact

young fossil
#

I guess it is more reliable than I thought. Sitting here trying to think of a certain context where you would do what we are talking about though...

#

Out of interest do you have any working, real examples you could share?

summer stump
young fossil
#

You guys are right, it is reliable, I'm sure it is. I was unaware how reliable it was

young fossil
polar acorn
summer stump
languid spire
young fossil
#

Personally for animations I went down the road of attempting to base it off the physics engine, didn't have great experience and those around me told me not to do it. So these days I go for a finite state machine and base the state changes on inputs

languid spire
young fossil
young fossil
#

To my understanding I cleared the associated data by uninstalling the app. I also looked over the build details and those are correct

radiant merlin
#

thanks for ALL the help guys..... i figured it out myself lmfao

languid spire
summer stump
vast vessel
#

Any way to have a custom asset type? Like how an fbx file is "t:Model" and how sprites are "t:Sprite".

I want my scriptable object to have a type of "t:STrack"

radiant merlin
#

lol

languid spire
short hazel
young fossil
languid spire
young fossil
#

I'm assuming there is a developer mode that cuts that crap that I'm not aware of yet? I hope so...

timid hinge
#

why i cant create?

languid spire
#

Basically you can go through Android Studio and that's about as good as it gets

young fossil
short hazel
languid spire
young fossil
#

Did you do it for games dev or something else?

languid spire
#

game and app dev

young fossil
#

Did you use or do you know any libraries to make it easier?

languid spire
#

no, what we used is all in house stuff

young fossil
#

Oh wow. I need to do it eventually so just trying to find the easiest way I can too

#

Good thing F-droid exists, you can see so many examples

languid spire
#

Sorry, no easy way just years of pain

young fossil
#

Alright well thx Steve and others for this and the physics question

young fossil
young fossil
#

I did web app development but it was more front end. I don't really know how the backend works but I'm assuming it's different

languid spire
rich adder
#

MAUI is very good for android/ios if you like C# .net ecosystem

young fossil
#

Going to sound crazy but how much knowledge is transferable from C# and C++ in games development to that?

short hazel
# timid hinge what does that mean

I can't be any clearer than that. When you right-clicked the Assets tab to create your Animator, you chose "Animator Override Controller" instead of "Aniamtor Controller"
The file has the .overrideController extension, which is not correct

young fossil
rich adder
young fossil
rich adder
polar acorn
# timid hinge what does that mean

An Animator Override swaps out the animation clips of an existing Animator Controller without changing any of the logic or transitions.

young fossil
#

So is it different but easy to pick up

rich adder
#

c# is part of the languages supported in .net

languid spire
# young fossil Backend app development

Almost nothing, apart from basic language/programming skills is transferable from gamedev to back end dev. They are two very different beasts each with their own specific requirements

young fossil
#

Wait what. Can you explain what you mean? Sorry I have looked this up before and didn't get it, you explain it better

rich adder
#

there are different variations / app frameworks within .NET

young fossil
#

.NET is the ecosystem?

rich adder
#

yeah pretty much

young fossil
#

So C# and C++ are like components of .NET?

wicked cairn
rich adder
#

nothign to do with .net

#

.NET uses many languages, C# is one of them

#

C# exists without .net

wicked cairn
#

Ok what these guys said lol. The .NET part doesnt matter much, C# is C#

languid spire
young fossil
#

Ah gotcha. So you can choose to use C++ or C#

#

and stuff like X++

rich adder
rich adder
languid spire
#

or even Visual Basic (God rest it's soul)

rich adder
#

also visual basic is pretty well supported

young fossil
#

I imagine stuff like databases.

rich adder
#

well yeah you have to learn new APIs

wicked cairn
#

For backend linux, Node js is cool too. Unity C# <-> Nodejs has great communication. I know C# but I dont know Node, so asking ChatGPT to write it has been a breeze lol

rich adder
#

most of the other logic is tranferring (maaking loops, lists etc)

young fossil
rich adder
#

yeah pretty much.

languid spire
rich adder
#

also Debugger will be your best friend

young fossil
#

Ah, so more error handling and stuff

languid spire
#

absolutely

wicked cairn
rich adder
languid spire
#

When Unity finally goes to .Net 7 the whole landscape will change

wicked cairn
rich adder
#

ASP.NET core is basically full fledged

young fossil
wicked cairn
summer stump
rich adder
#

slightly better but still fugly

languid spire
#

wtf does it matter, you use the language that gets the job done, end of story.

young fossil
wicked cairn
rich adder
wicked cairn
#

without asking it added sql injection prot

rich adder
#

it encrypted the unity script to hide the domain

#

id love to see that

wicked cairn
#

it gave me some key generator

#

Try it yourself lol - ask gpt

rich adder
#

I dont need to , I do it properly with REST/ API calls

#

storing anything on client is hackable

wicked cairn
rich adder
#

just saying, storing any connection string/ip in client to connect is unwise

fading dune
#

Hey guys! Very beginner question here: Would setting the active state of a game object in Unity to its current state have any impact or performance implications? Or does Unity optimize for such cases, preventing redundant operations?

Wondering if I should always make a check before setting the state (if game object not already active, set it active)

rich adder
wicked cairn
#

id love to use that instead

rich adder
#

You make API calls

#

to the server

#

authenticate using cookies / tokens

wicked cairn
#

its a offline game to store settings

rich adder
#

then a database is overkill

wicked cairn
#

doesnt matter much if it has a domain in the code, which is encrypted tho

#

the code to verify stuff is server side

rich adder
#

the same thing that encrypts it, unless its on the server can be reversed engineered

wicked cairn
#

the only database code visible is on the server app

#

the game does not connect to a databse

rich adder
#

right so you have to write server code in javascript now

wicked cairn
rich adder
#

which is why I doubt its method

wicked cairn
#

well it works

rich adder
#

idk to me thats more of a hassle than using what .NET already has built in. Asp.net app all the way 🤷‍♂️ no dealing with JS/TS

#

I made a players dashboard/admin panel for my game using WebAPI and server

wicked cairn
#

Writing it in .NET does not take away the fact you still have to write code

rich adder
#

all I can say is, you seemed to have not gotten deep the rabbit hole yet to know what you're talking about here

gaunt ice
#

i prefer writing the backend in c#, now you can copy and paste (or use the dll) of your api classes and the logic of verification

rich adder
#

sharing Class Libraries isa breeze, not having to write code over and over again

wicked cairn
summer stump
rich adder
wicked cairn
rich adder
#

Its not even doubt, I've experienced it

#

GPT doesnt write scalable code..

#

it has no reason or forethought

summer stump
wicked cairn
#

then you didnt provide enough info on what you need

rich adder
#

How so ? I knew exactly what I want to build

wicked cairn
#

Ive learned a good bit from it, I dont copy paste code from it

rich adder
#

its not an instruction issue, its a Listener/Student issue

rich adder
wicked cairn
polar acorn
rich adder
summer stump
rich adder
#

that makes no sense

polar acorn
rich adder
languid spire
#

Gotta love these people that seem to think that these LLM's even know how to code. Guess what? They do not!

wicked cairn
polar acorn
#

I think you seem to be confusing the term "Scaleable code" for "code that runs". These are not the same thing

#

ChatGPT can sometimes make code that runs

#

It is, in absolutely no sense of the word, scaleable