#💻┃code-beginner

1 messages · Page 92 of 1

hardy fox
#

is taking damage

keen hinge
polar acorn
tawny cave
#

ah alright, I'll try to get rid of characterController later as I learn more then, thanks for notifying it

tender stag
#

is there any other easier way of doing it?

swift crag
tender stag
#

maybe just using a sphere cast

#

for fov

#

even tho that would kind of suck

polar acorn
keen hinge
eternal falconBOT
swift crag
#

I prefer to test if there's nothing in the way on the way to the player

#

You could also test if the raycast hits the player

#

Either works.

hardy fox
tender stag
#

but then i dont have the y value

#

its just horizontal

#

like flat

polar acorn
swift crag
hardy fox
meager gust
short hazel
#

Unless the code they've shown is different from what they've written enemy cannot be null, it's guarded by the if statement

polar acorn
hardy fox
swift crag
meager gust
#

@hardy foxI suggest you take the next few days and actually learn C# instead of just trying to get people to solve your problems for you

#

because what you're doing right now clearly is not working

hardy fox
meager gust
#

if you can spend this much time in discord, you can take 30 minutes a day to read the C# docs

hardy fox
#

i havent made any chnages

eternal needle
hardy fox
swift crag
#

cart before horse.

hardy fox
#

can i ask why you guys use Unity rather than other engines like UNreal

polar acorn
#

learning C# is how you'll get past this error

eternal needle
meager gust
#

I know thats what you're thinking

#

unity is by far the easiest 3D game engine

polar acorn
keen hinge
#

I'm so sorry for interrupting, I looked at the modifying page for MVS, and it already has Game Development with Unity selected. I'm still not seeing anby red underlines with my errors, though, and I'm mnot sure what to do to fix it.

hardy fox
short hazel
hardy fox
keen hinge
short hazel
#

It's 1am lol, so someone else will take the lead if you have more issues with it

meager gust
#

I don't know whats more beneficial to you

keen hinge
hardy fox
#

not just game design wise, in the future i wanna do CyberSecurity or something like that

#

so wondering which langauge is better to learn at a yyoung age

teal viper
#

English

keen hinge
#

I'm currently in school for cyber security. Your best bet is Javascript and HTML just so you understand the basics of web design, before you begin to attempt to learn security. That's what my school told me to do.

hardy fox
keen hinge
#

Also, I am in my first semester of school for it. Correct me if I'm wrong.

hardy fox
meager gust
#

this is a game development discord

#

not an html cybersecurity discord

teal viper
hardy fox
#

Anyone know if game design actually pays well?

meager gust
eternal needle
twin bolt
#

I have an issue with the code in my test build, my build shouldn't have any playerprefs on first launch, but apparently it does, to my script atleast. Here is the code void Start() { if(PlayerPrefs.HasKey("ActiveScene")) { PlayerHasSave = true; } }

teal viper
twin bolt
keen hinge
meager gust
eternal needle
hardy fox
#

@meager gust dw as soon as I figure out my current error, I'll release my game and you'll be able to play the best game made in unity by a noobie🥱

eternal needle
#

or they meant specifically like "making a secure web app" where you arent vulnerable to basic stuff like sql injections.

keen hinge
#

Yeah I have a different advisor now, my old one wasnt specifically a CIT advisor

hardy fox
twin bolt
frosty hound
#

Yes, it's all the same location

twin bolt
frosty hound
#

It's not in your editor. Player prefs are a file.

teal viper
#

Or rather an entry in a file(registry).

eternal needle
# hardy fox In cyber security do u use ruby (idk what it is lol)

there is no predefined language for it, people use whatever they want if it fits their requirements. This applies to almost everything coding related. security has many different aspects. You said you wanted to do cyber security, but you havent done the basics so it doesnt make sense to already have chosen a field. Anyways yea this isnt unity related at all

twin bolt
#

My build, fetched a old scene named "1.21 Decision", the Value of the same key, is "1.1 Begin" in the editor.

teal viper
twin bolt
teal viper
#

No.

eternal needle
twin bolt
hardy fox
eternal needle
meager gust
timber tide
#

I like money tho

sour fulcrum
meager gust
#

that's not what I'm trying to say

timber tide
#

How else am I going to buy all those unity store assets

teal viper
#

Hmm... Did they change the playerprefs in the last few versions. I remember the editor having the same storage location as the build.🤔

hardy fox
#

Guys one thing I've always wondered, if you are good at Cyber security does that mean you have the skill to hack ?

meager gust
#

dear lord dude

#

this isn't a cyber security discord

hardy fox
#

Just a question

calm pawn
#

im making a 2d topdown minecraft like and I need some help with shading, I want it to look like terraria's shading. I have no clue what to do pls help

timber tide
#

you load up ghidra and search by strings

#

hackerman

hard glen
#

How do you detect that a client has disconnected from server?

meager gust
#

if server hasn't received a message from client in 10 seconds, he's probably disconnected

hard glen
timber tide
pulsar lodge
#

!code

eternal falconBOT
pulsar lodge
#

https://gdl.space/ivuyiqepez.cs Hey guys, am i missing something? For some reason i cannot assign an On Click event method, I am trying to assign it to the ClickedOn() Method, but the list only has MonoScript: String name.

summer stump
#

You need to drag in a GAMEOBJECT in the scene with the script

pulsar lodge
#

oh damn, i named the script the same thing as the object and accidently did that, thanks!

summer stump
pulsar lodge
#

Its a prefab

summer stump
#

A prefab is a blueprint, so it will not know which scene object to use at runtime unless there is a transform relationship (like a child object)

pulsar lodge
#

Probably some dumb mistake somewhere in there, my brain is fried trying to get this done by Sunday for a class lol

summer stump
#

You cannot drag a prefab in unless it is a child

pulsar lodge
#

Im instantiating the object in the manager

summer stump
#

The script is ON the same object, right?
Just drag that component from itself

summer stump
summer stump
#

Maybe I'm misunderstanding you. Is that what you were trying already and THAT is not working?

sour fulcrum
#

(that png seems broken on my end atleast)

pulsar lodge
#

Let me restart, Currently i have it set up like this (first screenshot) InventorySlot Script is on the Inventory Slot game object prefeb, The On Click() is populated with the correct method now, When i run the game, the list is populating, but when i click on the list which should then display the item description that on click event is not working

summer stump
#

Ah, it was a remix and worked for a second. Weird it turned into a dl link

pulsar lodge
#

Actually, hold that thought, i think there might be something broken with my player inventory script. thats probably why its not populating

#

its not pulling the data from it, just putting the placeholder text up

#

let me look at that

fierce wasp
#

Hello, where do I go for questions on a problem I have in my unity project?\

pulsar lodge
#

Ok, i fixed that, but thats not what was causing the button to not trigger the on click event

#

so it populates the inventory list, but when clicking them, that function is not being called

torpid steeple
#

Hello I have an issue with my code in a tes build I made for a type of spiderman swingin, Basically it lets the player swing and does a swing motion but iut drags the player down and when it reaches the halfway mark it stops and starts spinning/tweaking, is there anything i could do to fix it?

pulsar lodge
meager gust
#

People aren't mind readers

torpid steeple
#

my bad

#

how do I post the code?

meager gust
#

!code

eternal falconBOT
torpid steeple
#

this is the code I have my bad again I just joined last night

pulsar lodge
true heart
#

i have a code that takes an object prefab thats on a list deletes itself from that list and sends it as an object to another list. The problem is that i want to send the objects prefab and not the object itself so i can delete it and still have it on the list. Is there a way for me to send image gameobjects prefab to the list and not the object itself?

ivory bobcat
ivory bobcat
timber tide
#

My head hurts reading the question, but if you're trying to keep the reference to the prefab on the instantiated object, then you can just make a variable for it and insert it into it when you instantiate the duplicate.

#

Actually, probably can just set it on the prefab of itself?

opaque eagle
#

Would this be where i would ask for help in a beginner level?

timber tide
formal escarp
#

Most baby coders ask for help in here.

#

OMG MAO HII

ivory bobcat
opaque eagle
#

I can’t use playfab

ivory bobcat
cunning needle
#

Hi! sorry stupid question, im a beginner to unity and i just sliced a sprite sheet and made a player GameObject, i added the sprite renderer component and i cant figure out how to add the animations

tacit pumice
#

I want to get a game object to follow me when I get close and to stop when you get away from it you and roaming ya know just a generic enemy ai but I’m confused by the ; and { stuff

ivory bobcat
tacit pumice
#

I’m new to this stuff just struggling here

ivory bobcat
ivory bobcat
summer stump
ivory bobcat
#

ie the following, the range detection, the roaming etc

fiery notch
#

Hey I wanted help on a dash mechanic for my game, here is how i coded it. I am using Unity 3d. There are two things im having issues with.

  1. I want to be able to dash in the direction my player is facing, right now, they only dash to the right.
  2. I want to be able to turn off gravity during the dash, and turn it back on once the dash is completed.
    Please let me know if you can help!
summer stump
summer stump
fiery notch
summer stump
summer stump
#

Don't have it inside the new Vector3

fiery notch
#

so how would you rewrite that line of text?

summer stump
#

rb.velocity = transform.forward * dashingPower

#

Could also do AddForce

fiery notch
#

ok so my game looks like this

#

im using unity 3d but on a 2d space

#

when i use forward i launch myself the wrong way

summer stump
fiery notch
#

perfect

#

it works thanks

tacit pumice
summer stump
tacit pumice
#

Yep

fiery notch
summer stump
summer stump
tacit pumice
summer stump
formal escarp
#

Hey guys. I am having some errors with my code but im unsure how to fix them. this is my code. im tyring to create random movement for a gameobject.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class MovimientoRandom : MonoBehaviour
{
    public float Timer;
    public int Objetivo;
    public float velocidad;
    public NavMeshAgent Nav;
    public Vector3 Target;
    void Start()
    {
        Nav = gameObject.GetComponent<NavMeshAgent>();
    }

    // Update is called once per frame
    void Update()
    {
        Timer += Time.deltaTime;
        if (Timer >= Objetivo)
        {
            Objetivo();
            Timer = 0;
        }
    }

    void Objetivo()
    {
        float myX = gameObject.transform.position.x;
        float myZ = gameObject.transform.position.z;

        float xPos = myX + Random.Range(myX - 100, myX + 100);
        float zPos = myZ + Random.Range(myZ - 100, myZ + 100);

        Objetivo = new Vector3(xPos, gameObject.transform.position.y, zPos);

        Nav.SetDestination(Objetivo);
    }
}
fiery notch
summer stump
summer stump
#

Rigidbody is the type (a concept)
rb is the specific Rigidbody attached to your player

summer stump
#

Ah, two things.
Objectivo is an int at the top, but then you try to set a Vector to it

#

You need something of the type Vector3 to assign a Vector3 to it

formal escarp
#

i fucking hate NavMesh

summer stump
fiery notch
#

this is a weird question, but I wanted some advice. How would you reccomend I go about adding this type of thing into my game? What im specifically referring to is a spike jump, where if you hit down at a spike or enemy, it will propel your character up.

summer stump
frosty hound
#

You already know if you're hitting the spike, since you'd be taking damage. Now instead of taking damage right away, first check if the player is using a down strike. If so, give them upward velocity, if not, take damage as usual.

summer stump
#

Oh, to avoid damage. Got it

fiery notch
#

ye

#

ok cool

#

how should i go about making a "strike" ? how would i go about adding a sword, and making it swing. For the controls I want down arrow to be down strike and side arrows for forward strike I dont want anything fancy, something super simple.

waxen adder
#

Current state of my maze generator. Originally based off of: https://www.youtube.com/watch?v=_aeYq5BmDMg&ab_channel=KetraGames

But then it went through many tweaks. Trying to see what more I can do with it right now. As a player, I feel like something like this would be overwhelming, so I was thinking about encouraging straight pathways more

In this tutorial we're going to look at how to procedurally generate a perfect maze.

The project files are available to our patrons here:
https://www.patreon.com/posts/84948773

The final script can be found here
https://dotnetfiddle.net/krlgdG

Help support our work:
► Patreon: https://www.patreon.com/ketragames

Follow us:
► Ketra Games: ...

▶ Play video
#

Oh, I should probably mention I would like advice on how to make it better

keen hinge
#

Hey, so I have changed my settings, so it should be showing my errors, and I'm still seeing, "No errors" on the dialogue bar. Any advicew is greatly appreciated.
https://gdl.space/fadeleyuma.cs

calm coral
calm coral
#

Actually never mind, you have a semicolon at the end of line 72 @keen hinge

#

what a crime...

#
private void OnTriggerEnter(Collider other) // here was a semicolon
{
    gameOver = other.gameObject.CompareTag("GameOverTile");
}
```Remove the semicolon, I'd write it like that @keen hinge
keen hinge
#

So now I only have two errors. I really really appreciate the help.

summer stump
#

Not SerializeDField

#

And nothing is SerializeFieldAttribute

keen hinge
#

I'm going off of the videos my professor has posted in order to make the game, I would assume that it is something he will cover in the future.

summer stump
#

This makes me think your IDE is not configured. Did it underline this error?
Or did you only see it in the unity console

keen hinge
#

The only reason I'm asking here is because hes out of office at the moment.

cosmic dagger
keen hinge
#

I don't believe I have an IDE, And I've attempted to do everything in the guide given by the server.

calm coral
#
void OnDisable() // in InputManager class
{
    cameraToggle.performed -= CameraControl.Instance.ToggleCamera;
}
```Hey, do you have any idea how can I get rid of null here? `CameraControl` is a singleton, I guess I need it somehow to get destroyed after `InputManager` is being destroyed? It tells me that `CameraControl.Instance` is null
keen hinge
keen hinge
#

Microsoft Visual Studios

magic hawk
#

Can anyone try to help me understand Persisting Data/Singletons? Trying to have some pickups in a game stay the amount you collected and transfer from scene to scene. (blah blah blah)

calm coral
dawn rampart
#

can somebody help me with this movement that im trying to implement?

summer stump
#

And nothing being underlined means it is not configured

#

!ide

eternal falconBOT
summer stump
summer stump
dawn rampart
eternal falconBOT
summer stump
#

Oh... don't crosspost btw. Only one channel per question please
Either this or InputSystem may be best

dawn rampart
#
    PlayerManager player;
    public float verticalMovement;
    public float horizontalMovement;
    public float moveAmount;

    private Vector3 moveDirection;
    [SerializeField] float walkingSpeed = 2f;
    [SerializeField] float runningSpeed = 5f;
    protected override void Awake()
    {
        base.Awake();

        player = GetComponent<PlayerManager>();
    }

    public void HandleAllMovement()
    {
        HandleGroundedMovement();
        // Aerial Movement
    }

    private void GetVerticalHorizontalInput()
    {
        verticalMovement = PlayerInputManager.instance.verticalInput;
        horizontalMovement = PlayerInputManager.instance.horizontalInput;

        Debug.Log($"Vertical Input: {verticalMovement}, Horizontal Input: {horizontalMovement}");
        // Clamp the movements
    }

    private void HandleGroundedMovement()
    {
        GetVerticalHorizontalInput();

        moveDirection = PlayerCamera.instance.transform.forward * verticalMovement;
        moveDirection += PlayerCamera.instance.transform.right * horizontalMovement;
        moveDirection.Normalize();
        moveDirection.y = 0;

        if(PlayerInputManager.instance.moveAmount > 0.5f)
        {
            // Move at a running speed
            player.characterController.Move(moveDirection * runningSpeed * Time.deltaTime);
        } 
        else if(PlayerInputManager.instance.moveAmount <= 0.5f)
        {
            // Move at a walking speed
            player.characterController.Move(moveDirection * walkingSpeed*Time.deltaTime);
        }
    }
keen hinge
summer stump
#

So, you have some PlayerInputManager that would probably be the issue

dawn rampart
#

in the GetVerticalHorizontalInput it isnt logging correctly

summer stump
keen hinge
#

I don't know what just happened I was trying to get it to underline errors and it did that

summer stump
#

And as I said earlier, no such thing as SerializeFieldAttribute

dawn rampart
#

    public static PlayerInputManager instance;
    PlayerControls playerControls;

    [SerializeField] Vector2 movementInputs;
    [SerializeField] public float verticalInput;
    [SerializeField] public float horizontalInput;
    [SerializeField] public float moveAmount;

    private void Awake() 
    {
       if(instance == null)
       {
            instance = this;
       }
       else
       {
            Destroy(gameObject);
       }
        SceneManager.activeSceneChanged += OnSceneChanged;
        DontDestroyOnLoad(gameObject);
    }

    private void Start() 
    {
        DontDestroyOnLoad(gameObject);

        instance.enabled = false;
    }

    private void OnSceneChanged(Scene oldScene, Scene newScene)
    {
        if(newScene.buildIndex == WorldSaveGameManager.instance.GetWorldSceneIndex())
        {   
            instance.enabled = true;
        }
        else
        {
            instance.enabled = false;
        }
    }

    private void OnEnable() 
    {
        if(playerControls == null)
        {
            playerControls = new PlayerControls();
            playerControls.PlayerMovemenyt.Movement.performed += i => 
        {
            movementInputs = i.ReadValue<Vector2>();
            Debug.Log($"Input Received: {movementInputs}");
        };
        }

        playerControls.Enable();
    }

    private void OnDestroy() 
    {
        SceneManager.activeSceneChanged -= OnSceneChanged;
    }

    private void Update() 
    {
        HandleMovementInput();
    }

    private void HandleMovementInput()
    {
        verticalInput = movementInputs.y;
        horizontalInput = movementInputs.x;

        moveAmount = Mathf.Clamp01(MathF.Abs(verticalInput) + Mathf.Abs(horizontalInput));

        if(moveAmount <= 0.5f && moveAmount > 0)
        {
            moveAmount = 0.5f;
        }
        else if(moveAmount >= 0.5f && moveAmount <= 1)
        {
            moveAmount = 1;
        }
    }
keen hinge
#

I am just going off of what my professor has told us to do, he might fix it, or he might make it something

keen hinge
#

I'm confused, this is code beginner

summer stump
keen hinge
#

Ah, sorry

summer stump
#

The one where I told you why you have errors and how to fix it, all in two words 😄

summer stump
#

Oh, I'm dumb, mixed up people

keen hinge
#

I'm so sorry I don't understand

summer stump
keen hinge
#

That fixed it, thank you so much

#

im sorry

summer stump
# dawn rampart THis is it

Ok, so. Just trying to read through it (i'm on my phone. Also, with that length of code you would generally use a paste site like the bot said. That makes it easier to parse).

So you have logs in both scripts. One is saying one value, and the other is saying something different?

dawn rampart
#

but idk what

paper silo
#

hello

#

i want to start creating games but idk how to start

eternal falconBOT
#

:teacher: Unity Learn ↗

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

paper silo
#

what language do i need to learn?

summer stump
summer stump
paper silo
#

C#?

#

That name scares me haha 😆

paper silo
#

They say C# is difficult

summer stump
summer stump
timber tide
#

C# probably one of the more beginner friendly languages so good time to start

paper silo
#

i only know they have a c at the start

summer stump
paper silo
#

ooh yeah

dawn rampart
timber tide
#

everything is usually built on c++ (well, C rather by influences from concepts from C++)

#

so you get a little bit out of that learning C# :)

paper silo
paper silo
#

I'll try to go from Python to C# then.

#

I will try to learn

dawn rampart
summer stump
paper silo
#

The bad thing is that there aren't many C# courses in Portuguese, and my English isn't the best tbh

#

but ill try it

summer stump
dawn rampart
dawn rampart
# summer stump Sorry, I keep looking but nothing jumps out at me. I am not sure. Hopefully some...

doing thishttps://www.youtube.com/watch?v=Xg6GvHpWjaE

In this video we begin by building a small play test arena. After, we add Unity's Input system to our project. We then learn how to set up inputs using our newly created input functionality. We end by creating some player classes which will be used to begin controlling our player character.

► Skip Arena Creation 4:38

► Gridbox Prototype Mater...

▶ Play video
paper silo
#

What can C# do?

#

besides games

#

or smth like dat

dawn rampart
paper silo
summer stump
dawn rampart
# paper silo cool

once you learn how to code with the data types usally other languages get a lot easier

timber tide
#

databasing is pretty popular with C#, but applications for both desktop and phone appsit's pretty good at too

paper silo
dawn rampart
paper silo
#

can i create python libs with c# ?

timber tide
#

there's usually libaries for python support. Unity has some but it's not enough to allow you to completely write your games in python. I use it for parsing stuff and editor specific scripting.

dawn rampart
calm coral
#

It's 135 seconds though, not 100 beluga

true pasture
#

(moved that to unitytalk)

teal viper
# paper silo What can C# do?

Mostly anything. In our age, almost any programming language can do almost anything. And what it can't, it can achieve via native libraries.🤷‍♂️

summer stump
dawn rampart
#

player manager script

PlayerLocomotionManager playerLocomotionManager;
    protected override void Awake()
    {
        base.Awake();
        // Do more stuff only for playerManager

        playerLocomotionManager = GetComponent<PlayerLocomotionManager>();
    }

    protected override void Update()
    {
        base.Update();
        playerLocomotionManager.HandleAllMovement();
    }
fiery notch
#

how do i make anim work? if i click my down arrow key, i want my "DownMelee" animation to trigger

#

a lot of things arent working so idk how to get it to work

ivory bobcat
#

Fix one thing at a time.

#

Look at the console errors.

fiery notch
#

I dont know how to fix any of it

#

ive never done this before

ivory bobcat
#

What are they?

fiery notch
ivory bobcat
#

Where did you get this code?

fiery notch
#

im just looking for a way to play my animation

ivory bobcat
#

Theirs inherit a Character class.

fiery notch
#

right

#

i dont know where to go lmao

#

i have been on google

ivory bobcat
#

Lookup a tutorial and follow it exactly as is.

#

You'll not be able to randomly paste code together and have it working properly without knowing how the code works.

fiery notch
#

when picking a positive button

#

how do i select left click

#

not sure what the exact name for it is

fiery notch
#

ok sweet

summer stump
dawn rampart
#

Number 3

teal viper
fiery notch
#

ok so now i have this

#

but when i click play

#

it clips me into the ground?

dawn rampart
fiery notch
#

im having an issue, where the animation keeps constantly playing, not when i click the down arrow key

summer stump
# dawn rampart Should I just completely restart?

Well, I'm not seeing the issue (sorry, I'm also kinda busy at the moment, so I'm not devoting my full attention to it).

I'd say it depends. How much experience do you have? This seems kinda more complex.
I think it would be worth it to start a blank project and just test out the new Input system by itself. Just get something moving around. Then come back and see how it goes. Maybe restart the video series at that point?

dawn rampart
summer stump
dawn rampart
#

No worries

true heart
#

im making a grapple hook in my game and have nerver worked with raycasts before. the code should be taking my player position then making a line to my mouse but When i run this code the raycast that im making is always giving me no hits even if i point my mouse straight at an object with a trigger collider2d.

verbal dome
#

Or directly use Camera.ScreenPointToRay to get the ray from Input.mousePos

#

Also ray takes a position and a direction, not two positions

true heart
#

how do i convert mouse position to world coordinates using Camera.ScreenToWorldPoint?

verbal dome
#

It's pretty simple. cs Vector3 mouseWorldPos = cam.ScreenToWorldPoint(Input.mousePosition);

#

You need a reference to your camera to use it

true heart
#

oh i see also what exactly is the difference between world coordinates and screen space doordinates

verbal dome
#

Well, screen space coordinates are in the range (0, 0) to (screen width, screen height) in pixels

#

From corner to corner

#

World coordinates are, well, just that. Measured in units in the world

true heart
#

oh i see k well ima try using what you told me to do and see if it works and ty for the help

fiery notch
#

I need help on one more thing.
I only want to be launched up when the sword hits the spikes, not when the player hits the spikes.
How do i go about this?

summer stump
verbal dome
#

I think you can just check the contacts from collision and see which collider was hit

#

I always forget if it's contact.otherCollider or contact.thisCollider...

#

I'm assuming that the sword is a child of the player.
If not, do what Aethenosity said

true heart
verbal dome
true heart
#

oh let me chaneg that rq

fiery notch
true heart
summer stump
verbal dome
true heart
#

ya

verbal dome
#

Show me?

fiery notch
verbal dome
#

@true heart You are currently casting a ray from the grapplestartpos to your camera, pretty much

true heart
summer stump
true heart
#

it is there its just not detecting it hit anything

verbal dome
# true heart

Oh, it's a 2D game. You need to use Physics2D.Raycast

true heart
#

oh

verbal dome
#

At least if your colliders and rigidbodies are 2D versions

true heart
#

ya the yare

verbal dome
#

Look how the 2D raycast works, it's a bit different but not too much

fiery notch
true heart
summer stump
fiery notch
#

right

#

lol

#

i just dont know how to go about this

#

not sure how to have a child move the parent

summer stump
eternal needle
#

yea addforce, i didnt scroll up to see if this was a rigidbody

fiery notch
#

im still confused

#

my player has a rigidbody, not the sword

summer stump
# fiery notch im still confused

in the sword script:

public PlayerScript player;
void OnCollisionEnter(Collision collision)
{
  //your check
  player.AddForceFromSpikes();
}
#

player would have a method that just... adds force to itself

#

I mean, I just wrote my code to be extra clear though

verbal dome
#

If the sword is a child of the player, it won't work. Collision messages get sent to the object that has the rigidbody

summer stump
#

Thanks for confirming it

verbal dome
fiery notch
summer stump
#

I was just about to link that haha
Osmals idea is good

fiery notch
#

if you could walk me through it i would be down

verbal dome
#

Again, not sure if contact.otherCollider or contact.thisCollider is the right one

#

I only remember it being confusingly named

nimble scaffold
#

Guys I finally made my fps game multiplayer.....

fiery notch
#

ok so do i put this text in my sword script, or my player script?

nimble scaffold
#

Thanks for the support

verbal dome
fiery notch
#

here?

nimble scaffold
#

And guys I want to do a system that the mouse would not be locked in the game for first 10 sec how to do that?

verbal dome
eternal needle
nimble scaffold
#

What's a coroutine ?

fiery notch
#

ok

verbal dome
fiery notch
#

ye

fiery notch
#

i just saw

verbal dome
eternal needle
#

you should still use get contacts tbh, .contacts produces garbage iirc

fiery notch
verbal dome
#

I gtg for a moment, someone else can probably guide you if needed.

verbal dome
eternal needle
fiery notch
eternal needle
pulsar lodge
#

after a while of debugging, i have figured out what my issue is and it may be UI related and not Code related, Any thoughts? When testing an image with button component and I set a highlighted color, when i mouse over it, it is not highlighting as if it is not interactable, Im essentially trying to get this OnClick() method to run when i click one of these images set with a Button component

eternal needle
fiery notch
#

wdym

eternal needle
pulsar lodge
#

thats exactly the problem i think, damn

eternal needle
# fiery notch wdym

🤷‍♂️ its your game, what do you want to do now if you detected its a sword

fiery notch
rich summit
#

Is there code I can make that would be able to change the Alpha of a UI element?

eternal needle
# fiery notch is this what u mean?

read the underlined text on that if. If thats the logic you wish to do, then sure. Id check if the tag was "Spike" before all of this though

slender nymph
eternal needle
# fiery notch

yes it is unreachable, if you arent sure what this means i really just advise you do basics of c# before unity

fiery notch
#

sorry

#

after it

#

like that

eternal needle
fiery notch
#

ok so from here

#

what do i do?

#

i have bool isSword

#

but i havent used it

verbal dome
#

The idea was to check if isSword is true after that foreach loop

#

You can also do the logic inside the loop like you currently do and get rid of the isSword variable

fiery notch
#

ok so i have this

#

idk whats next

eternal needle
#

test if what you have works

fiery notch
#

it isnt working?

ivory bobcat
#

What's not working?

eternal needle
#

is that a question or a statement, what part specifically isnt working

fiery notch
#

like nothing is happening

#

when the sword hits the spike

eternal needle
#

what debugging steps have you taken, to check which part isnt running

fiery notch
#

i dont know what to debug

#

how is this code even checking for my sword child?

#

is it because the names match?

eternal needle
# fiery notch is it because the names match?

if you arent sure what any of the code here does, go step by step through each part and try to find what they do on the docs. Go in order, look at what collision is on the docs, look at what the contacts provides as information

#

ask if you are unable to find anything online

fiery notch
#

this one?

eternal needle
# fiery notch this one?

normally id answer, but you should really learn to google without second doubting yourself. you can see the type of the variable when you hover over it in your IDE

rich summit
#

Err I'm trying to make it so that an accessory image appears on the UI via alpha, why isn't this working?

rich summit
slender nymph
#

you need to copy the entire color

fiery notch
eternal needle
# fiery notch ok im reading on it, but i dont know where to start for the debugging, like i sa...

well realistically any of the people who helped you would have this working. I really feel like you skipped out on the very basics of c# and that is why you are very confused on whats being done.
You'll want to debug anything useful to see what variables are, or if the code is even running.
In the code, you're trying to see if the sword was hit, so one thing could be to debug the .name of the game objects you are comparing. Maybe you are comparing the wrong object.
Next to check the 2nd if statement, debug the tag of the object. If it's what you expect ("Spike") then there must be a problem with how you are adding force. Debug what jumpForce is, or if the rigidbody is the correct object as well

fiery notch
eternal needle
eternal needle
fiery notch
#

do i have something wrong here?

languid spire
#

yes, sword is a prefab not a gameobject

fiery notch
#

is that better?

languid spire
#

yes

fiery notch
#

ok it didnt fix anything

slender nymph
#

it would be even better if you weren't comparing contacts against a specific gameobject and instead using something like a tag or checking if it has a specific component type

languid spire
eternal needle
queen adder
#

Why not just use on collisionenter?

slender nymph
#

they are

slender nymph
winged gazelle
queen adder
#

Oh, yeah, i just didnt realize the foreach loop was in it

#

But..why the foreach loop?

#

Cant they just compare the tag on collision?

#

Cause i mean, if you collided with somethin like a spike, it really doesnt matter how many points you've just collided with it, right?

eternal needle
winged gazelle
slender nymph
#

yeah but it would still be better to check a tag or for a component, not compare it to a specific gameobject

eternal needle
#

im pretty sure Osmal said something awhile ago about needing to do thisCollider instead, which is why i asked to see what their debugs were before. They havent shown any so i assume they did not use debug.log

slender nymph
#

well they are using otherCollider and while that seems like it would be wrong, it is actually the collider that was hit by the incoming collider

queen adder
#

No need to get unnecessary references

eternal needle
fiery notch
#

what are u asking me to show? using debug.log?

#

nothing is happening when i do

true heart
#

if i use a if stattement and in the statment i write if (this is true || this is true && this is true) does it mean that the first one could be right or the last 2 could be right or does it mean one of the first 2 ones have to be right and the last one also has to be right

slender nymph
eternal needle
verbal dome
#

To differentiate between child colliders

eternal needle
winged gazelle
#

this is probably a stupid one, but none of your colliders are marked as triggers right? because if so it'd be OnTriggerEnter and not OnCollisionEnter

queen adder
# fiery notch

I really do suggest you watch some videos about unity debugging

languid spire
#

the whole logic is wrong anyway, the Spike test should be outside the for loop

fiery notch
eternal needle
#

🗣️ start debugging

fiery notch
#

literally dont know what to debug here

queen adder
#

Bc its such a basic thing to do (in this case) and you're struggling with it. Not saying thats bad, all of us been there

queen adder
true heart
eternal needle
winged gazelle
#

what happens if you do debug.log(collision.contacts) or anything outside of the checks, does it log the collision happening

fiery notch
#

what does this mean?

#

looks like its checking somethign with my ground?

teal viper
#

You should cut the screenshot even more for us to not see any context
*Sarcasm

fiery notch
teal viper
#

It shows the value of the contact.OtherCollider.gameObject variable

fiery notch
#

i mean heres what im looking at

#

but what is the ground part for

winged gazelle
#

use a debug.log instead of debug mode for this stuff

winged gazelle
teal viper
fiery notch
#

gotcha

fiery notch
#

like this?

winged gazelle
#

yes

#

or

#

or collission.gameobject.tag

eternal needle
winged gazelle
#

oh mb

shrewd swift
#

How does "Start coroutine" works ?
What is exactly the "method name" input ? A function ?

winged gazelle
#

an IEnumerator

verbal dome
shrewd swift
#

My goal is to setip a "wait until"

shrewd swift
#

Im fairly new to c#, how would you explain a IEnumerator ?

#

Is it just like a Enumerator in cpp ?

#

Seems a weird concept

verbal dome
#

It's like a method that unity uses to build a Coroutine class. I don't know the details of it

winged gazelle
#

// calls the coroutine
StartCoroutine(myCoroutine());


private IEnumerator myCoroutine()
{
    // do stuff before timer
    yield return new WaitForSeconds(//amount of time);

    // after timer stuff
}
verbal dome
#

Anyway this way of handling coroutines is unity-specific @shrewd swift

shrewd swift
#

Okay

eternal needle
shrewd swift
verbal dome
#

vertical sleeve gastrectomy?

shrewd swift
#

Visual scripting graph

#

A piece of crap

verbal dome
#

Why are you forced to use that?

shrewd swift
verbal dome
shrewd swift
eternal needle
shrewd swift
#

I a used to use py, cpp and the visual scripting of UE5 (thatbis insanly better than unity)

shrewd swift
fiery notch
winged gazelle
#

that's why

verbal dome
fiery notch
eternal needle
# shrewd swift C# is legit ban'ed lmao

Is this highschool if you dont mind me asking? I cant imagine any reputable place would force visual scripting, its literally just worse and not transferrable as a skillset

gaunt ice
#

IEnumerator is interface, the equivalent of interface in cpp should be pointer to abstract class? cpp doesnt have interface since it allows multiples inheritance
i think you can treat it registers some object that inherits from this abstract class than the unity will run it

winged gazelle
verbal dome
#

I also said this twice before and someone else also reminded you about it..

fiery notch
#

omfg

#

that was it

#

its good now

#

im done

winged gazelle
#

welcome to programming kekw

verbal dome
#

@eternal needle @slender nymph Seems like thisCollider is the correct one in ContactPoint
But in 2D it is Collision2D.otherCollider 😵‍💫

eternal needle
#

🙏 i hate 2D

shrewd swift
#

But i am "special" since i already did a lot of programming before entering

eternal needle
#

hm i see, i guess that makes more sense

winged gazelle
shrewd swift
shrewd swift
shrewd swift
#

How does the start coroutine works ? In VS there is 2 types

verbal dome
#

Use the overload that takes an IEnumerator

#

The string-based one probably uses reflection to find the IEnumerator

shrewd swift
slender nymph
#

well yeah, that's what the docs are for. providing useful info so you know what you are doing

shrewd swift
shrewd swift
verbal dome
#

(With VS they mean visual scripting)

#

No idea about that

#

I would imagine that there's another way to wait in visual scripting though

slender nymph
#

well they can always ask for help with visual scripting in the #763499475641172029 discord 🤷‍♂️

verbal dome
#

Yeah, I linked that before and said that almost no one here uses visual scripting

shrewd swift
#

Well since its bad i understand xD

#

C better

slender nymph
# shrewd swift <@175082927862841344>

its inactive
have you even bothered asking for help there? when you do, you need to be patient. visual scripting is not entirely the same as c# and many things will be accomplished differently. that is why there's a separate discussion space for it

shrewd swift
#

I can still try

shrewd swift
verbal dome
#

Googling should be the first thing you do

shrewd swift
#

Im still on my phone

slender nymph
shrewd swift
static cedar
# shrewd swift For what is used the yield and waitforseconds?

IEnumerator methods are special methods that allow you to return something multiple times with yield return.
One thing to note though is that it doesn't spew all the results all at once, every yield return kinda just freezes the method in its place until the receiver asks for another one.

shrewd swift
slender nymph
#

well this isn't the right place for seeking help with visual scripting 🤷‍♂️

shrewd swift
#

I prefer c# logic answer than nothing

#

This discussion is going nowhere

slender nymph
#

okay and if you don't know c# or how to convert that to visual scripting how does you asking about visual scripting here help anyone?

static cedar
#

And frankly, if you don't have time to learn, I'd look for alternatives.
You'll consistently hit road blocks one after another.

shrewd swift
#

Ty for the answers tho ill retry some stuff when i finished with cooking

smoky niche
#

Hey there, quick question. Will async/await functions pause whenever you set the Time.timescale to 0 or not?

slender nymph
#

no

shrewd swift
verbal dome
static cedar
smoky niche
#

Thanks!

slender nymph
shrewd swift
#

I hate copy paste

verbal dome
slender nymph
#

if you really needed to rely on timescale while waiting for specific amounts of time in an async method and you are on 2023+ you can create a method that returns Awaitable, takes a float param and just awaits Awaitable.NextFrameAsync() until a timer float that you add deltaTime to is equal to or greater than the float you pass

static cedar
#

Just use Unitask.

#

It's pretty solid from my experience.

slender nymph
static cedar
#

And async methods give you more control than Coroutines. :p

queen adder
#

Guys if im making a pong ai, is it enough to just specify a "good enough" y distance difference between the ball and the ai paddle, to make it so it doesnt always go to the perfect spot?

#

And just check if the distance is less than that, and if so just stop?

slender nymph
#

yeah. what i did for mine was make it very accurate but limit its speed so it couldn't always reach the right location in time

static cedar
hardy fox
#

why do i keep getting this error when my code seems fine

static cedar
#

Also fixed by making the movement exponentially slower the closer it is to the ball.

#

So it never jitters.

hardy fox
slender nymph
slender nymph
# hardy fox

the enemy object does not have a EnemyHealth component

static cedar
hardy fox
slender nymph
#

that doesn't mean the object found by your physics query has that component

hardy fox
slender nymph
# hardy fox but its attached to te enemy

stop making assumptions and either print some info about the object detected by your query or use breakpoints and inspect it. because i assure you, the enemy object on line 35 does not have that component when the NRE happens

static cedar
hardy fox
static cedar
static cedar
#

Also move one step at a time .

glass crest
#

Hello, I'm trying to change the x position of a TMP_Text using it's rectTransform but it's changing it to a completely random value, why is that happening?

hardy fox
glass crest
#

Here I'm addressing it to be -36, however im getting -576

slender nymph
slender nymph
#

and what did you print?

hardy fox
slender nymph
#

ah yes "it aint working" super useful info

#

does your prefab perhaps have more than one collider on it?

slender nymph
shrewd swift
# verbal dome

i checked it and it looks like I already looked at it, the weird thing is even if i trigger the "wait until" with a coroutine (so with the check box ticked), it still freezes the whole game

ornate rampart
#

Hi!
we have an assignment to create a VR Application for the ocolus Rift. Everything is working fine but one thing that really does not work is how we are able to display two different things in the VR Googles and on the monitor. Basicly we want one player beeing VR doing stuff and then we want to have another one in front of the computer doing other stuff. We tried to use the multi display stuff which kinda works but only if we have 2 monitors on the computer itself (https://docs.unity3d.com/Manual/MultiDisplay.html) which is not ideal.
We also tried out stuff with setting the one camera depth different and not showing the eyes which kinda worked but had the isseu that we want two different Rendered "Screens" like e.g. Screen 1 is for the Vr googles and Screen 2 is for the normal comupter display. Can anyone help me with that?

slender nymph
slender nymph
# hardy fox yes

is one (or more) of those colliders on a child object that does not have that component attached?

daring sinew
#

how do i getcomponent() a script?

#

im trying to launch function from another script

slender nymph
shrewd swift
#

in c# is there anything that a coroutine "doesnt handle" ?

daring sinew
slender nymph
#

so share your code and errors

verbal dome
daring sinew
#

there are many, but this is one
GameObject.Find("Avatar").GetComponent<"StarterAssets">().Spawn1();

hardy fox
daring sinew
#

also things like
GameObject.Find("Avatar").GetComponent<StarterAssetsInputs>().Spawn1();

slender nymph
#

i would personally use TryGetComponent instead of a GetComponent followed by a null check

#

you have yet to share what the error(s) are

daring sinew
#

sec

#

The type or namespace name 'StarterAssetsInputs' could not be found (are you missing a using directive or an assembly reference?)

#

im trying to access a script from a gameobject

slender nymph
#

configure your !IDE and use the quick actions to import the relevant namespace or fix you spelling errors (if there are any)

eternal falconBOT
daring sinew
#

what

burnt vapor
slender nymph
daring sinew
#

idk whats the spelling error, but im like 100% sure its a spelling error, or wrongly placed stuff

slender nymph
#

well if you are certain it is a spelling error, then use a configured IDE to rewrite the line and use the convenient autocomplete suggestions to avoid spelling errors

#

we aren't your spell check, that's what your tools are for

#

it's most likely a missing namespace though, which can be easily fixed using the quick actions in a configured IDE

hardy fox
#

@slender nymph whats that site that allows me to put my code in and i send someone th elink so they can view it?'

slender nymph
#

!code

eternal falconBOT
hardy fox
#

any clue why my coin script isnt working?

slender nymph
#

be more specific than "isn't working"

hardy fox
#

whenever i try pick up coins nothing happens

slender nymph
#

show the Coin class

hardy fox
slender nymph
#

and are you seeing that coin collected log in the console?

hardy fox
#

no

queen adder
#

you are calling OnCoinCollected after destroy this gameObject, maybe destroy at the end

slender nymph
# hardy fox no

then the issue lies with whatever is calling your Collect method

burnt vapor
queen adder
#

oh okay

burnt vapor
#

The only way a script stops prematurely is by exceptions, and intentional things like return;

hardy fox
slender nymph
#

that tells me almost nothing

hardy fox
#

because the coins only appear after an enemy is destroyed

patent compass
hardy fox
#

im sorry idk if this is what you want

slender nymph
#

that is not where you are calling the method. that is the interface declaration

burnt vapor
hardy fox
#

this is what i have attached to the coinprefab

slender nymph
#

okay and where are you calling Collect

queen adder
#

just click '2 references' above Collect

hardy fox
rare basin
#

and where do you have the Collector class attached? did you put debug log there to see if it's getting called?

hardy fox
rare basin
#

also make sure atleast one of the colliders has Rigidbody2D

hardy fox
hardy fox
#

i mean the player has a rigidbody so athat does work

rare basin
#

is the debug log getting called?

hardy fox
#

no

rare basin
#

so the Collector doesnt work

rare basin
slender nymph
#

is the Collector component actually attached to anything

rare basin
#

where did you attach the collector

split dragon
#

Hi. I want to change the values: speed and height one key at a time. I tried to use bool, separate void Sit() and void Stay(), but I couldn't. What is the solution?

hardy fox
rare basin
#

eh.. to what is the Collector component attached to?

#

what game object instance?

rare basin
#

what is void Sit and void Stay

hardy fox
rare basin
#

you are already changing height and speed after pressing C key

split dragon
rare basin
rare basin
split dragon
rare basin
#

@hardy fox does the player has a collider that is a trigger?

#

becaues if the Collector is on the player, and it has OnTriggerEnter2D component

hardy fox
rare basin
#

that means that the Player has to have a collider marked as isTrigger

slender nymph
#

if the coin's collider is a trigger the player's doesn't need to be

rare basin
#

yes sorry i mean if he has a collider attached to the same GO that the Collector is attached to

slender nymph
# hardy fox

have you put a log here to ensure this is being called?

hardy fox
#

this is the lootprefab game object

rare basin
#

can you answer the questions

#

we are asking you?

#

why does the lootprefab has a collector component

#

loot should be collectible not a collector that collects coins/loot

hardy fox
#

I don't have a component called collectible that I can attach to coin

rare basin
#

coin is already a collectible by inheriting the interface

hardy fox
rare basin
#

🤷

hardy fox
rare basin
#

do what we said you should do first

rare basin
#

and answer the basic questions

hardy fox
slender nymph
#

show where you've put the log

hardy fox
slender nymph
#

that doesn't tell you whether that method is being called or not

#

put a log outside of the if statement

rare basin
#

why did you put the debug log in else?

hardy fox
rare basin
#

we told you exactly what you should do

#

instead you are doing your own stuff

#

if you don't understand the help we are giving you should go through the basics of Unity first

#

otherwise it is impossible for you to even understand the help

hardy fox
slender nymph
#

you absolutely can

rare basin
#

you can, why not

slender nymph
#

no, it's been that way forever. that's why GetComponent<T> is not constrained to Component

hardy fox
#

you guys are amazing , its working now

slender nymph
#

what ended up being the issue?

shrewd swift
#

is there a way to update a dict while a for each loop ?

slender nymph
#

you cannot modify a collection while enumerating it

shrewd swift
#

if the updated keys were already iterated through

burnt vapor
shrewd swift
#

is there a trick ?

rare basin
#

you can create a copy of keys and values

#

and iterating over the copy while modifying the original dictionary

hardy fox
burnt vapor
#

It really depends on what you're actually updating

#

Are you adding stuff? Or modifying existing keys? Removing keys?

shrewd swift
#

never updating the keys

burnt vapor
#

Yeah so get the keys using dict.Keys and enumerate that

rare basin
slender nymph
hardy fox
rare basin
#

so that wasn't an issue

#

but the isTrigger on player was xd

rare basin
hardy fox
#

😩 I don't even know, as long as it work

rare basin
#

now you are saying the player had the Collector but also had the collider marked as isTrigger

#

im confused

slender nymph
hardy fox
#

Played had RB

slender nymph
#

so then you don't actually know what the issue was, you just fixed it somehow

#

unless the player's rb is static

hardy fox
slender nymph
#

yeah so when i asked you what the issue was your answer should have been "i don't actually know, i just changed things until it started working"

hardy fox
#

It was a well calculated guess

reef pasture
#

Does anyone know what causes this rendering bug by left image?

export render result is right image.

slender nymph
#

this is a code channel

reef pasture
#

expect render result is right image.

rich summit
#

What return type can I use on this so that it stays persistent throughout the game instead of only being able to be used once? I

slender nymph
#

huh?

queen adder
#

Its not returning anything?

#

So void is fine

#

I mean, void is the only thing you can use

slender nymph
#

if you want the method to be reusable for different objects, changing the return type isn't going to do that, unless you want to return whatever is in that DavidStates array

queen adder
#

Or you can make it so it returns whatever the davidstates[index] is

#

And then set the sprite directly with the method

slender nymph
#

also for the love of god, cache the reference to your components, not the gameobject so you're not calling GetComponent everywhere

rich summit
#

I'm just using the way the teacher taught me

queen adder
#

Damn

#

Thats a bad teacher

slender nymph
rich summit
#

I have to get this project on a usb in like 3ish hrs

rich summit
queen adder
#

Make a variable like

Image davidSpriteImage;

private void Awake() {
  davidSpriteImage = GetComponent<Image>()
}
#

Then u can just do

davidSpriteImage.sprite = whateverYouWantThatsASpriteOrSomethingLikeThat;
slender nymph
#

i'd bet they're already serializing GameObject fields so the only change they'd have to make is the type and removing the GetComponent calls

rich summit
#

ohhh wow

#

Also if you wanna see something that'll kill you on the inside right now my gameScript is 1000+ lines of copypaste methods

queen adder
#

Oh god

#

Wtf kinda teacher do you have? Thats insanely bad

rich summit
#

which ends up stacking up

#

this is a mess

#

I have to scroll a marathon to reach a certain scene

queen adder
#

But a 1000+ lines of copy pase is the opposite of oversimplyfying

rich summit
slender nymph
queen adder
#

It seems like

rich summit
#

this is all that's handled before the game starts and then everything else is ran on update()

#

It's awful

queen adder
#

I dont know what they're teaching but im 100% even the teacher has no idea what it is or how to program

rich summit
slender nymph
#

maybe they were a janitor at blizzard

queen adder
#

Oh no, that explains it 🤣

#

And god....

#

Everything is public...

rich summit
#

Either the teacher doesn't know or he's picking the inefficient way for the sake of "here take this so you can copy paste and I won't have to teach you until this project is finished"

queen adder
#

Naah he dont know

slender nymph
queen adder
#

I just noticed it lmao

#

Im ded

rich summit
#

Sometimes I have the thought in the back of my head that there is a probability my teacher is in this server and what if he looks at my msgs and calls out my class 💀

queen adder
#

This has to be the most cursed .cs file I've ever seen

rich summit
#

But due to my school-issued usb frying and then apparently the school workstations using an outdated ver of Unity I'm stuck to working on it at home and it's due this morning

queen adder
#

Huge? It already is! I've never had a script thats more than at max 500 lines

#

And even that is pushing it

#

A lot

rich summit
queen adder
#

Just keep scaling it

rich summit
queen adder
#

Apparently a school project

rich summit
#

(it's my first year in this game dev course)

queen adder
#

My brother this is not a gamedev course

#

Its a game dev curse

burnt vapor
rich summit
#

LOL

queen adder
#

Id get a refund

rich summit
queen adder
burnt vapor
#

They would not know what to do with this code

queen adder
#

Yeah they would

#

Refactor it

rich summit
#

Honestly this is too much I'm completely lost on where I was

vale blade
#

I have a class from an UPM package that has an optional name variable serialized.
How do I hide that field in the inspector given that I can't change the code itself?

queen adder
#

Why can u not change the code?

vale blade
#

is my only option to make a wrapper class?

vale blade
little meteor
burnt vapor
vale blade
#

so I'm trying to serialize a List<Message> where Message has the attribute that needs to be hidden

little meteor
#

If all else fails you could put the package content from the cache into your packages folder and edit it in there.

vale blade
slender nymph
#

you should just be able to create a custom property drawer for that class

hardy fox
#

what button is right click on the controller?

rare basin
#

whatever you assign and wants it to be

#

but i think by default its R3

subtle folio
#

im trying to assign an sprite to UI Image through code but i dont know how, can anyone help pls

hardy fox
hardy fox
slender nymph
#

this is a code channel

dry tendon
#

heey, hi everyone, does someone knows why i can not drag this script into the inspector? pleaasee... help

#

it's an audio manager asset... but it let me do than on another project... i've removed it like three times from both projects, but in one i can and in another no

eager elm
teal viper
#

Make sure the field is of the correct type

dry tendon
#

Let me both check 🙂

dry tendon
slender nymph
#

!code 👇

eternal falconBOT
teal viper
#

Because it's a .txt file.
🤫

eager elm
#

Brah, you can't just drop a 500 line long class and ask us why X is not working. Use Debug.Log() until you find the problem and then post the part that matters.

slender nymph
#

if only there were some way you could share large blocks of code. perhaps even some bot could respond to a command to share instructions for that

#

of course you still shouldn't just drop 500+ lines with little context

bold nova
#

Im having trouble triggering the animation. Animation doesnt launch. I have an enemy and a player. If their colliders collider and player is rolling at the time of colliding, enemy should play the stumble animation. One of them is marked as trigger other is not. One is kinematic other is dynamic, sorting layers for both are the same. For some reason it doesnt work.

#

in the playerController script:

#

private void OnTriggerStay2D(Collider2D collision)
{
if (collision.gameObject.tag == "Enemy" && isRolling)
{
collision.gameObject.GetComponent<Enemy>().Stumble();
}
}

slender nymph
eager elm
slender nymph
#

also don't compare tags using string equality, use the CompareTag method instead

eager elm
slender nymph
# bold nova its better?

yes, it's not only ever so slightly faster, but it also provides relevant errors when a tag just doesn't exist

bold nova
eager elm
bold nova
#

public void Stumble()
{
float stumbleTime = 5f;
enemyAnim.SetBool("IsOutOfPlay",true);

   new WaitForSeconds(stumbleTime);
   enemyAnim.SetBool("IsOutOfPlay", false);

}

little meteor
bold nova
#

ok, now it says coroutine stumble doesnt exist in current context....

#

collision.gameObject.GetComponent<Enemy>().StartCoroutine(Stumble());

#

public IEnumerator StumbleAnimation()
{
float stumbleTime = 5f;
enemyAnim.SetBool("IsOutOfPlay",true);

    yield return new WaitForSeconds(stumbleTime);
    enemyAnim.SetBool("IsOutOfPlay", false);
}
#

should there be a separate method in Enemy class that starts coroutine and call that separate method?

slender nymph
#

yes, make the Stumble method start your StumbleAnimation coroutine

bold nova
slender nymph
#

it's not impossible. you just weren't

#

if you wanted to call StartCoroutine on the Enemy object and pass the Enemy object's StumbleAnimation coroutine, you would do this:

var enemy = collision.gameObject.GetComponent<Enemy>();
enemy.StartCoroutine(enemy.StumbleAnimation());
normal arrow
#

Hi !
I want to generate a pdf from a string and an image in my app, i tried with Itext but it didn't work, is there an easier way to do so ? Or maybe it's easier to generate a Word file ?