#πŸ’»β”ƒcode-beginner

1 messages Β· Page 674 of 1

timid salmon
#

Ohhhhhhhhhhhhhhhhhhh

sacred sierra
#

sry if this is a commonly asked question and also sry for my eng (not my nativ).
i'm searching for scripts or a tutorial for a 2d turnbased battle like ff but evrything i found is to old or not completed i hope someone can help me out

this are the features i need just in case its importent:

  • out of comabat member switch (party manager)
  • attack, skill, magic, item and escape buttons (ui is alrdy done)
  • skills use sp magic mp
  • skills deal physics dmg and magic magic dmg (this one is not neccesarry if to complex)
  • also the player can switch classes out of combat (if this is neccesary for combat)
  • i also alrdy did scriptableobject for classes, items, skillsMagic, equipment, buffDebuff and enemys
  • also i have a skript to store each class for each individual member of the party and a runtime script to store the actuall data like current health etc.
#

*also called sideview battle

rich adder
#

alienHeath = GetComponent<AlienHeath>();
you're looking for AlienHealth on an Alien object itself in Score ? when you destroy the gameobject the Score also goes in the trash

#

public Text score; this is pretty misleading naming. score should be scoreText while the score itself should be int variable

rich adder
#

how many Aliens are going to be there anyway

timid salmon
#

ill get a vedio for u

rich adder
# timid salmon

okay so I guess that means more than 1.. so you definitely need a different way to do this.. You should not have Score script per enemy..on the enemy..

timid salmon
#

i made the aliens a prefab so they all have the script

rich adder
#

right.. they all need 1 reference to Score and when they die just call an AddScore() method on Score.cs

#

put custom value if its more than 1 AddScore(3) and so on

timid salmon
#

okay

eternal needle
sacred sierra
#

i know but at least a basic, as said all tuts i find are old and not rly usable for me cuz they use or reference stuff which dont exists anymore or is obsolete

white girder
#

You can do most of those with basic coding fundamentals. You can probably find a good tutorial by search up how to make a turn based rpg in c# instead of trying to search for unity tutorials

cosmic dagger
frigid sequoia
#

Shouldn't the slider be giving me here a choice of assigning the method but with the value of the slider instead of a manually set one??

rich adder
frigid sequoia
#

Oh, so it only catches floats, even tho it's marked as whole numbers

#

Weird, but ok

rich adder
#

you can see the type right there

#

OnValueChanged (Single)

rich adder
rich adder
#

yes

cosmic dagger
#

The actual value is a float . . .

wanton pivot
#

im trying to publish this vrc avatar and this error keeps popping up, I looked through the assets folder and there was nothing, it seemingly doesnt exist and stops me from trying to publish

deep moss
#

is it possible to attach separate parts of 3D objects in unity it triggers animation? Example i made a script of attaching parts for a robot. I just need to make it trigger a custom animation when all parts are attached. But my parts are mix and match basically variations of different parts can trigger the animation

slender nymph
quick monolith
#

Hey everyone, I'm trying to learn fundamental of game making. I was following this playlist to understand basics

#

In this Unity tutorial we're going to look at how to allow the player to shoot and destroy enemies

This is the seventh video in our series showing how to make a full top down 2D shooter game in Unity.

The playlist for this series can be found here
β–Ί https://www.youtube.com/playlist?list=PLx7AKmQhxJFajrXez-0GJgDlKELabQQHT

The project files a...

β–Ά Play video
#

In the end I figured out something

#

In the code he always creates bullet but never destroy the gameobject of bullet

#

I tried to destroy in this script but didnt work well

#

I was trying to get game object of bullet, I dunno how it works actually

slender nymph
#

you're destroying the prefab not the spawned bullets

quick monolith
#

shouldn't I access prefab first in the code?

slender nymph
#

you only need to access the prefab when instantiating the bullet. the prefab has no connection to the instantiated objects. the Instantiate method returns a reference to the spawned bullet, but presumably you would want to handle destroying them from the bullet themselves. so you destroy the bullet gameobject from the bullet itself on collision or after some time

quick monolith
#

that makes sense

#

yeah got u

#

So basically we getting enemy movement component if its trigger we destroying the object of zombie

#

I mean collision

#

between two object

#

did I understand correctly or

slender nymph
#

go through all of the information

quick monolith
#

She actually taking the camera checking the position off camera if camera.x < 0 || camera.x > camera_pixelwidth same for height and then destroying the object

#

I just wondered a thing in this code now.
If we destroying the gameObject in this code, so we actually destroying the object of Bullet then, right?

#

I think I figured out now

celest jay
#

Any c# number type good to use for idle incremental game? I want something that write 1,000,000 as 1m and so on. I don't want to write it myself

#

BigDouble is nice for big numbers (also comes with a built in property drawer), but it doesnt do alpha suffixes

naive pawn
#

those suffixes aren't really standardized beyond trillion (and even then casing isn't standard)
so there's not gonna be a built-in for that

celest jay
#

I mean some games just have made up system

naive pawn
#

exactly

celest jay
#

commonly starting those numbers they do a

naive pawn
#

they do the stringification themselves

#

or maybe there's a library for it

#

but it's not gonna built-in because it isn't a standard system

celest jay
#

ugh I dont really wanna write that, but whatever, I guess I have to

eternal needle
#

999 no suffix, 1000 = 1k. 1000k = 1m. Onwards

celest jay
naive pawn
#

hey, more experience in logic

#

practice the small things so you can manage the harder ones later

eternal needle
naive pawn
#

i mean i don't think that'd directly work

#

the games he mentioned usually have quite dynamic shifts in this, treating it as if it were a really big number with detail all the way down
buying something when your money is close to the cost doesn't bring you down to 0, and commonly a few decimals are shown eg 1.5k or 3.2m

#

so there is a bit more nuance, some system to design out for UX

eternal needle
#

All of that is still possible through the same idea. You dont need to store insanely large numbers, its just a computational waste when deep into the game, you have 130 trailing zeros on each number

#

Store 0 to 10000 then and suddenly you can still represent 1.5k

naive pawn
#

im not saying it's not viable with you idea, just that it requires more thought

#

it's not just figuring out how to do it, it's figuring out what to do in the first place - as in, what the requirements for the system are

#

how many digits should be kept? does that achieve the desired effect? etc

#

also of course you still need to be able to tick up if you add a small amount a lot of times

eternal needle
#

πŸ€·β€β™‚οΈ the thought is quite simple. Probably easier than trying to create a system working around arbitrarily large numbers and having to fix performance issues down the line. I dont see how any of this affects the overall idea that you shouldn't be storing the extremely large numbers. Games dont store the large numbers

naive pawn
#

im not saying to store arbitrarily large numbers

#

my point is there's more nuance to the system, you can't just hand-wave all the details away πŸ˜†

median hatch
#

Destroy(gameObject) fixes it

split plover
#

Sorry i'm just a bit confused here, what does this mean my script doesn't derive from monobehaviour? It has the mono behvaiour at the top of the script so im confused

clear juniper
#

do you have any other scripts on that object?

split plover
#

Well if capsule collider counts then i guess yeah?

#

But other than that no

clear juniper
#

any child objects?

split plover
#

Nope

#

this is the only object i've put in it

clear juniper
#

can I see a screenshot of the inspector?

split plover
#

The only other thing i've changed is that i set is trigger to true so i don't forget later

#

Also for some reason the object is showing up blue on the screne but thats it

clear juniper
#

that is really strange πŸ€” have you tried removing the script?

split plover
#

Still shows the same error

clear juniper
#

yeah it's not that script then πŸ™ƒ do you have any other scripts in your project?

split plover
#

Nope, that is literally the only one

#

Oh i just noticed something, does it change anything if it says the object is a .prefab?

clear juniper
#

have you tried restarting unity? πŸ˜‚

split plover
#

I dont know why its saying its a .prefab

split plover
clear juniper
#

oops lol

split plover
#

but i made another

clear juniper
#

working now?

split plover
#

Probably i guess

#

im not getting any errors

clear juniper
#

sounds like it was just unity having a bad day 😬

naive pawn
#

@split plover did you have any compile errors

split plover
#

Is it normal for 3d objects i drag into an assets folder to not change positions

split plover
naive pawn
#

it sounds like something hadn't been refreshed to me

split plover
#

when i change the position and the object is selected it doesn't change positions

naive pawn
split plover
split plover
#

😭

naive pawn
clear juniper
#

a prefab is like a blueprint, it's not actually in the game it's an asset

split plover
#

oh

clear juniper
#

the one in the scene is an instance of the prefab

naive pawn
eternal falconBOT
#

:teacher: Unity Learn β†—

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

split plover
#

well if its planning to be a parent object should i still have it as a prefab

naive pawn
#

very separate things

#

go learn what a prefab is first

clear juniper
#

prefabs are typically used for:

  • objects you want to spawn during gameplay (e.g. enemies that spawn in)
  • objects you need to reuse frequently (e.g. trees or rocks)
split plover
#

Okay but quick question should i use prefabs if i'm planning to use the object on different maps and stuff

split plover
naive pawn
sour fulcrum
#

@split plover have you played minecraft

split plover
sour fulcrum
#

(you will need to learn how to use prefabs)

naive pawn
#

they're essentials

sour fulcrum
#

you should play minecraft there's a lot of good comparisons using it πŸ˜›

clear juniper
naive pawn
#

sure, skip over 2d and audio and publishing if you aren't doing that now

#

but you will still need the essentials for whatever it is you're doing

#

the 3d essentials mission goes over prefabs

#

go learn

split plover
naive pawn
#

that's why i said to skip over them for now

split plover
#

just making a game i can play with friends

sour fulcrum
#

prefabs are a bread and butter of unity

#

youll be using them

naive pawn
split plover
naive pawn
#

publishing is turning the project into something you can actually play

split plover
#

im just planning on sending the game files over off of like mediafire or something im not planning on putting it on steam or something

split plover
naive pawn
#

if you don't want to publish it publically, sure, but you still need to publish it so other people can play

naive pawn
#

right now you have project files

split plover
#

I thought publishing was like, posting it on something like steam or epic games

naive pawn
#

those are some platforms you can publish on

split plover
#

ok

naive pawn
#

anyways that's all irrelevant for now - right now you're still in the process of making the game
you will need to go over essentials for the topics you're working on

split plover
#

im watching the essentials introduction right now

#

amm i able to fully skip the install unity tutorial

#

i feel like i should be able to but im not sure

naive pawn
#

just in general for stuff you already know, i'd recommend at least skimming just to make sure you aren't missing anything

split plover
#

alright

split plover
#

another stupid question but i was reading the unity docs for why the input system wouldn't work and when i try to use InputSystem.actions it says it doesn't exist in the context

#

it has using Unity.VisualScripting.InputSystem and using UnityEngine.InputSystem at the top so idk whats wrong

#

im just gonna use the old input system idk why it wont work

north kiln
split plover
#

The only one it showed in the package installer and the one that came installed

north kiln
#

Which is?

split plover
#

1.14 or something i think

#

i can't fully remember ill check

#

yeah 1.14.0

naive pawn
north kiln
#

Should be fine then. The visual scripting namespace is irrelevant and should be removed

naive pawn
#

give more info please - what code are you trying to use, and what's the error you get?

split plover
naive pawn
#

that doesn't give me any info at all lmao

split plover
#

Its literally all the info i have

#

i dont know why its not working

north kiln
#

It would be best if you posted both the code and the error as they are, not second hand descriptions

split plover
#

Okay

naive pawn
#

show the exact !code and exact error, not just your retelling

eternal falconBOT
split plover
split plover
#

its exactly what it says

north kiln
#

Can you hover over InputSystem and show what it says

split plover
#

I am hovering over InputSystem

#

that is what it says

north kiln
#

And also send The surrounding code so it's clear what you're actually doing, not just the error in isolation

hexed terrace
#

isn't actions for the new input system? It won't show if you don't have the project set to use new input system in the project settings..?

split plover
#
using UnityEngine;
using UnityEngine.InputSystem;

public class MovementScriptBaseCharacter : MonoBehaviour {
    public float movementspeed = 5f;
    public Vector3 dir;
    float hzInput;
    float vInput;
    CharacterController controller;
    private float gravity = -3f;
    private float velocity;
    [SerializeField] private float gravityMultiplier;
    public float velocityMultiplier;

    void Start() {

    }

    void Update() {
        CharacterMovement();
    }

    void CharacterMovement() {
        hzInput = Input.GetAxis("Horizontal");
        vInput = Input.GetAxis("Vertical");
        dir = transform.forward * vInput;
        dir = transform.right * hzInput;
        dir.y = velocity;
        controller.Move(dir * movementspeed * Time.deltaTime);
    }
    InputSystem.actions
}
#

thats the code

naive pawn
hexed terrace
split plover
#

it has a bunch of stuff that i haven't put in the code yet

north kiln
split plover
#

cause im still coding it

naive pawn
split plover
hexed terrace
#

{}

naive pawn
#

it needs to be in a method/prop/constructor/init block

#

it can't be used in that context - the error says there's nothing matching InputSystem.actions that fits in that context, it'd have to be a type/namespace

split plover
#

Man what the fuck 😭

#

alright well

#

i guess it works now but

naive pawn
#

just how c# works - you can only have declarations and definitions directly in a type's body (eg a class, in this case)
statements have to be inside methods or similar

burnt vapor
#

C# isn't a functional language, you need to define a scope for things

#

A class, even static, and a method to call. Everything has a path here.

#

Otherwise ask Unity devs to support F# πŸ˜„

pastel pecan
#

!code

eternal falconBOT
oak mountain
#

how hard would it be to make procedurally generated buildings with interiors, loot, furniture and set it to an area? I'm trying to make a urban area that has random buildings in the middle of the playing field, and I'll use a bunch of buildings together as a barrier and ambience

frosty hound
#

It would be easier to just make prefabbed layouts and randomly pick them rather than procedurally creating everything from scratch.

#

That said, most games fake the interior through the windows with a parallax texture. Its overkill to actually put real props inside something you can't move around in.

mossy nimbus
#

hi guys i just started not long ago and i want to ask why when i first initialise a value

public float speed = 20.0f;
public float xRange = 15f;

it saves the value into unity but when i change in vs ide it doesnt update unity

grizzled crag
#

oh you gotta change the value in unity

wintry quarry
grizzled crag
wintry quarry
#

Once they're saved in the scene file they have to be changed in the scene

grizzled crag
#

from there forward it follows the values you set in the editor

wintry quarry
#

If you don't want this behavior don't make them public

mossy nimbus
#

oh

grizzled crag
#

plus, it's generally bad practice to set fields to public

mossy nimbus
#

so to allow changes to update from vs i have to make it private?

grizzled crag
#
[SerializeField] private float speed = 20.0f;
wintry quarry
grizzled crag
#

oh in the code itself

#

yeah just set it in awake

grizzled crag
wintry quarry
#

That won't change the behavior they're asking about though

#

Since that will also be serialized

grizzled crag
mossy nimbus
#

awake as in the void Awake() method? if i initialise it in their can i access using other methods also

#

like Update()

wintry quarry
grizzled crag
#

yes that method, if you initialize it in there, no other method can access it tho

#

if you want the update method to access it, you must set it as a global variable

wintry quarry
#

The fact that it's a field is why you can access it in all your methods

#

It's not a global variable

#

It's a member variable

mossy nimbus
#

wouldnt the scope change or smt like that, i have a bit of python background so i know a bit about that but im not sure in c#

wintry quarry
#

Never said to change where you declare it

mossy nimbus
#

ohh

grizzled crag
wintry quarry
#

You must still declare it outside

grizzled crag
#

this

wintry quarry
#

I never said to declare it there?

#

Just initialize

#

Initialize != Declare

grizzled crag
mossy nimbus
#

i understand now thanks a lot guys

grizzled crag
#

there's a nice 10 hour course on youtube for basic - intermediate btw @mossy nimbus

#

it's project based, too

#

after you're done with the course, you'd have created a pretty nice game

mossy nimbus
#

im following the guides on learn.unity.com but it seems like their player input system is the old one, i will be sure to look at that

#

thanks

grizzled crag
#

mm! This course teaches you both the old and new input system

#

and you'll learn code practices that's very essential

#

oh and it's free

mossy nimbus
#

its the one from CoffeeNCode?

split plover
#

Quick question, if the input system is so hard to use why do people say to use it over just keycodes

#

changing the inputs from keycodes to input system genuinly added nearly an extra 10 lines of code 😭 which is a lot when it was only 20-30 before

harsh brook
#

Hey, I need help with something, Ive been trying for hours now... im making a tower defense in 3D, the thing is, im making some code so you can upgrade the towers, the buttons work with building them, but ive tried a lot of different things and the function doesnt even react like im calling it, could someone hop on a call to help?

wintry quarry
#

You can directly use the new system in a 1:1 way from the old if you understand it well enough

#

With exactly the same number of lines

split plover
#

Well

wintry quarry
#

But the benefit of the new system is that it's much more flexibile, supports runtime rebinding, and event based handling, et

split plover
#

i guess yeah its not that hard to use but it is still way harder than just keycodes

split plover
#

people have to be able to rebind stuff

#

ohhh

polar acorn
split plover
#

ok well if people want to rebind jump from spacebar then i'm not letting them anyways thats a crime

wintry quarry
#

It's not any harder if you want to use it the same way as GetKey

#

You can just do e.g. Keyboard.current[Key.A].IsPressed()

#

That's the same as GetKey

#

Not any harder to use

split plover
#

just to use it in an if statement i had to make an entire bool for if a button is down after trying to figure out what the fuck an action phase eis

wintry quarry
#

But you also lost all the benefits of the new system doing it this way

split plover
polar acorn
#

Also, using the Input System will sort of subtly encourage you to structuring your code better. Having functions that respond to a specific button instead of a monolithic update class with a cliff wall of if statements

wintry quarry
#

The thing is you are using one specific workflow and the new system supports many workflows

split plover
wintry quarry
#

You are still learning and not aware of how to use them all

wintry quarry
split plover
wintry quarry
#

The specific literal code you wrote was wrong, that doesn't mean what you intended to do isn't possible

#

It just means you don't know how to write it

split plover
#

how else would you write it other than if (playerInput.actions.FindAction("jump"); (used playerInput as a placeholder for the input map)

wintry quarry
#
if (playerInput.actions["Jump"].wasPerformedThisFrame)```
split plover
wintry quarry
#

Er sorry it's WasPerformedThisFrame()

split plover
solar arch
#

I have a really weird bug where my vector3.zero and vector2.zero are both off screen to the left. Im wondering if this is to do with using a "scale with screen size" canvas but im genuinely not sure, if anyone could help that would be great.

This "8" should have been spawned at vector2.zero.

spare mountain
keen dew
#

UI elements should be positioned with anchoredPosition. Setting the transform position will have unexpected results

solar arch
solar arch
spare mountain
solar arch
#

yes

keen dew
#

It needs to be in a canvas

solar arch
boreal violet
#

Why it's so freesing...

using UnityEngine;

public class CharacterMovement : MonoBehaviour
{
    private Rigidbody2D pl_rb;

    [Header("Movement Variables")]
    [SerializeField]
    private float acceleration = 10f;
    [SerializeField]
    private float deceleration = 10f;
    [SerializeField]
    private float velPower = 0.9f;
    [SerializeField]
    private float moveSpeed;
    [SerializeField]
    private float jumpSpeed;

    [SerializeField]
    private LayerMask groundMask;
    [SerializeField]
    private Transform circlePos;

    private float circleSize = .05f;
    private float moveX;

    private bool isGrounded()
    {
        return (Physics2D.OverlapCircle(circlePos.position, circleSize, groundMask));
    }

    private void Awake()
    {
        pl_rb = GetComponent<Rigidbody2D>();
    }

    private void FixedUpdate()
    {
        Vector2 velocity = pl_rb.linearVelocity;

        float targetSpeed = moveX * moveSpeed;
        float speedDiff = targetSpeed - pl_rb.linearVelocity.x;
        float accelRate =  (Mathf.Abs(targetSpeed) > .01f) ? acceleration : deceleration;
        float movement = Mathf.Pow(Mathf.Abs(speedDiff) * accelRate, velPower) * Mathf.Sign(speedDiff);

        pl_rb.AddForce(movement * Vector2.right);
    }

    private void Update()
    {
        moveX = Input.GetAxis("Horizontal");

        if ((Input.GetButtonDown("Jump") || Input.GetKeyDown(KeyCode.W)) && isGrounded())
            pl_rb.AddForce(Vector2.up * jumpSpeed, ForceMode2D.Impulse);
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(circlePos.position, circleSize);
    }
}

naive pawn
#

the jittering? where do you control the camera?

boreal violet
#
using UnityEngine;

public class CameraLook : MonoBehaviour
{
    [SerializeField]
    private Transform playerTransform;

    [SerializeField]
    [Range(0.1f, 10f)]
    private float followSmoothness = 5f;

    private Vector3 offset;

    private void Start()
    {
        offset = transform.position - playerTransform.position;
    }

    private void LateUpdate()
    {
        transform.position = Vector3.Lerp(
            transform.position,
            playerTransform.position + offset,
            followSmoothness * Time.deltaTime
        );
    }
}
#

I think it's basic

naive pawn
#

ah, you should set your rigidbody to interpolate

#

(also probably collision continuous)

boreal violet
#

Thx

naive pawn
pliant bridge
#

help, I'm building my first android build, I followed tutorials when I click build and save nothing happens, the save button is clickable but nothing happens, forcing me to concel, there are no errors nothing, Idk what to do

rocky canyon
#

!logs may be something in the editor logs after u try

eternal falconBOT
#
πŸ“ Logs

Documentation

Editor logs

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

Unity Hub

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

soft kernel
#

hey, is there any chat I can ask question about publishing on asset store?

rocky canyon
#

the publisher portal + docs has everything u could possibly need.. whats ur question?

cosmic quail
rocky canyon
#

oh right. wrong channel too btw.. ^ u can get answers there

oak mountain
#

can anyone help me out? I'm trying to make it so that while reloading, my gun wont fire like it was, however when trying to implement a simple boolean (isReloading), it just breaks everything, after reloading, it bricks the gun (the ammo and magazine capacity does not get updated and it wont let me fire, I tried toggling on and off the isReloading bool in the inspector but it's still bricked) btw im trying to make my game multiplayer and im using unity's netcode for that

Weapon Script:
https://pastebin.com/2PeWz45P
Player Fire Input Script:
https://pastebin.com/JvipQzQf

ivory bobcat
oak mountain
ivory bobcat
quick monolith
oak mountain
#

there is something im missing but im too blind for this 😭

rocky canyon
#

like if the server is handling the reload on the server.. but never updates the local clients view of the ammo.. the client maybe see's a stale state

#

ill look a bit deeper in a second tho πŸ€

ivory bobcat
rocky canyon
#

^ yea, u need to log specific data.. from all the relevant methods

oak mountain
#

so reloading and firing?

rocky canyon
#

i like to log everything.. but its up to you.. the more information you and we have the better chance of finding a solution..

  • log the input
  • log the reload bool
  • log the ammo value
  • log when the reload starts
  • log ammo and values after the reload finishes
  • confirm boolean was toggled back to false
#

u could even add little tags [Client] [Server] [RPC] etc to see whose calling what at a simple glance..

ivory bobcat
#

Put a log in ReloadingOver also to see if it ever fires

#

But as is, it looks like you're still able to shoot after reloading. What's the actual problem?

oak mountain
ivory bobcat
oak mountain
ivory bobcat
coarse magnet
#

i have this invisible prefab inside every box that places Xs and Os but i want to select a specific unit of the prefab, how do i do this?

#

because as you can see with a single click all the boxes fill

ivory bobcat
slender nymph
coarse magnet
# slender nymph show the relevant code (also it's prefab not prefap)
public bool player1turn = true;
 public GameObject X;
 public GameObject O;
 void Update()
 {
     if (player1turn == true) 
     {
         if (Input.GetMouseButtonDown(0))
         {
             Instantiate(X, transform.position, Quaternion.identity);
             player1turn = false;
         }
     }
     else
     {
         if (Input.GetMouseButtonDown(0))
         {
             Instantiate(O, transform.position, Quaternion.identity);
             player1turn = true;
         }
     }
 }
slender nymph
#

you're currently not checking if you are clicking on a specific area of the grid, you are just checking if it is a specific turn then just instantiating the object at every position this object exists at. you should consider using something to determine where in the grid you are clicking. either by using some clickable object (like a UI button or an object that implements IPointerDownHandler) or use an actual grid (or tilemap) and convert the mouse's *current position) to a position in the grid

ivory bobcat
coarse magnet
ivory bobcat
#

You probably should not be using Update like how you are using it unless you want to go the raycast route

oak mountain
#

if i handle it like this, it works perfeclty except that you're able to start firing a bit before the reload animation ends

#

and guess what, I dont want my gun's animation fucking hardcoded because that's just dumb

ivory bobcat
oak mountain
#

then i tried the boolean route, same issue

#

something is holding this shit by a thread, and idk what that is

ivory bobcat
#

Just send a signal after the animation finishes to update the value on the server?

#

I think you're trying to do to much and not focusing enough on individual issues

#
    void ReloadingOver() // Animation Event attempt
    {
        isReloading = false;
        FinishedReloadingServerRpc();
    }```where that function would check if it isn't this player and update their values or whatever for the gun/player/etc. I'm not sure how others would differentiate who's reloading or why they'd need to know but I guess it might be important to avoid cheating etc
oak mountain
#

i'm lost

#

i've been at this way too long to the point im getting lost in my own code 😭

rich adder
ivory bobcat
#

First off, does reloading for the individual player actually work? As in, does the event get called after the animation completes? (You should not be able to fire as well)

split flower
#

How do we get a random float between 0.0 and 1.0 exclusive with system.random, when I try random.nextSingle (https://learn.microsoft.com/en-us/dotnet/api/system.random.nextsingle?view=net-9.0#system-random-nextsingle), it is not recognized by unity and random.nextDouble give me a double, I dont want to convert this number in float, since I need to do this very often

Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.

ivory bobcat
rich adder
#

also unity has Random.value already a 0-1 value

split flower
#

Yes but the range is inclusive, and I dont want that

naive pawn
#

unity doesn't recognize anything. code compilation is the realm of c#

#

show what code you used and what error you got

split flower
naive pawn
#

show the relevant code and error.

#

!code

eternal falconBOT
slender nymph
naive pawn
#

oh, of course, this again

slender nymph
#

make sure to set the docs to the .net version you are using to avoid stuff like this

naive pawn
#

NextDouble seems to be available though, could just cast that to a float

split flower
# rich adder show what you wrote
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using System;


public class scriptMountainGeneration : MonoBehaviour
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    public Mesh mesh;
    public List<Vector3> vertices = new List<Vector3>();
    public List<Vector2> uv = new List<Vector2>();
    public List<int> triangles = new List<int>();
    public List<Vector4> lines = new List<Vector4>();

    private int step = 0;
    private bool gen = false;

    private System.Random random = new System.Random();

    private void Init()
    {
        vertices.Clear();
        uv.Clear();
        triangles.Clear();
        lines.Clear();
        step = 0;
        
    }
    void Start()
    {
        mesh = new Mesh(); 
        GetComponent<MeshFilter>().mesh = mesh;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0)) {
            gen = true;
            Init();
            vertices.Add(new Vector3(random.NextSingle(), 0, 0));
            
        }
        if (Input.GetMouseButtonUp(0))
        {
            gen = false;
        }

        if (gen)
        {


        }
    }
}```
rich adder
#

but yeha boxfriend already answered. that function isnt in unitys .NET 4.x / standard 2.x

split flower
rich adder
#

anyway if UnityEngine.Random.value is inclusive just omit the included values you don't want with Random.Range

ivory bobcat
#

Random.Range(0, 0.9999f) unless you're needing more precision

split flower
#

Since I am making procedural genration with seeds this wouldnt work since unity random seeds is shared all accrosed the project

naive pawn
rich adder
#

but yeah I guess this stays global it would be a pain to change it for each one..

naive pawn
rich adder
#

I suppose you probably better off making a new System.Random instance for each thing

split flower
rich adder
slender nymph
#

you'd want to maintain multiple Random states using the Random.state property which you can get/set as needed. just cache the current state before using it, change to the state you need, perform your operations, then reapply the previous state after

#

but just using individual instances of System.Random is likely going to be easier

split flower
#

Nice that answer it for me !

vernal thorn
#

i want too make an object that spawns on an random range but only on multiples of 0.5 i cant get the hang of it i always end up whit full numbers on some objects or weird numbers like 0.375

naive pawn
#

get a random integer and multiply by 0.5f or divide by 2f

slender nymph
#

there's also the Snapping.Snap method but just starting off with multiples of 0.5 instead of getting a random float and snapping it to the nearest 0.5 is better

ivory bobcat
vernal thorn
#

oh ok thank you guys so much :D

unreal wigeon
eternal falconBOT
naive pawn
#

and you should probably reduce it to the problematic code, not the entire thing

frail hawk
#

people confuse this with an ai prompt sometimes

vernal thorn
#

I've made an random spanwer that just spawns 2 different obejcts randomly but i wand that they spawn more like a group like in this image, how could I Implement this?

 void SpawnObjects(GameObject Obj, int count)
 {
     for (int i = 0; i < count; i++)
     {
         int RandomX = Random.Range(-PlattenSeitenX / 2, PlattenSeitenX / 2);
         int RandomZ = Random.Range(-PlattenSeitenZ / 2, PlattenSeitenZ / 2);

         float xPos = 0.5f + RandomX;
         float zPos = 0.5f + RandomZ;

         Vector3 spawnPos = new Vector3(xPos, 0.5f, zPos);
         Quaternion rot = Quaternion.Euler(0, 0, 0);

         Instantiate(Obj, spawnPos, rot, transform);
     }
 }

Some documentation would also be nice i dont know the name of this thing D:

unreal wigeon
#

So the error is, that it doesnt go in the if statement, cause of the following code line cs transform.position.x == ghostNodeStart.transform.position.x + 0.15f || transform.position.x == ghostNodeStart.transform.position.x - 0.15f , but if I do the same if statement with just the y position, it works. Even without the +-0.15f. Any ideas?

frail hawk
burnt vapor
devout flume
#

I upgraded to unity 6, and they seem to have changed how the camera is controlled within the scene. I do not have a qwerty layout, and now it is character-dependant. Any way to change that?

naive pawn
naive pawn
#

a tree? a group of trees for a given tile?

vernal thorn
naive pawn
#

so you want multiple tree prefabs to generate together?

vernal thorn
#

ive used

SpawnObjects(Baum, MaxBaumAnzahl);
SpawnObjects(Stein, MaxSteineAnzahl);
naive pawn
#

you would probably just pick a random position and then randomly go around that position

#

or do noise stuff

#

or have entire patches that you randomly pick to place

#

there are a ton of ways to do this

unreal wigeon
vernal thorn
naive pawn
unreal wigeon
naive pawn
#

fair enough

#

you would still have to use Approximately or just use ranges though

#

seems to me that using a range would just be easier in this case

azure beacon
#

@jade cobalt
If you want you could try this script I used for a couple of my games. Just attach it to each layer. Note it only supports x axis movement and will loop automatically. If you don't want looping just make sure your image is as wide as the level, if you do want looping copy the image 3 times under a parent object and put the script on the parent object to make sure it loops correctly.

using UnityEngine;

public class ParallaxLayer : MonoBehaviour {
    public float parallaxEffect;

    private Transform camTransform;
    private float startPosX;
    private float width;

    private void Start() {
        camTransform = Camera.main.transform;
        startPosX = transform.position.x;
        width = GetComponent<SpriteRenderer>().bounds.size.x;
    }

    private void FixedUpdate() {
        float distance = camTransform.position.x * parallaxEffect;
        float movement = camTransform.position.x * (1 - parallaxEffect);

        transform.position = new Vector3(startPosX + distance, transform.position.y, transform.position.z);

        if (movement > startPosX + width) {
            startPosX += width;
        } else if (movement < startPosX - width) {
            startPosX -= width;
        }

    }
}
naive pawn
#

that should probably not be in FixedUpdate

#

(just please don't spoonfeed in general)

azure beacon
#

Now that you said it idk why it is. I used it a long time ago and didn't see any problems back then.

azure beacon
naive pawn
#

theoretically it should happen every frame after the camera has updated, so i just put it in a list (dynamically updating upon load) to do callbacks on LateUpdate

naive pawn
azure beacon
#

@jade cobalt Please read it any try to understand it for yourself. Try putting a lot of comments in the code to explain to yourself what is happening, if you don't understand something google it or ask AI.
Doing this will help you learn to code better.

naive pawn
#

no please don't ask AI lmao

azure beacon
#

This script is simple enough for AI to understand i think...

naive pawn
#

AI doesn't understand shit lol

#

it's definitely small enough for AI to generate something convincing, but there's still no guarantees on it being correct lmao

azure beacon
#

Or ask here i guess

sour fulcrum
#

Code better by never using ai for help πŸ˜„

vast sparrow
#

hello i realized that i need a study partner can anyone be mine i cant code alone

naive pawn
#

not really the place to find that, no

#

!collab

eternal falconBOT
#

:loudspeaker: Collaborating and Job Posting

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

vast sparrow
naive pawn
#

help with.. what exactly?

vast sparrow
#

i dont really know how to code yeat

naive pawn
#

if you have a specific issue, you can just ask here

naive pawn
strong shoal
#

foreach (MonoBehaviour Child in transform.GetComponentsInChildren<MonoBehaviour>())
{
Child.UseAbilities(_enemyHealth);
}

#

is is possible to use a function from a Monobehaviour that was defined in the script

#

bc i dont want to get the script of the child itself bc i will have many different scripts

#

nvm

#

i did it

polar acorn
polar acorn
eternal falconBOT
#

:teacher: Unity Learn β†—

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

strong shoal
#

bc it wont work

polar acorn
strong shoal
#

with the thing that im trying to do

#

but anyways i did it

#

with an interface

polar acorn
proper needle
#

why does this happene in the new unity update

rich adder
#

what does what happen?

cosmic dagger
proper needle
#

nvm it still works normally

proper needle
polar acorn
#

That just raises further questions

azure beacon
#

What happens?!!!

polar acorn
proper needle
#

so basically void start is slightly darker like its a custom function

cosmic dagger
proper needle
#

it still works normally tho

azure beacon
#

Not used/empty i think

proper needle
slender nymph
#

if you mean it isn't being marked as a Unity Message then you need to make sure that your !IDE is configured πŸ‘‡

eternal falconBOT
proper needle
#

turns out it wasnt a monobehavior

#

sry guys

cosmic dagger
proper needle
cosmic dagger
eternal falconBOT
proper needle
#

i made the script a monobehavior and its working fine now

proper needle
thick sedge
#

interaction.WeCollide.gameObject.GetComponent<Rigidbody>().isKinematic = false;
How do I make it so the bool gets inverted if the function is executed

thick sedge
#

oh

rich adder
thick sedge
#

THANK you

solar arch
#

does anyone know how to get these textmeshes to render in the game view, the "Particle Canvas" that theyre a child of has a higher sorting layer than everything else. I instantiate them in run time which im assuming is affecting it

rich adder
solar arch
strong shoal
#

how would i get 9% of a value???

solar arch
rich adder
#

smart Mathf.Lerp(0f, value, 0.09f);

thorn stone
#

I have pretty big problem...

#

This is my script and so.

#

When I move it works normally.

rich adder
eternal falconBOT
rich adder
#

also dont use screenshots to share code

thorn stone
#

But I think something is broken because after releasing key it goes back to down view

thorn stone
rich adder
thorn stone
#

So what

rich adder
#

so its requirement to get help here

thorn stone
#

No I dont think so

#

It only states that you need to have IDE

rich adder
thorn stone
#

I dont care

rich adder
#

np lol
blocked list +1

thorn stone
#

np lol
blocked list +1

#

This guy thinks he is soooo tuff

median hatch
#

just configure your ide and shut up

#

bold of you to mock people who are trying to help

thorn stone
#

Oh no way! This guy gave emoji on my message!!! So scary and tuff

polar acorn
thorn stone
polar acorn
#

It's not just one person. No one here will help until you've done the bare minimum to make your tools actually function

thorn stone
#

He is that one person that just trolls

thorn stone
#

There were some guys that were helping me with something

slender nymph
rich adder
#

but yeah no time for this arse. goodluck ppl

thorn stone
#

No offense

median hatch
#

are there any mods to mute him?

thorn stone
thorn stone
median hatch
#

why dont you figure out the problem by yourself and then make a post on reddit on how the people on unity discord are super rude

median hatch
#

that might fix your ego

thorn stone
#

Ego?

#

The only one with ego top here is nav

naive pawn
thorn stone
#

The King Of Kings

thick sedge
#

InteractUI.SetActive(true);
if i wanna check if this UI is active how can i do it without typing it like this : InteractUI.SetActive(true); isUIActive = true;

thorn stone
eternal falconBOT
thorn stone
#

This was only response

naive pawn
#

you only need the link once

polar acorn
thorn stone
#

Yes I did.

naive pawn
#

did you click one of the links?

thorn stone
#

Yup

naive pawn
#

and did you go through all the steps to get your ide actually configured

thorn stone
#

Yup and half way it just crashed

polar acorn
naive pawn
#

cool, ask about that

naive pawn
thick sedge
naive pawn
#

assuming you mean left mouse click, yes

rich adder
#

πŸ’¨πŸ‘Ÿ

polar acorn
thick sedge
naive pawn
#

unless the primary was set to the right button, i guess. i should look into how that actually works

rich adder
#

Mouse0 = left
Mouse1 = right
Mouse2 = MiddleButton

naive pawn
#

it's not mouse2?

rich adder
#

ops

naive pawn
#

ah lol

rich adder
#

slippy fingers on kb

#

btw all that hostility b4 from this comment lol

naive pawn
#

mouse3 and mouse4 are also back/forward for mice that have those buttons

polar acorn
#

So, if you swapped it in your mouse settings, right button would be Mouse0

thick sedge
#

dumb question again
I want the function to only execute if the left mouse button is hold down, not pressed if that exists

naive pawn
#

Mouse0 aka M1 aka LMB aka Left click
Mouse1 aka M2 aka RMB aka Right click
Mouse2 aka M3 aka Middle click aka Scroll wheel
Mouse3 aka M4 aka Back
Mouse4 aka M5 aka Forward
Mouse5
Mouse6
WheelUp aka Mouse+ aka M+ aka Scroll up
WheelDown aka Mouse- aka M- aka Scroll down

i love words

rich adder
#

KeyDown is the pressed once thing

thick sedge
#

This server is better than reddit fr

rich adder
#

hah readdit has some funny answers

naive pawn
polar acorn
naive pawn
naive pawn
polar acorn
#

Well, that's not really fair. Twitter still exists.

naive pawn
#

no it doesn't smh my head

thick sedge
naive pawn
#

i mean you'd probably just get ghosted here

thick sedge
#

did i?

cosmic dagger
naive pawn
#

depends on how well your question is written, i suppose

rich adder
#

but not if its just "give me idea"

naive pawn
#

also yeah depends on the space

thick sedge
rich adder
#

something like
"Im doing x y but feels rough and maybe new idea for z to compliment x or y "

naive pawn
#

there are dedicated subreddits for game design

rich adder
#

yeah that place is just very wrongly answered questions or people show casing their game as "I quit my job so I made this in x months"

#

some gems here n there

thick sedge
rich adder
#

yaa.. dont forget keys! and doors to unlock

thick sedge
naive pawn
#

don't forget poorly-lit hallways

thick sedge
#

or ps2 graphics

naive pawn
#

huh? not really

rich adder
#

nahh Jumpscares...jumpscares out the ass..

#

people think "horror, ok I need jumpscares"

thick sedge
#

fr

rich adder
#

people forget Horror is more of a Mood

thick sedge
#

silent hill

rich adder
#

yeah anything that sets good mood of uneasiness without cheap tricks

#

think Exorcist (1973)

thick sedge
#

you telling me to go supernatural then huh

#

I am doing it

#

you hang out with friends then go to cemetery then you know what happens

polar acorn
#

Rather than creating something to "fix" a problem in another game, it's better to just come up with something you want. Be additive, not subtractive.

#

Rather than "Game minus problems"

thick sedge
polar acorn
#

I'm pretty sure that's exactly the kind of thing I said to avoid

thick sedge
#

dw

#

mathf.Lerp can be used for 3d too?

rich adder
#

mathf functions dont care if its 2/3d its just float functions

#

functions change a bit is physics function, eg Rigidbody vs Rigidbody2D

thick sedge
#

I figured it thank you

naive pawn
#

if you're using it for something actually 3d like a Vector3, you can use Vector3.Lerp, fyi

rich adder
#

you technically can use v3 for 2D it just omits the z to 0
Rigidbody2D rb ;
rb.position = Vector3.Lerp(pos1, pos2, t); valid

polar acorn
thick sedge
#

mathf.lerp can be used inside new Vector3() right?
new Vector3(Mathf.Lerp(a, b, t), matf.Lerp(a, b, t), you get it)

rich adder
#

again its just a float

polar acorn
#

it can be used as a float

rich adder
#

you can use it anywhere you put floats

polar acorn
#

because it is one

thick sedge
#

thanks again

#

for the 5th time actually

naive pawn
thick sedge
#

much simpler than the other way

sterile lintel
#

hi guys

naive pawn
thick sedge
#

a bool to turn true after a moment? Like this:
Destroy(gameObject, 10f);

#

but instead of destroying you turn a bool to a value true/false

tiny bloom
#

if a stop action on particle system is set to Destroy
it's causing an issue in multiplayer games where it's complaining why am I destroying an object from a client

how to fix this?

wintry quarry
tiny bloom
# wintry quarry Restructure things so the particle system object isn't owned by the other player

it's not, im just telling the server to destroy an enemy then instantiate the deathEffect, which is a particle system
and it's done inside an RPC

public class EnemyController : NetworkBehaviour, IDamageable
{
    public GameObject DeathEffect;
    public void Damage(float amount)
    {
        DestroyRpc();
    }

    [Rpc(SendTo.Server)]
    private void DestroyRpc()
    {
        if (IsServer)
        {
            Destroy(gameObject);
            var instance = Instantiate(DeathEffect, transform.position, Quaternion.identity);
            instance.GetComponent<NetworkObject>().Spawn();

        }
    }
    
}
wintry quarry
#

That doesn't make much sense

#

Does it do something besides just being a visual?

tiny bloom
#

how are other players gonna see it?

wintry quarry
#

You send an RPC to them and they spawn it locally

tiny bloom
#

i think i understand u
but since it's a coop game, meaning the host will be a player's machine

shouldn't all communication be with server?
that's my conclusion based on what I read

wintry quarry
#

Or they do so on their own when they see the enemy die

wintry quarry
naive pawn
#

"host will be a player's machine" is called p2p/peer to peer, nothing to do with the nature of the game

#

btdb2 is pvp and it's p2p

tiny bloom
#

ok so, if it's just visual
u spawn it on clients

if it's something that moves, like an enemy and needs to be synced across clients, it should be spawned on server
correct?

wintry quarry
#

If it needs syncing it should be a network object

#

Otherwise, it shouldn't

#

Basically all UI, visual effects, and cameras should not be network objects

tiny bloom
#

@wintry quarry
Thank you, it worked and i have better understanding rn of how things should be setup

thick sedge
#

I wanna thank each one that helped me make the draging system come true, and it doesn't have any glitches at all! (definitely the objects doesn't slip from the cursor then magically come to my hand again - or somehow for some reason i go upward and i cant go down because of an invisible platform under me)

#

what's game dev without glitches right?

naive pawn
keen owl
thick sedge
#

removed rb and it works good

rich adder
thick sedge
#

thats a problem for tmrrw

#

gn

rich adder
#

character controller is still a physics controller so OnTrigger works fine. The OnCollision doesn't but has its own function

thick sedge
rich adder
#

I've used CC for many years never did i need a rb to make trigger function work

thick sedge
#

one is without a rb the other is with a rb

#

i literally has to sacrifice one mechanic; Draging/picking

rich adder
thick sedge
#

or there is something in c# idk about

#

` public void OnTriggerEnter(Collider other)
{
WeCollide = other;
if (other.gameObject.layer == 8)
{
Name = other.name;
InteractUI.SetActive(true);
isUIActive = true;

    }
    if (other.gameObject.layer == 9)
    {
        DragUI.SetActive(true);
        rb = other.gameObject.GetComponent<Rigidbody>();
    }
}`
polar acorn
#

Is the CC moving into the ball or is the ball moving into the CC? Was this interaction triggered by .Move or by something's transform getting updated?

thick sedge
#

the item doesn't move no

polar acorn
#

So, the CC is moving into it by .Move?

#

Specifically, changing transform.position or other transform manipulations will not call OnTrigger methods

thick sedge
#

I am moving the character/player with WASD to the item to collect it

polar acorn
#

WASD is input

thick sedge
#

other than that I honestly don't know what y r saying

polar acorn
#

Movement, is movement

#

How are you moving the object

rich adder
#

What function do you use

thick sedge
#

there is a capsule that gets moved by WASD input, I move the capsule in First person to the item (which is fixed) then collect it using trigger from a capsule collider

polar acorn
rich adder
thick sedge
#

honestly, the player movement script is a Ctrl + c Ctrl + v

polar acorn
thick sedge
#

so I don't even know

rich adder
#

screenshot components on your player

thick sedge
#

`moveDirection = horizontalMove * currentSpeed;
moveDirection.y = verticalVelocity;

    characterController.Move(moveDirection * Time.deltaTime);`
polar acorn
#

So it's using .Move properly

thick sedge
#

ig

polar acorn
#

Can you show the inspectors of both the player and the thing with the trigger on it

thick sedge
#

interactable

polar acorn
thick sedge
polar acorn
thick sedge
#

there will be alot of items

polar acorn
#

Okay?

rich adder
#

Do you understand the purpose of isTrigger bool?

thick sedge
#

i will not be writing all those scripts for all of them

or am i missing something?

thick sedge
#

ig

rich adder
#

Are you sure because now I'm doubting how this thing was even working with RB

polar acorn
rich adder
#

You must been using OnCollisionEnter or sum

thick sedge
#

here is the thing that gets triggered with other items

#

some kind raycast

polar acorn
#

It's not a trigger.

Why are you expecting it to run OnTriggerEnter

thick sedge
#

but it isnt

polar acorn
thick sedge
#

OH

#

I NEED TO ADD RB TO THIS INSTEAD OF PLAYER

rich adder
#

No

polar acorn
rich adder
#

Waste of resources

thick sedge
#

nvm

#

glitches still happen

rich adder
#

Make the item you wanna pickup have an actual trigger collider

#

Put the pickup script where the player character controller is

#

If your item to pickup needs a collider to be collided with then also add a regular collider

thick sedge
polar acorn
#

There should be no rigidbodies

#

OnTriggerEnter runs on both objects when a character controller intersects with a trigger collider

thick sedge
polar acorn
#

Whatever you want to happen, you would put it on one of those objects

rich adder
thick sedge
rich adder
#

Oh....that's why it needed a rb..

#

You're detecting triggers using that trigger ?

thick sedge
#

not for interactables

rich adder
#

Idk what rb for draggable objects mean

thick sedge
#

its a multi task script so...

thick sedge
#

for physics

#

matter of fact if i sent you my full script u won't understand none

rich adder
#

I usually use casts so you'd have to explain what is even going on... If you are using sight to detect stuff for whatever reason then yes you'd need a rb as I don't think CC counts children collider for OnTrigg

#

You'd have to lock rotation and position on the RB though

#

It's messy but it works ig.. look into casts or even overlaps for the future tho

thick sedge
#

Thanks @rich adder @polar acorn @naive pawn

unique quartz
#

I have this error coming up and I don't know how to fix it, I copy pasted it from a tutorial as it said. I am also missing the "interaction_Info_UI" component in my inspector (The images provided is of the tutorial's inspector and my code). I am still a newbie so I am unsure what I have stuffed up for this error to happen, cheers!

polar acorn
unique quartz
#

sorry I had gone to sleep, I've just now logged on for the day

unique quartz
rocky canyon
#

the image on the left is only saying there is no InteractableObject.cs

#

perhaps theres more to the tutorial or u missed something?

polar acorn
unique quartz
#

the interaction UI bit in the image i provided

#

It's not there on my game, only the script thing

rich adder
polar acorn
# unique quartz

You cannot assign anything in the inspector until you fix your compile errors

#

Which brings us back to the question: what is InteractableObject?

unique quartz
#

i dont know how to

#

thats what im asking

polar acorn
#

What component are you trying to get on that line

#

What is InteractableObject

unique quartz
#

i dont know i just copied it from the tutorial

#

if i did i would answer

rich adder
#

so you missed a step

rocky canyon
#

then u missed something.. or he wrote the scripts out of order

polar acorn
#

So check the tutorial

#

You cannot solve the error until you actually have an answer for "What component are you trying to get"

#

You cannot get a component that doesn't exist

#

You're trying to get one named InteractableObject but it appears to not exist

#

So if that doesn't exist, what do you want

unique quartz
#

i want it to exist

polar acorn
unique quartz
#

how do i create it

#

it wasnt in the tutorial

#

i rewatched it

polar acorn
#

The same way you've created any file

polar acorn
#

Link it

rocky canyon
#

or it is in there

rich adder
rocky canyon
#

get ur counter ready

unique quartz
#

#survivalgame #tutorial #unity
In this tutorial series, we will create a 3D survival game with Unity & C# as the scripting language.
We will start with basic FPS movement, inventory building, and crafting systems.
Learn how to pick up items and more.
Little by little, we are going to add different features that are common to survival open-world...

β–Ά Play video
#

its after we make the text

#

around 7:30 or something

rocky canyon
rich adder
#

gottem

unique quartz
rich adder
#

it means you missed it but its there

rocky canyon
#

thats where he's creating the script...

unique quartz
#

im not up to there in the tutorial yet

rocky canyon
#

then he created an empty version earlier in the script..

#

or he makes it later

unique quartz
#

ok thank you so much i appreciate it!

polar acorn
#

Or in a previous part. This is part 3 and they're all an hour long

rocky canyon
#

facts

unique quartz
#

yes i've watched them all

polar acorn
#

I'll have to save The Counterℒ️ for later I'm on mobile data and I'm not loading 3 hours of YouTube on it to scrub through

rich adder
rocky canyon
#

ofc..

#

they need "community notes" on youtube πŸ˜‰

#

lol

polar acorn
twin pivot
polar acorn
rocky canyon
#

input class just voodoo to most ppl

polar acorn
#

DeltaTime for mouse movement makes the sad frog sad

rocky canyon
#

anyway.. good luck kickflip peanut butter πŸ€

rich adder
rocky canyon
#

what bout delta?

#

b/c <- ya kno. the delta.. ill see myself out

polar acorn
#

I don't get it

rocky canyon
#

when they finally deprecate the old system for good we'll never have this problem, i'll learn it by then.. lol

polar acorn
#

Oh, wait, the username delta

rocky canyon
#

ya, im lame it wasnt even funny

polar acorn
#

I just read that as a tent

rocky canyon
#

ohh snap!

#

thats even better lol

#

has anyone been using that AI tooling from unity.. or is that just for art stuff?

rich adder
#

the one in Unity 6.2 ?

rocky canyon
#

ya, built in in the toolbars

#

ah, nvm i bet thats editor only stuff

#

hence being in the editor πŸ€¦β€β™‚οΈ

rich adder
#

oh thats gonna be a paid sub anywaay no ?

rocky canyon
#

thats what ive heard

#

i was just curious how its changed anyones workflows.

rich adder
#

I hope that crap is just a seperate package we can remove, I'd like not to have ai infested app

rocky canyon
twin pivot
#

quick question, can I put methods in my SOs?

rich adder
#

ye

#

SOs are nothing more than regular classes with special functionality in unity

fluid blaze
#

beginner here need assistance fixing panels on my 2d game

slender nymph
#

!ask πŸ‘‡

eternal falconBOT
slender nymph
#

pay particular attention to the last few points

fluid blaze
#

ofc haha

viscid girder
#

!code

eternal falconBOT
livid anchor
#

Hello folks, I'm starting to learn unity dev by myself, and I'm trying to create a simple game (flappy bird).
I had a little question about the looping background, what's the best practice for that kind of things ? I found several solutions, some using transform, some using quads... But might as well start learning the good way to do it right ?

rich adder
#

transform stores the position, rotation and scale.. quad is just a shape

livid anchor
#

I'm just starting, I don't know what is a quad really. i'm just wondering what is the best practice in this case

burnt vapor
#

Same the other way around, destroy quads that got to the end

#

A performance improvement would be moving quads that reached the end back to the start and reuse these.

#

(btw Flappy bird originally doesn't even have a moving background, so it's hard to say what you want to actually achieve here)

sour fulcrum
#

the real best practice is whatever you find easier to do faster

onyx geyser
#

what's it mean when it says CharacterController is a type but used as a variable?

#

or like a variable

#

i'm following a tutorial because appearently there's nothing for the newest update, and despite turning on both new and old formats, i'm getting errors in places others aren't

#

it's made learning this program a bit difficult since nothing works right

#

even here, it's saying characterController does'nt contain the term move, i'm not sure if this is something i have to set up myself, but it seems fine in the tutorial

#

which, most of the tutorials have been exactly like this

clear juniper
#

what type is characterController?

#

can we see your whole script?

onyx geyser
clear juniper
#

right ok

#

so the issue is that you're using your class name there instead of a variable

onyx geyser
#

guh?

#

might need to explain what a class name is to me

clear juniper
#

okay so up at the top you've got public class

#

that's the class name - that's the blueprint essentially. Think of it like "human" or "apple", it's the type of thing

onyx geyser
#

pff

#

i feel stupid

#

still

clear juniper
#

this line here is getting your CharacterController from the object

#

it's putting it into a new variable of type CharacterController called CharacterController

#

however, that new variable only exists inside the curly braces

#

it doesn't exist where you're trying to move it

onyx geyser
#

that was the recommended fix by unity itself

#

i figured i'd go along with it until someone answered

clear juniper
#

so you want to have CharacterController CharacterController; outside the start method, next to all your public variables

#

then CharacterController = GetComponent<CharacterController>(); in Start

#

then CharacterController.Move( in Update

sour fulcrum
onyx geyser
#

ohh

#

ok

#

so don't trust it

sour fulcrum
#

consider it, don't assume it

eternal needle
#

You also shouldn't name the variable the exact same as the Type. Usually you would use camelCase here so
characterController

clear juniper
#

yeah I wasn't going to comment on that because it's an extra thing πŸ˜‚ get it working is the priority lmao

eternal needle
#

And now I also see the name of their class atwhatcost

onyx geyser
#

i feel like i'm understanding about half of this

#

at best

clear juniper
#

do this first then we can help you understand the rest πŸ™‚

onyx geyser
#

so where all the floats are?

eternal needle
#

You should 1000% drop what youre doing and go do some c# basics then. You shouldn't be struggling with both c# syntax and trying to learn a game engine

clear juniper
#

yeah that's right

eternal needle
#

There are pins in the channel for learning c#

onyx geyser
#

isn't C# and unity kind of different though?

clear juniper
#

you understand more

clear juniper
eternal needle
clear juniper
#

unity has a layer on top of it, but it's all still C#!

onyx geyser
#

figured maybe it'd be better to learn from just tossing myself into the fire, i get so bored trying to learn just fundementals

#

alright, CharacterController CharacterController; is in the start area

clear juniper
#

yeah that's a reasonable approach tbh

onyx geyser
#

why is it so different from the tutorial?

#

every tutorial i've found something was completely different

eternal needle
clear juniper
#

I don't know what tutorial you're following - but typically there is no one way to do things

onyx geyser
#

it's a first person camera

onyx geyser
eternal needle
sour fulcrum
#

sometimes you do have to get through the boring stuff

eternal needle
onyx geyser
#

y'all are not getting me, but that's ok

sour fulcrum
#

we are

#

i get why you jumped into it

#

its not working

onyx geyser
#

i said the tutorials weren't working, because i've had to type things a lot differently, they changed a lot of the terms, so some of it doesn't work the same way, which makes learning the tutorials hard

eternal needle
onyx geyser
#

i'm an artist, i draw, i skipped doing fundementals to just draw what i wanted, even if it looked god awful. 6 years later my art is pretty damn decent and i had fun, there are multiple ways to approach a project, you don't need to tackle fundementals EVERY time.

eternal needle
#

We are giving you realistic advice. If you wish to struggle through c# and unity at the same time, we have no power over that. Just know you will burn out much quicker when you struggle at literally every step. We've seen this many times by now

sour fulcrum
onyx geyser
#

then why's the advice i've received from others in the field to just 'go for it'

sour fulcrum
#

i am not others

#

Β―_(ツ)_/Β―

#

art does not have explicit rules, programming does

eternal needle
#

πŸ€·β€β™‚οΈ who are these others. They could've never touched unity for all I know

onyx geyser
sour fulcrum
#

you misunderstand what i mean by explicit rules

onyx geyser
#

alright, i'm done with this conversation, i don't wanna hear another word on fundementals.

clear juniper
# onyx geyser
public class characherController : MonoBehaviour

this bit is telling Unity that you're making something that can be attached to a gameobject (that's what : MonoBehaviour does) , and its name is characherController. Typically when we're naming classes, you want to start it with a capital letter - so in this canse it would be CharacterController - however, CharacterController is used by Unity so it might be better to call it something like PlayerController. You'll also have to rename the file


the section with the public floats (and now your CharacterController) is a list of all of the "properties" of your class. An apple has a size and a weight, for example - those would be floats. It also has a core, which isn't a simple number. Your code can "see" these anywhere else in the class


void Start ()

this is a Unity specific thing, it runs when the object is first loaded. You're using this to get the character controller that is attached to the same object - GetComponent<CharacterController>()


void Update()

another unity specific thing, this is called every frame.


This is just a very brief overview, but it's the sort of thing a C# fundamentals course would teach you!

sour fulcrum
#

your drawing cannot fail to compile

onyx geyser
# sour fulcrum your drawing cannot fail to compile

you're not getting it, that's still ok, you'll understand at some point maybe, because while art can't 'compile', it can look like utter dogshit, and no one will like it, and you'll have to keep going and repeating it until you manage to figure out how to fix it.

sour fulcrum
#

yes but thats my point

#

looking shit is not the same as not looking at all

#

your code does not work

#

thats not bad thats nothing

onyx geyser
#

if there is an error, you can look it up, use a tutorial, ask for help

sour fulcrum
#

we are suggesting you use a tutorial

eternal needle
sour fulcrum
#

the most relevant tutorial is the fundementals

onyx geyser
#

now, i don't want to hear another word on it, because this has been a pretty damn forceful

#

thank you.

sour fulcrum
#

that's fine, but it is worth mentioning servers like this and others will end up telling you the same advice if your not interested in learning the fundementals and still want help

eternal needle
#

Yea you really are going to get a lot of the same talks from many different people. Especially if youre clearly struggling with c# and trying to implement anything more complex

onyx geyser
#

dawg i said i was done hearing about it

#

i will go learn the fundementals when i want to, i don't have to do it right away, let me struggle, i like to struggle.

sour fulcrum
#

ok

#

maybe just dont ask for help until then

eternal needle
#

Then dont read our messages if you dont want. Neither of us pinged you on these last replies πŸ€·β€β™‚οΈ

sour fulcrum
#

if you dont know spanish and wanna write a book in spanish anyone willing to help is going to tell you to learn spanish

onyx geyser
#

do i need to go grab an admin or something? i've told you both repeatably to stop.

sour fulcrum
#

(you can choose whats on your screen)

onyx geyser
#

when it's flooding the conversation when someone IS genuinely trying to help, then it's a bit annoying, yes i can ignore it, but when i have two people telling me to go do something i already know i should go do but don't want to do yet, it get's pretty repetitive. and honestly burns me out far more than any 'struggling'

sour fulcrum
#

(the other person also told you to learn the fundementals)

onyx geyser
onyx geyser
#

all y'all have done was anything anyone else can do.

#

i'm far more appreciative of dom because he actually told me something that related to my question instead of saying "oh bro just go learn fundamentals"

eternal needle
onyx geyser
#

yes, thank for that, unfortuntely it was overshadowed by that blank profile and i got caught up.