#archived-code-general

1 messages ยท Page 275 of 1

cosmic rain
#

The Json should come along with some kind of int messageType variable that you can use an enum to deserialize correctly.

knotty sun
#

again, it's trying to open a box using the knife which is inside the box

marble mauve
#

But the JSON is the message I receive from my websocket server. I think I can only send strings to the ws client

cosmic rain
#
class Message
{
  int type;
  string data;
} 
#

Or even just a byte array

chilly surge
#

JSON is not the issue, if you have an arbitrary payload that you do not know the type before hand, there is no way for you to deserialize it regardless of format, and always requires you to add a tag to indicate what type it is.

marble mauve
cosmic rain
#

Networking messages are like ogres, you know

chilly surge
#

This pattern is very common, some languages call it tagged union, some languages call it discriminated union, Rust simply calls it enum, but they are all the same thing.

knotty sun
buoyant sky
#

im new to unity and coding is there anything that can help me get more info about the code ?

chilly surge
#

Newtonsoft and STJ both support this.

cosmic rain
#

In that they have layers

marble mauve
#

So is there any solution to implement a ws or cross connection between two clients and a server without the need of serialize strings

chilly surge
cosmic rain
#

How you serialize is up to you though

marble mauve
#

Okey and with that I won't have any problem? As I could sent an int (message type) an then set the payload as the type I want

knotty sun
chilly surge
#

You just need a tag to indicate what type the payload is, and then the payload.

marble mauve
#

So like ```cs

int myType = type I get

if(myType == 1){

Type1Payload payload = mypayload

}

fervent furnace
#

you can serialize your type as byte array then send it directly

switch(type){
case Enum.Int:
  int val=*((int*)buffer);
  break;
case Enum.Float:
  float val=*((float*)buffer);
  break;
....
}
chilly surge
#

Basically yes, and both Newtonsoft and STJ have features for this already.

#

So you don't need to reinvent the wheel and write that giant switching on type yourself.

mild coyote
#

Why not just cast the payload and see if its valid, else try another type

marble mauve
#

Sorry for the ignorance I am not used to work with those things in c#. The enum contain the possible int types for all the messages I will send? And then why are you setting a variable that could be a float or either a int?

marble mauve
fervent furnace
#

you cannot cast it to check if it is valid since a byte array can be everything
so you need a header

chilly surge
mild coyote
fervent furnace
#

you are trying to parse, though this is valid option but costs you much time in parsing.....

thick terrace
chilly surge
#

Newtonsoft and STJ both support polymorphic deserialization without you having to reinvent the wheel.

marble mauve
#

Oh sorry I want to convert a string representation of a JSON into an object. Not converting the object into a string

chilly surge
#

Yes, the page's example also includes deserialization.

swift falcon
#

thank you, first person here who actually helped me and wasnt rude. I appreciate it loads! โค๏ธ

marble mauve
#

And with this it would fit in?

chilly surge
#

You don't need the metadata, Newtonsoft adds the type information for you.

#

Well, assuming you are also using Newtonsoft on the server.

marble mauve
#

Mm no my server is built in nodejs

#

I only use NewtonSoft for deserialize in unity

chilly surge
#

It allows you to specify what $type strings map to which classes.

marble mauve
#

So I can make a $type property to be set as the type in the metadata?

#

And then check and re-deserialize with the correct type?

chilly surge
#

No, Newtonsoft will do that for you

#

On the server side, you need to send a message with "$type": "itsABurrito"

#

On the client side, you need to implement a binder that says "if you get itsABurrito, use the Burrito class"

#

And that's it, Newtonsoft will do the rest for you.

marble mauve
#

Okey

#

Nice

#

and how I can link the $type with a class?

chilly surge
#

By implementing a binder, see the example linked in the doc.

marble mauve
#

yeah

#

I saw it

#

I will implement it using a dictionary for the types

#

thanks for the help

#

I think I'll come with another error as I think the problem with the use of dynamics of yesterday is not the source of my error with binding a null reference

chilly surge
#

You don't have to use a dictionary unless you plan on adding types dynamically at runtime.

#

You can simply use a switch expression:

return typeName switch
{
    "itsABurrito" => typeof(Burrito),
    "itsATaco" => typeof(Taco),
    // ...
    _ => null,
};
crisp scarab
#

Hey guys, i'm having a discussion with a friend regarding queues, and we are not the smartest tools in the shed, so we chatgpt'd. i said that If you peek twice, you get the same object, but he and chatgpt say otherwise. Also, the discussion started regarding if it would be more performance efficient to cast a big queue to array list, or to dequeue and enqueue in an aux queue until reaching the needed object when random accessing. it would be only once in a specific use case when we apply predefined attributes to a random object. But then he pulled the "peek twice and save in reference and you'll get both peek and peek+1" argument

#

I'm not home so i can't test it right now

leaden ice
marble mauve
chilly surge
leaden ice
crisp scarab
#

thanks guys

#

basically, he dumb + chatgpt gastlight

marble mauve
chilly surge
knotty sun
chilly surge
#

Now that you have an object, what to do with it is up to you. You can either switch/pattern match its actual type, have a base class/interface and call the methods directly, or do whatever.

marble mauve
chilly surge
#

What are you confused about

#

Are you not sure what to do with the resulting object?

marble mauve
#

yeah I don't know what is the output

#

and how to access those properties that were in the payload field

chilly surge
#

Eg:

switch (data)
{
    case SessionWelcomeMessage sessionWelcomeMessage:
        DoSomethingWith(sessionWelcomeMessage);
        break;
    // ...
}

Or:

interface ISessionMessage
{
    void DoSomething();
}

class SessionWelcomeMessage : ISessionMessage
{
    // implement DoSomething() for your messages
}

var message = (ISessionMessage)data;
message.DoSomething();
marble mauve
marble mauve
#

@chilly surge thanks I'm getting the class now I will create a method handle() or anything like that to handle each message and only make like data.handle();

chilly surge
#

Do keep in mind it might be a bad idea to hard couple your messages with their handling (conceptually it also doesn't make sense for a message to "handle itself")

marble mauve
#

okey I used the switch you made

chilly surge
#

๐Ÿ˜…

jaunty plume
#

my doo doo brain cant understand the docs, how do i get offset vectors values of the tiles to set to camera position?
i have tried the following script:

themats1.SetVector("Offset", new Vector4 (0, Camera.main.transform.position.x,Camera.main.transform.position.y , 0));

am i doing this wrong?

leaden ice
#

What are you trying to do?

#

also "Offset" is definitely not the correct name for that property

jaunty plume
#

to set the texture offset of the tiling to camera position

jaunty plume
leaden ice
#

what does that mean though? That makes little sense

#

texture offset is in UV space for this particular mesh

#

camera position is in world space

#

what are you trying to accomplish

jaunty plume
#

the scroll effect

leaden ice
#

why would that involve the camera position

leaden ice
jaunty plume
#

ok i think i have found it

#

oh, maintextureoffset? lemme check it

leaden ice
#

mainTextureOffset should work based on that yes

jaunty plume
#

it does not work,
this is how i tried

themats1.mainTextureOffset = new Vector2(0, Camera.main.transform.position.y);

(small notice: themats1 has assigned value with the material of the object's texture)

leaden ice
#

are you sure the camera position is changing?

leaden ice
#

you should see it update

jaunty plume
#

the vector2 works well, tried debugging the camera position, but it does not move the texture

#

but it does not change the maintextureoffset

jaunty plume
#

did like this

leaden ice
#
themats1.mainTextureOffset = new Vector2(0, Camera.main.transform.position.y);
Debug.Log(themats1.mainTextureOffset);```
jaunty plume
leaden ice
#

no idea what you're logging though

#

i expect a Vector2

jaunty plume
#
Debug.Log ("The material offset: "+ themats1.mainTextureOffset.y.ToString());
leaden ice
#

well looks like it's changing just fine

jaunty plume
#

i believe the best solution is changing the value from material like i tried before, but i dont know how to get to that offset

#

this is the current attempt:

themats1.SetVector("Offset", new Vector4 (0, Camera.main.transform.position.x,Camera.main.transform.position.y, 0));
leaden ice
#

It's Definitely NOT called offset

#

as you can see in the inspector

jaunty plume
#

_MainTex but i believe it wont change the offset if i put it between ""

#

nowhere in the docs specify about getting the.... "child" (Second then Offset) of the _MainTex

#

for me the docs are alwasy confusing, i cant understand it, unless it's basic simple stuff

leaden ice
#

based on this SetTextureOffset or jsut mainTextureOffset should work just fine

jaunty plume
#

SetTextureOffset() ooooh

#

this is what i searched for

leaden ice
jaunty plume
#

oh

#

thanks so muuchh, this is what i needed!

#

yay :D

static matrix
#

how can I make in game objects clickable if I am viewing the game thru a canvas?

#
 void Update()
    {
        if(Input.GetMouseButtonUp(0)){
            Physics.Raycast(ClickCam.ScreenPointToRay(Input.mousePosition), out RaycastHit hit, maxDistance: Mathf.Infinity, layerMask: Buttons);
            if (hit.collider){
                Debug.Log($"{name} Clicked");
                hit.collider.GetComponent<ButtonGame>().OnClick();
             }
        }
    }

heres the code that worked for a project that wasn't thru a canvas

marble mauve
# chilly surge ๐Ÿ˜…

now I am facing an error which at trying to get a tmp text by its name https://pastebin.com/qBhux2Hz. I don't know why, I'm facing this error since yesterday and when I try to develop another method always is throwing me this error. I have the object created as you can see in the image. And the questionbody is a tmp_text.

static matrix
#

but this does not seem to work

#

should I not use screentopointray in this case?

knotty sun
#

the first question to ask is what is in your layerMask?

static matrix
#

same result whether or not I include layermask
however I do get some result, in that it will end up either clicking the far wall or the wall to my right, but nothing else
even when I click on say the left wall

chilly surge
static matrix
#

hmm it may have something to do with the fact that my main camera is rotated? because when I change the rotation different objects come up

marble mauve
static matrix
#

ok so it clearly has something to do with the cameras rotation
but im not sure where to go from there

pulsar elm
pulsar elm
#

he if offsetting the texture using a c# script

leaden ice
#

Materials are just a shader and a set of parameters around the shader

leaden ice
#

which is an object in the game world

pulsar elm
#

You can get camera position in a shader

leaden ice
#

Sure you can but all we're doing is setting a shader property which is very cheap

pulsar elm
#

It is cheap but there is always cheaper

#

cheaper is better the lower the specifications you are targetting after all

static matrix
#

hmm got it closer
but now its like offset

tribal plinth
#

how can i scale a Sprite/Spriterenderer to fit the bounds of a rect transform?

#
public class MapBackground : MonoBehaviour
    {
        public Sprite sprite { get; set; }
        
        void Start()
        {
            sprite = GetComponent<SpriteRenderer>().sprite;
        }

        void Update()
        {
            RectTransform mapContainer = GameManager.Instance.InGameUI.MapContainer;
            //scale to fit the map container while maintaining aspect ratio, focus on width then height, this is a simple sprite that exists in the world while the mapcontainer is a UI image
            
            float containerAspectRatio = mapContainer.rect.width / mapContainer.rect.height;

            // Calculate ratio of sprite dimensions
            float spriteAspectRatio = sprite.bounds.size.x / sprite.bounds.size.y;

            // Determine scaling factor based on which aspect ratio is larger
            float scaleFactor;
            if (containerAspectRatio > spriteAspectRatio)
            {
                // Container is wider, scale based on container height
                scaleFactor = mapContainer.rect.height / sprite.bounds.size.y;
            }
            else
            {
                // Container is taller or equal, scale based on container width
                scaleFactor = mapContainer.rect.width / sprite.bounds.size.x;
            }

            // Apply the calculated scale while maintaining aspect ratio
            transform.localScale = new Vector3(scaleFactor, scaleFactor, 1f);

        }
    }```
static matrix
#

mfw forgor highlighting

tribal plinth
#

that is my current code, but the background sprite is much too big

static matrix
#

```cs like this instead of just ```

tribal plinth
#

im aware how to do it

#

its currently doing this onupdate so i can use hot reload and see the changes live

#

in the future it should only be called once

static matrix
#

I could try and do it my just making a box of screen coords but that seems terribly inneficient and would struggle to work if the resolution changes

tribal plinth
#

basically i just want my background sprite within the clear area there

#

thats a better example

#

it is an image, if that helps

static matrix
#

maybe I just try to do it with UI buttons but that would look off

tribal plinth
#

i need physics though

static matrix
#

no idea why this script isn't working on this project I would think it should

tribal plinth
#

its gone through many iterations from gh copilot, chatgpt, bard, whatnot they all say its correct

static matrix
#

thats what ya get for trusting AI
is the background expected to change? like the amount of space it needs to fill

tribal plinth
#

no

static matrix
#

oh

#

so why do you need to do it via script????

#

just resize it

tribal plinth
#

different resolutions

static matrix
#

so why use UI for this

#

just use a sprite

tribal plinth
#

im not

#

thats the issue

static matrix
#

so different resolutions shouldn't matter?

tribal plinth
#

the background is a sprite

static matrix
#

so resize it to fit in the box

#

still no idea why this isnt working
I'm sending the camdata to a rendertexture does that mean that I cant do Camera.ScreenToWorldwhatever or anything similar?????

#

ugh I'll just do this the slow way

marble mauve
#

It could be possible as I am testing my game via websockets running the build executable and the game in the editor that when I focus my window on the build executable and my app change a text in the build game it changes but in the game of the editor an error is thrown as there isn't an instance of the text. I think is because of that as I am focusing on one window instead both so, how I can know with an script when the text loads successfully and how I can set the screen size from full to other one in my build application?

dreamy meteor
#

Anyone know why this never makes it past the yield return uwr.SendWebRequest(); ? I tried a bunch of random image links

leaden ice
dreamy meteor
#

ah I think thats it thanks

somber nacelle
#

that's also the very first yield, if this coroutine isn't being started correctly (such as by just calling the method directly instead of using StartCoroutine) it would stop at the first yield

dreamy meteor
#

gotcha thanks

ancient magnet
#

!code

tawny elkBOT
ancient magnet
#

So right now, when I move and smoothing is on, the hands kind of fall back, because their coordinates are in world space and they have to catch up to the body first. How can I fix this? (This is the One Euro Filter that I'm using: https://github.com/DarioMazzanti/OneEuroFilterUnity)

using UnityEngine;

public class FilteredObject : MonoBehaviour
{
    public bool filterON;
    public Transform noisyTransform;

    OneEuroFilter<Vector3> positionFilter;
    OneEuroFilter<Quaternion> rotationFilter;

    public float filterFrequency = 120.0f;
    public float filterMinCutoff = 1.0f;
    public float filterBeta = 0.0f;
    public float filterDcutoff = 1.0f;

    void Start()
    {
        positionFilter = new OneEuroFilter<Vector3>(filterFrequency, filterMinCutoff, filterBeta, filterDcutoff);
        rotationFilter = new OneEuroFilter<Quaternion>(filterFrequency, filterMinCutoff, filterBeta, filterDcutoff);
    }

    void FixedUpdate()
    {
        if (filterON)
        {
            positionFilter.UpdateParams(filterFrequency, filterMinCutoff, filterBeta, filterDcutoff);
            // Use localPosition instead of position
            transform.localPosition = positionFilter.Filter(noisyTransform.localPosition);

            rotationFilter.UpdateParams(filterFrequency, filterMinCutoff, filterBeta, filterDcutoff);
            // Use localRotation instead of rotation
            transform.localRotation = rotationFilter.Filter(noisyTransform.localRotation);
        }
    }
}
#

So essentially, I only want to filter small movements. I tried distance/velocity based stuff, but nothing works

rigid island
static matrix
#

would it be possible to make a CRT material via shadercode?
I:E, materials with the shader on function basically the same as normal materials but they will have a crt texture or something overlaid and might flicker or smth

rigid island
sharp valve
#

how can i make this bool editable in the editor?

#

[SerializeField] doesnt work

little meadow
#

make it less static

simple egret
#

Static fields cannot be serialized

quaint rock
rigid island
quaint rock
#

say you could, where would you expect it to display, since the UI is per instance

sharp valve
#

but then i wouldnt be able to use it in other scripts, right?

quaint rock
#

but static is global to all instances

rigid island
quaint rock
#

sure you can get a reference to it

sharp valve
#

im currently using it by doing Script.canFinish

leaden ice
little meadow
#

*don't mention singleton, don't mention singleton...*

leaden ice
rigid island
leaden ice
#

DI and singletons are both just ways to get a reference to the object though!

rigid island
#

ofc ofc ๐Ÿ˜…

spring creek
#

Singletons are a valid pattern, especially in game development

#

But it wouldn't be the best choice for this, it looks like

#

Just getting a reference to the object holding the bool would be best

little meadow
#

Singletons are โค๏ธ I agree ๐Ÿ˜›

normal dust
#

anyone familiar with localization can help me?
i have a table with names of items
and a popup for selling these items
i want the popups have their own table and this one specifically to be for example "How many {item_name} do you want to sell?"
i have a localizestringevent on the popup with a string reference to it and inside it a local variable which is also a localized string, how can i change its table key?
is my approach even right?

rigid island
#

are you using the localization package?

normal dust
#

yes

heady iris
#

oh hi I use that a lot

#

I'd expect you to just be changing the TableEntryReference

normal dust
#

tl;dr i want to be able to change a local variable localizedstring's key

heady iris
#

since I'd expect you to have one table of all of your items

normal dust
#

yea

heady iris
#

but you can definitely change the TableReference as well

normal dust
#

but itll always be the same table

heady iris
#

You can update an existing variable like this:

#
if (someString.TryGetValue(key, out var variable))
{
    if (variable is LocalizedString target)
    {
        target.SetReference(itemName.TableReference, itemName.TableEntryReference);
    }
 }
#

someString could be localizeStringEvent.StringReference, in this case

normal dust
#

ohh youre casting

heady iris
#

yeah, I'm downcasting from IVariable

#

This is different from the alternative in a big way...

#
target.Add(key, itemName);
normal dust
#

yea

heady iris
#

This literally puts itemName in as that variable

normal dust
#

for this i'd have to remove too right

heady iris
#

rather than just copying over its table and entry

#

This is important if itemName has its own variables

#

I wound up writing two extension methods for this

#

line 9 is interesting...iirc, i was having problems with the new string variable appearing as blank

#

so i called GetLocalizedString first to force it to be loaded

#

not a huge fan of that

#

CopyFrom copies over every variable from the original localized string

normal dust
#

hmm i see what you did there

heady iris
#

recursively doing so for string variables

#

I'm not very confident this is the "right" way to do it

#

I did this because I was having problems with multiple users of the same LocalizedString object stepping on each other's toes

#

I had to create individual LocalizedString objects so that they could have a different value for that variable

#

The LocalizedStrings are stored on scriptable objects that many things refer to

#

If each instance already has its own LocalizedString, then this isn't an issue

normal dust
#

i see you saved me some time if i had run into this issue

#

im wondering about why if i do

if (someString.TryGetValue(key, out var variable))
{
        (LocalizedString)variable.SetReference(itemName.TableReference, itemName.TableEntryReference);
 }

it doesnt act like this a localizedstring

#

wait how do i make it codelike

rigid island
heady iris
#

The order of operations is wrong.

#

You're trying to cast the result of variable.SetReference(itemName.TableReference, itemName.TableEntryReference) to a localized string

#

The precedence of the . operator is higher than the precedence of the (cast) operator

#

((LocalizedString) variable).whatever will behave properly

normal dust
#

what a weird syntax i guess i learned that today

#

i thought its supposed to be

(LocalizedString)(variable).something
heady iris
#

That would not change the meaning of the expression

#

(variable).something

#

the left side is (variable) and the right side is something

#

it's roughly like writing

#

well, actually, no it's not roughly like writing -3 * 2

#

unary minus has higher precedence than the times operator!

#

this lists every single operator that C# has

normal dust
#

gotcha ty so much for the informative response

tough obsidian
#

can someone help me with Error .theproductnam JNI ERROR (app bug): global reference table overflow (max=51200)global reference table dump ihave read some threads and they were saying it is bug from unity side

rigid island
mossy snow
tough obsidian
tough obsidian
rigid island
tough obsidian
knotty sun
tough obsidian
knotty sun
tough obsidian
jagged snow
#

Im running into a problem where this command is instantiating two gameobjects.
I know this through debugging and naming the gameobject after instantiating.

        gunPack.gameObject.name = "Gun Pack";```
Its showing up in the scene as New Game Object
simple egret
#

new GameObject() does that on its own

jagged snow
#

is there a way to create an empty game object without making a duplicate?

#

oh wait

#

I see what you mean now

#

thanks I got it

cosmic nest
#

hello how can i make it move from left to right not right to left

public class CircularMovement : MonoBehaviour
{
 
    [SerializeField]
    Transform rotationCenter;

    [SerializeField]
    float rotationRadius = 2f, angularSpeed = 2f;

    float posX, posY, angle = 0f;

    // Update is called once per frame
    void Update()
    {
        posX = rotationCenter.position.x + Mathf.Cos(angle) * rotationRadius;
        posY = rotationCenter.position.y + Mathf.Sin(angle) * rotationRadius;
        transform.position = new Vector2(posX, posY);
        angle = angle + Time.deltaTime * angularSpeed;

        if (angle >= 360f)
            angle = 0f;
    }
}
quartz folio
#

presumably negate your angle

simple egret
#
  • Do note that the angles you pass to Cos and Sin must be in radians
cosmic nest
mellow sigil
#

You can just change the angularSpeed to a negative number

mellow sigil
cosmic nest
tough obsidian
distant rune
#

I have a bobbing script on this image object, it just makes it float up and down on a curve. For some reason, having this script enabled warps the SFlag object downwards through the ground, though it worked in a different scene with flat terrain. Is there any reason why this would be happening?

leaden ice
#

it has no knowledge of the height of the ground

#

you probably want to be doing something like a raycast to the ground to see the ground height, and have the curve height be additive with the ground height

distant rune
#

oh

obtuse relic
#

Does anyone know of any available functions for generating a specular and occlusion map for a texture?

I've created a function that will modify a texture's brightness, contrast, and saturation - the only issue is that I'd like to generate spec/occ maps for all my textures in one batch. Currently my script just takes one Vector3 (brightness, contrast, saturation) for all spec maps and one Vector3 for all occ maps, but this has lead to some spec maps looking perfect, while others are fully black or fully white. Basically - is there a way to make the script dynamically adjust the brightness, contrast, saturation values for each individual texture's spec and occ maps for the best results?

deep oyster
#

I'm getting a weird problem where my scene (or at least the UI) is slightly more zoomed in in a build than in editor (Compare the e in the editor sreenshot to the build on the right). This is making figuring out the right size to make my UI a real pain in the butt. Has anyone experienced an issue like this?

deep oyster
#

according to my calculator and this table online

rigid island
#

also which rez settings do you build

rigid island
#

I would still put a bigger resolution like 720p at minimum. well ig depends on which device you plan on targeting

#

make sure you have anchored everything properly as well

deep oyster
#

I was using 854x480 but it's actually not quite true 16:9

deep oyster
rigid island
#

makes sense

#

other than anchors I'm not sure what else you can check, UI is a bit of pain to get just right.

#

hmm maybe test the specific resolution you export at in the Game View to make sure its all anchored accordingly

deep oyster
#

that's what I'm using. My itch viewport is 848x477

rigid island
deep oyster
#

I tried Auto-detect size but it says this when I try to run it

rigid island
#

to test UI at that rez

deep oyster
#

found this, but changing it doesn't help

deep oyster
rigid island
rigid island
deep oyster
rigid island
deep oyster
#

oooh sorry

deep oyster
#

Bruh I figured it out I'm actually extremely stupid it wasn't even an issue it was that that specific button is scaled up when it's selected which doesn't happen when the game is not running ๐Ÿ’€

lament cove
#

Need help from Dungen library

cosmic rain
#

And how did you get there?

lament cove
#

It is about the Procedural dungeon generation asset.

I am looking for a way to obtain the data of the rooms generated from code, to start I am specifically looking for the "floors" of the prefabs in the 2D demo, because I want to implement the Terraing Grid System on each floor of each generated room.

I need this because I want to know which room is linked to another and transfer or move the character between rooms using the Terrain Grid System linked on the floors generated by Dungen.

Something like, I move from point A to B, and not from A to C.

brittle apex
#

I need help with dropshadow 2d for TMP text and button

#

the shadow component is not working and idk why

rigid island
brittle apex
#

sorry

rigid island
#

btw TMP has its own shadow shader iirc

brittle apex
#

oh

#

thanks

umbral idol
#

can someone help me figure this error out?

MissingReferenceException: The object of type 'Student' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
Student.TeleportAllStudentsToClasstimeDestination () (at Assets/Scripts/Student.cs:919)
AttendClass.sitOnSeat () (at Assets/Scripts/AttendClass.cs:35)
UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:165)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
PromptManager.updatePromptControls () (at Assets/Scripts/PromptManager.cs:301)
PromptManager.updatePrompts () (at Assets/Scripts/PromptManager.cs:133)
PromptManager.LateUpdate () (at Assets/Scripts/PromptManager.cs:30)

nowhere in my code is anything destroyed, especially not a "student" object, and the line it references at Student:919 is a debug line, and AttendClass:35 is a line that teleports students to their respective desks.

The code will work perfectly fine twice. I run the game, go to class, go to class again since there's a lunch break, and then I use a debug command to go to the next day. The next day loads in by saving the day, reloading the scene, and then loading the day. That way everything can run almost exactly the same every day but up the day of the week.

public Transform classDeskPos;
^ this seems to be the actual line that's coming up as "empty", but every student always has this included, none of them share the same desk, and because all students are on the map and following their proper logic, none of the student objects or scripts were removed or deleted.

spring creek
#

Unless you exlicitly keep them loaded

umbral idol
#

i added in a line that would prevent objects from being destroyed on load, and even added it to it's own script so i can attach it to objects, but the error still occured

#

DontDestroyOnLoad(gameObject);
this

spring creek
#

Sorry, that is worded weird.
The reference that is LOST, is THAT object in DDOL?

umbral idol
#

I added DDOL and removed it from the Student file, since that file keeps track of classDeskPos, which is the value that seems to be the issue

spring creek
tawny elkBOT
umbral idol
#
    public static void TeleportAllStudentsToClasstimeDestination()
    {
        foreach (Student student in AllStudents)
        {
            if (student.classDeskPos != null)
            {
                if (student.transform != null)
                {
                    student.transform.position = student.classDeskPos.position;
                } else
                {
                    Debug.LogError("Student Transform is null for student: " + student.name);
                }
            }
            else
            {
                Debug.LogError("classDeskPos is null for student: " + student.name); //This is line 919, mentioned in the error
            }
        }
    }```

    [SerializeField] public Transform classDeskPos; is added at the start of the file, outside of any methods, and every Student has the value filled in the editor

```cs
                    player.references.fadeManager.alphaGroup.alpha = 1;
                    player.references.fadeManager.fadeSpeed = 1;
                    foreach (Student student in Student.AllStudents)
                    {
                        Student.TeleportAllStudentsToClasstimeDestination(); //Where the game hickups on day 2
                    }
                    Debug.LogError("The code teleported all the students!");
                    timeManager.SkipTime(3, 30, true);
                    timeManager.currentEvent.eventName = "After School";
                    StartCoroutine(FadeCallback());
``` This is the code that's calling upon the above method

```cs
    public static void advanceScene(string sceneName, DayWeekManager dayWeekManager)
    {
        SceneManager.LoadScene(sceneName);
        dayWeekManager.AdvanceToNextDay();
    }
``` Then there's this method
#

I might try adding DDOL to all of the classDeskPos areas again, maybe i missed one or smth last time i tried

#

welp, i fixed it by removing the debug lines

cosmic rain
upper pilot
#

Is there a List type like dictionary that doesnt have value?
I want to store a list of enums, but they cant repeat.

wicked scroll
#

you are looking for a Set

upper pilot
#

Hashset

wicked scroll
#

yep

upper pilot
#

Thanks

agile rock
#

but I don't even move. Like in description. I can just rotate the camera by mouse. I can even turn off the whole movement.

last island
#

This bar material is visible in the Editor window for this UI element.
But it's not visible in the Game view during play.

#

What could cause that?

#

The bar is animating in the editor window as well

deft timber
#

this is a code related channel

last island
#

Where do you suggest I go?

knotty sun
last island
#

Thanks

tired prairie
#

hey guys, i made an android game and i wanted to publish it on google play store, but when i tried to put the aab file it says that its bigger than 200 mb and doesnt let me, to avoid this i now use addressables, but now i want to get the addressables from a server, is there a way to use addressables with play asset delivery ? if not can anyone help me make the unity cloud content delivery work ? i have made the code to load the addressables and stuff i just need help with getting it from the server, its giving me an invalid URI: invalid port specified, even though i chose the correct loadpath that unity gave me in the addressables profile

deft timber
topaz plaza
#

When I drag/drop my prefab sword to the equipment slot on my model all looks good.
So I put that prefab into a property of a component in the inspector.

Now I have this logic to do the same but by script:

            _currentModel = Instantiate(weapon.model);
            
            Debug.Log($"[CLIENT] PRefab Transform {weapon.model.gameObject.transform.position}");
            Debug.Log($"[CLIENT] PRefab Transform {weapon.model.gameObject.transform.rotation}");
            Debug.Log($"[CLIENT] PRefab Transform {weapon.model.gameObject.transform.localScale}");
            Debug.Log($"[CLIENT] PRefab Transform {weapon.model.gameObject.transform.lossyScale}");
            
            Debug.Log($"[CLIENT] Weapon Transform {_currentModel.transform.position}");
            Debug.Log($"[CLIENT] Weapon Transform {_currentModel.transform.rotation}");
            Debug.Log($"[CLIENT] Weapon Transform {_currentModel.transform.localScale}");
            Debug.Log($"[CLIENT] Weapon Transform {_currentModel.transform.lossyScale}");
            
            _currentModel.gameObject.transform.SetParent(weaponSlotRight.transform, true);

However things are weird. The scale is completly off the chart and same for the position. I tried many overloads of the SetParent method but nothing does the trick

#

My goal is simply to have that drag/drop gameobject parenting behaviour I experience in the editor but with code

idle flax
#

Hey, I'm trying to add the ability for items in my inventory system to have "inventories" of their own. For example so a gun can have a slot for a magazine, which should have slots for bullets. However, I'm getting the warning "Serialization depth limit 10 exceeded", and I'm not sure how to get around it. Any help appreciated.

SerializableInventory class

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

[System.Serializable]
public class SerializableInventory
{
    public List<SerializableItem> items = new List<SerializableItem>();
}

SerializableItem class

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

[System.Serializable]
public class SerializableItem
{
    public List<Vector2> slots = new List<Vector2>();

    public List<ItemAttribute> instanceAttributes = new List<ItemAttribute>();
    public string itemDataKey;
    public bool rotated;
    public SerializableInventory inventory = new SerializableInventory();
    


}

The "public SerializableInventory inventory = new SerializableInventory();" in the item class is what's causing the warning.

knotty sun
#

using Unity serialization you cannot get around this, it's a restriction built into Unity

idle flax
#

Isn't there a way to add some sort of barrier, so the Inventory -> Item -> Inventory -> Item cycle can't go on forever? I'm assuming that's what's causing the warning, correct me if I'm wrong.

knotty sun
#

you are correct, the solution is not to use Unity serialization

thick terrace
#

i think SerializeReference might be able to do it because the items in the list are nullable then? but there's usually a better way than SerializeReference

#

one way to do it is lay it out as a flat list of items with unique IDs, then give them an optional parent ID, a bit like a database

idle flax
thick terrace
#

mainly the default inspector support for it is not good, at least last time i checked, so you have to write your own editor tools (odin user here, that handles it pretty well)

#

it's also a bit more likely to break if you change the data types because it's not just storing values any more like regular unity serialization, it saves type information too

idle flax
#

All right, that's fine. Thanks

idle flax
#

Getting the same problem but with my non serialized fields. What do I do here?

public class Item
{
    public List<Slot> slots;
    public ItemData itemData;
    public List<ItemAttribute> instanceAttributes;
    public bool rotated = false;
    [System.NonSerialized] public Inventory itemInventory = null;

    public Item(List<Slot> slots, ItemData itemData)
    {
        this.itemData = itemData;
        instanceAttributes = new List<ItemAttribute>(itemData.instanceAttributes);
        this.slots = slots;
    }
}
public class Inventory
{
    public string name;
    [System.NonSerialized] public List<Item> items = new List<Item>();
    public Slot[,] slots;
    public Inventory(Vector2 size, string name)
    {
        this.name = name;
        slots = new Slot[(int)size.x, (int)size.y];

        for (int x = 0; x < slots.GetLength(0); x++)
        {
            for (int y = 0; y < slots.GetLength(1); y++)
            {
                slots[x, y] = new Slot(x, y, this);
            }   
        }
    }
idle flax
thick terrace
#

i think unity will serialize them anyway, eg to show in the debug inspector ๐Ÿ˜”

idle flax
#

Damn, know any way around this?

#

Nevermind, I'm stupid. The warnings are from before I deleted the serialization attribute from my classes. Just forgot to clear the console.

thorn pumice
#

Hey peeps, maybe you can tell me what i am doing wrong: Im not used to using scriptable objects but i wanted to try on this project with this.
I made a SO with a few public attributes, but also some functions for behaviours. Im loading them into the code via [SerializedField] List<MyScrptableObject> sos;

So far so good, I can use them. The problem is, every time I change values it also changes the values on the Scriptable Object itself - so on the next exacution all values are changed.

Im clearly not doing using them correctly... So should I use the SO just to copy the values on an actual game object?

soft shard
# thorn pumice Hey peeps, maybe you can tell me what i am doing wrong: Im not used to using scr...

I always describe scriptable objects like "blueprints for building something", you usually dont want to modify the blueprint, but you might want to reuse the blueprint to make copies of something, so they are great for something like setting the values of a weapon or character type or item etc (and in a build, the modified values will be reset back to the original when the app is re-launched again) - if you did want to modify the values, I normally setup a serialized class and use that, then you can clone the values in another class, for example:

[System.Serializable]
public class SomeData
{
public int someValue;
public float someOtherValue;
}

public class SomeSO : ScriptableObject
{
public SomeData data;

public SomeData Copy()
{
var copy = new SomeData();
copy.someValue = data.someValue;
...
return copy;
}
}

public class SomeUseCase : Mono
{
public SomeSO source;
SomeData session;

void Start() {session = source.Copy();}
}

There are other ways, though this hopefully shows the general idea

placid summit
#

A scriptable object is for static data in my mind, so yeah I would pass it to another class and put the functions on there. But this would be typical of the editor's odd behaviour like when you edit a material at runtime and it changes the core material notlikethis

thorn pumice
#

makes al ot of sense, thanks peeps

soft shard
placid summit
#

except outside the editor this is not a problem, the material will always start the same...

#

afaik

soft shard
# placid summit except outside the editor this is not a problem, the material will always start ...

Right, once you build your game, your assets get compiled into it "as-is" (unless IL2CPP is enabled I think), so I would imagine modifying a material in a build would also revert back to the settings it was built with when you re-launch the game, but in the editor your references point to a specific asset, so your changes would directly affect that asset, unless you do something similar to the example with a "Copy" or "clone", where you create a new instance, fill that instance with data from the asset, and modify/return the instance instead (which for materials, is similar to what GPU Instancing does)

placid summit
soft shard
#

True

neon plank
#

I don't understand a thing about rigidbodies.
I have ragdolls with rigidbodies, but when I apply a force to one of the rigidbodies sometimes it doesn't move.
For example, if I use AddForceAtPosition(new(13.17, -2.66, -6.22), new(-103.86, 37.26, 161.98), ForceMode.Impulse) at a rigidbody at position (-103.70, 37.22, 161.95) with mass 0,9090909 , velocity doesn't change at all... I may not know much about math, but the amount of force aplied is quite hight, and the distance of the force position and the actual rigidbody is super close, it should apply some velocity, but the result is (0.00, 0.00, 0.00)...

normal dust
#

is there an #if UNITY_EDITOR_NOT_IN_PLAYMODE ? or something of the sort? except UNITY_EDITOR

neon plank
heady iris
#

Also, have you checked how AddForce compares? Does it also sometimes do nothing?

proud hare
lapis hull
#

So I'm trying to convert my project over to URP on Unity 2019, but the video I'm following from the Unity YouTube channel right clicks and has an option for "Rendering" in the context menu, I do not have that option, and I've made sure I have the URP addon installed in my project first

thick terrace
lapis hull
neon plank
lapis hull
#

The tutorial is using 2019.3.0b1, I'm using 2019.4.39f1, but I don't think there'd be that much of a change between those versions

thick terrace
thick terrace
# lapis hull

not sure why it would be missing from your version then, have you restarted unity since installing it?

lapis hull
thick terrace
#

any errors in the log?

lapis hull
#

like when installing the addon?

thick terrace
#

like, at all

lapis hull
#

well....yes but shouldn't be related to the URP, all of them are just "Assembly with name XXXXX already exists"

thick terrace
#

if the scripts aren't currently compiling successfully you won't see editor scripts loading either

lapis hull
#

standby I'll try without any scripts running

heady iris
#

You must have zero compile errors.

lapis hull
#

I think it's working now......just a waiting game at this point -_-

fervent sage
#

I am using Unity 2022.3.19f1 and there seems to have been an editor-only cursor regression or API change.
When the screen is maximized hiding and locking the cursor has no effect.

Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
twilit scaffold
#

"Summary of What's New in this Release of Visual Studio 2022 version 17.8.7
Visual Studio is able to run form under the SYSTEM account."
can someone briefly tell me why i would want this?

heady iris
#

jesus

twilit scaffold
#

i'd imagine there is some very good technical reason for it, but i do not know enough to know why. To my limited knowledge, it just sounds like a security issue. Some further reading suggests that maybe it has been able to for a while, and a regression broke it? IRDK

worn night
#

Do you know any good services to get in touch with a mentor? I want to ask some thing about my understanding of managing Unity Codebases for a team (have never done this before)

twilit scaffold
#

maybe try the forums
!collab

tawny elkBOT
worn night
#

Humm interesting, will look at it!

twilit scaffold
#

but if you just have questions, ask them here

worn night
#

They are a bit concrete to the project, and I feel like the solutions I have implemented need a bit of refinement ( I have never done something at that scale so I would like some extra opinion)

#

I would sorta prefer to schedule a meeting or something for this ๐Ÿค—

rigid island
worn night
#

Yep... I know... notlikethis But I think I need it right now, I was seeking options to look at

#

Thanks for the insights though! Will look at them for sure!

rigid island
#

def check out their e-books, they go over stuff like that too for teams

worn night
#

I have read some of them but the one you passed wasn't on my radar, reading it right now ahaha

#

Sometimes I feel you really need to dig down for finding out advanced concepts

rigid island
#

very true lol

hard viper
#

yeah, i wish they spent more time on documentation of that nuance tbh

worn night
#

I recently found out this youtuber: https://youtube.com/@git-amend?si=shcC0oNuA9O2zUSK

This dude is the one that made me thing: Maybe I should get a consultant or something, I feel like my knowledge on Unity can be upgraded a lot for some price

hard viper
#

this page has basically none of the information that you really need to use MovePosition

knotty sun
rigid island
#

tru

worn night
#

Experience is important tho

#

But I feel like sometimes you need some sort of external opinion to get fresh ideas

knotty sun
hard viper
#

you hire a consultant to give you an answer.
you hire a teacher to teach you (eg school)

lean sail
worn night
hard viper
#

a consultantโ€™s main job is not to train/teach

knotty sun
hard viper
#

a consultant consults

worn night
#

I think I had the wrong idea of a consultant then

hard viper
#

i think he means he wants a course on the topic

worn night
#

Maybe I just need more experience tho

#

I just had this insecurity recently

knotty sun
lean sail
worn night
#

Yeah ahaha

hard viper
worn night
knotty sun
worn night
#

ยช I'm a CS student ahaha

#

Probably thats whats happening

hard viper
#

style is important because bad style gets you in deep shit

heady iris
#

if your strategies and styles actually help you to make it work, then go nuts

worn night
#

Altho I like to create a good architecture and stuff

hard viper
#

good style is even more important when working as a team

heady iris
#

but especially when you're a novice, you will have no idea what is and is not important

hard viper
#

if we are on a team, and you write spaghetti, I cannot be bothered to sift through your crap to help you

#

there is a balance, and it is better to overdo it (overdocument, overengineer architecture), and then step back to a more normal workflowโ€ฆ. This is better than starting with shit style, and later trying to go to a better workflow while fixing a bunch of garbage

heady iris
hard viper
#

Start hard and relax > start lazy and then suffer

twilit scaffold
#

DOn't start, never worry

worn night
#

Don't even think, just breath

twilit scaffold
#

Don't breath, no need to think!

hard viper
#

but if you have shit style, and never give a fuck, no one will want to work on your code, especially you

twilit scaffold
#

Pffft, that's a problem for Future Bean!

knotty sun
hard viper
#

style is something you are almost exclusively taught in university. few people learn style outside of that, outside of a very slow process of osmosis

#

if my professors never taught me style and what to look for 15 years ago, i would probably not write very clean code today

knotty sun
#

not true, style is learned from people who are more experienced than you, you are unlikely to find that in an academic environment

heady iris
#

i do not recall being taught code style very thoroughly

hard viper
#

it was drilled into me

#

i cannot forget

heady iris
#

most of my "style" is just running the auto-formatter and the rest is loosely following microsoft's C# style guide

#

everything else is design, not style

hard viper
#

design =/= style

#

but certain designs are shit style. eg 100 if else if else if in a row

dull quarry
#
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class menuservera : MonoBehaviour
{
    MenedzerPolaczen mp;
    public InputField Ifnick;
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(gameObject);
        mp = GetComponent<MenedzerPolaczen>();
    }

    // Update is called once per frame
    void Update()
    {
       
    }
    public void startgra()
    {
        if(Ifnick.text.Length >= 4)
        {
            PhotonNetwork.playerName = Ifnick.text;
            mp.polacz();
        }
        
        


    }
}
worn night
#

I still think you need to learn from references and people who are better than you... The same like an artist who watches other people art, I like to think this translates to code too

hard viper
#

which is a major hindrance to the process of learning style outside of academia

hard viper
#

thatโ€™s why i most highly value style learned via academia, even though it can be overbearing. The core principles are at least correct

dull quarry
knotty sun
thick terrace
ivory igloo
#

any way I can replicate this in the inspector using shadergraph?

lapis hull
#

So I managed to get my project converted to URP, but now all my textures are missing from the scene lol

hard viper
#

my professors in academia knew their shit. that might not be true everywhere, but they are still more qualified than the average Unity youtuber from which most people learn what C# code is โ€œsupposedโ€ to look like

ivory igloo
#

to URP equivalents (if exist)

dull quarry
# thick terrace for the type of `Ifnick`
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;



public class menuservera : MonoBehaviour
{
    MenedzerPolaczen mp;
    public InputField TMP_InputField;
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(gameObject);
        mp = GetComponent<MenedzerPolaczen>();
    }

    // Update is called once per frame
    void Update()
    {
       
    }
    public void startgra()
    {
        if(TMP_InputField.text.Length >= 4)
        {
            PhotonNetwork.playerName = TMP_InputField.text;
            mp.polacz();
        }
        
        


    }
}
``` it doesn`t work
worn night
#

The reason I had all this doubts btw is that we are starting a project which is more "professional" with my collegues. I have been given sorta the role to manage the codebase and think about the structure.

I want to do it as good as I can but I feel it might start to be too much for me as I cannot find a solution I like and I don't know if I will tbh which thats good ๐Ÿค—. Anyway I'm learing a lot just wanted to make sure i'm on the right path ๐Ÿ‘

ivory igloo
hard viper
ivory igloo
hard viper
#

that is just a bad tutorial

#

of which there are many

ivory igloo
#

hence the most in that sentence

dull quarry
# thick terrace the type, not the name
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;



public class menuservera : MonoBehaviour
{
    MenedzerPolaczen mp;
    public TMP_InputField ifnick;
    // Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(gameObject);
        mp = GetComponent<MenedzerPolaczen>();
    }

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

    }
    public void startgra()
    {
        if (TMP_InputField.text.Length >= 4)
        {
            PhotonNetwork.playerName = TMP_InputField.text;
            mp.polacz();
        }




    }
}``` again, it doesnt work
ivory igloo
#

like thank you I now have a step by step guide on how to achieve this very specific thing with no suggestions on how to deviate

but why did I do any of this

#

I think why is a much more important question to have an answer to compared to how

rigid island
#

your TMP_InputField reference is stored in ifnick @dull quarry

#

why are you using the class itself

thick terrace
lapis hull
knotty sun
rigid island
lapis hull
ivory igloo
#

oh myb my question wasnt either I thought I was un unity-talk

#

in**

lean sail
dull quarry
rigid island
#

please go do beginner courses again and learn how references work.

dull quarry
#

references wtf

rigid island
#

you're missing the fundamentals of coding

#

references should be one of your top lessons

dull quarry
lean sail
rigid island
#

you just aren't using it properly..

#

You do not use the Class unless it was static or its method/members were

#

You use the instance of the class

dull quarry
rigid island
knotty sun
hard viper
#

because any code written with poor style takes much longer to read and understand (and understand what is wrong) to then fix

heady iris
#

i have to wonder if some of that game's code was the result of codegen

#

there's no way a human being would write such a catastrophically long if / else if / else if / ... / else chain

hard viper
#

that tech was too primitive when he started so many years ago

#

it is almost certainly man made

#

good style vs bad style is basically the difference between these two pictures. If it works, everything is fine. The difference only becomes apparent if you need to fix/change anything.

lean sail
hard viper
#

every game will almost certainly have a time in development where it doesnโ€™t run fine. Which requires you to be able to fix it.

#

so if you write working code which is difficult to fix, you will eventually have a game that does not function

dark laurel
#

Hello guys! i need help

hard viper
#

hello

mossy minnow
#

how would i go about making my movement input (which is a vector2) relative to the cameras view instead of world-space?

dark laurel
dark laurel
heady iris
#

this isn't a code problem, but...there's no data folder at all

hard viper
heady iris
#

It looks like you moverd the executable into the data folder?

dark laurel
#

and i try to start this game

heady iris
#

the built game folder should contain GameName_Data and GameName.exe in it

fringe ridge
#

im currently profiling my UI, and noticed that .SetActive is expensive? Is it better to disable canvas component on UI object to hide them instead of the whole gameObject?

naive swallow
#

With everything in it, where the build process put it

#

And also this still isn't a code question

thick terrace
vagrant agate
brazen tartan
#

From where do you get your sounds for the games ?? Or any tips for like making audios? I never gone deep in that audio creating stuff

spring creek
brazen tartan
#

oh jeah right thanks

opaque fox
#

hello everyone, I have been struggling with a problem where the player is dying the moment the damagePlayer() method is played, it is connected to an animation event (the player health is 100.) https://hatebin.com/hwkvdagtcj

heady iris
#

well, have you checked how many times the method is being called?

#

e.g. by logging when it's called

opaque fox
#

it is immediately killing the player

#

@heady iris i will try that

hard viper
#

why are your functions not capitalized? itโ€™s so confusing lol

knotty sun
opaque fox
#

it is in another file

#

it is a global variable

knotty sun
#

so?, atm you are just assuming it's value

hard viper
#

playerHealth should be a property that automatically invokes an event Action called OnPlayerDeath when health is zero. Animation script should subscribe the death animation to that event

opaque fox
#

No it is 100 health

#

@knotty sun

knotty sun
#

prove it, log it

opaque fox
#

Alsso I logged it and it is playing the animaiton event twice

swift falcon
#

The debug.Log() should be in damagePlayer()

opaque fox
#

it is i just did that

#

btw potatoes is the log for whjen the player is damaged

swift falcon
#

Why not just make the text Player Damaged?

opaque fox
#

i felt like it sry

hard viper
#

player health should not be a public field, btw. It should only have a publicly accessible property, at most.

opaque fox
#

my brain turned off

swift falcon
#

Its ok ur just making harder to read for us

opaque fox
#

@swift falcon sry bout that

swift falcon
#

Its fine

opaque fox
#

my brain turned off

hard viper
opaque fox
#

so it can detect beign punched

knotty sun
swift falcon
#

Yeah lmao

#

Just help him

#

He more than likely doesnt even know about event systems

opaque fox
#

wait is the animation event playing before and after the event plays

hard viper
#

iโ€™m trying to show him that you donโ€™t just need to make everything public -.-

swift falcon
#

The animation event gets called wherever u put it on the animation

opaque fox
#

i made it public so it can be accessed from the cowboy script

hard viper
#

even without an event system, this gives more control

swift falcon
#

U have a tendency to do information overload

hard viper
#
public int Health {
   get => _health;
   set {
      _health = value;
      Debug.Log(โ€œNew health is โ€œ + _health);
   }
}```
opaque fox
hard viper
#

that code will literally let you know wtf is going on with the health and when it gets modified

#

which is one of the things you need to do to solve your problem

swift falcon
opaque fox
#

so it is playing the damage method twice instead of once

swift falcon
#

Whos calling the Damage method

opaque fox
#

cowboy script

swift falcon
#

Can we see that?

hard viper
#

what method

opaque fox
#
            Debug.Log("Player Damaged");
            Player.playerHealth -= 50;
        }```
hard viper
#

thatโ€™s not what we are asking

swift falcon
#

Wait what

hard viper
#

what is calling that method twice

opaque fox
#

animation event

#

sry

swift falcon
#

This code doesnt make any sense

opaque fox
#

how?

swift falcon
#

Show me ur Player script

opaque fox
#

player

#

I should probably move that right

knotty sun
swift falcon
#

Thats what i said lmao

#

Why give it potatoes? Ur only making it hard to read

opaque fox
#

fair enough

#

ill change it

swift falcon
#

Where on the animation is the animation event

#

Screenshot it and send it to us

opaque fox
#

the moment it makes contact

swift falcon
#

You can stack animation events

#

Show the full screen pls

opaque fox
#

wait i did

#

my bad

#

lol

swift falcon
#

U did what?

opaque fox
#

stack animation event

swift falcon
#

U had two events?

opaque fox
#

yup

#

i did not realise

swift falcon
#

I had a feeling

opaque fox
#

lol

#

ill test

#

yes it worked

#

tysm

swift falcon
#

Ofc

rigid island
simple egret
#

Don't post the same question in multiple channels. You need some kind of networking protocol. Unity provide some. Ask in #archived-networking for more information. Be wary that it complexifies programming significantly, and is not recommended for beginners.

rigid island
#

LAN will not make it any less difficult than over Internet

#

the only differences is the port opening . You're better off learning couch Co-Op first

swift falcon
#

https://gdl.space/bimicoqeru.cs
I'm randomly generating my map but I get a issue when I try to rotate it the object. With no rotation, the pivot is at like the bottom right of the prefab so it fills up the cells but how do I change the pivot when it rotates.

#

I believe this is actually a common issue in unity

#

Theres packages that let u dynamically change the pivot point on objects u cant do this out of the box in unity

rigid island
#

Probuilder can, I wonder if you can extract that function for runtime

swift falcon
#

Ah ok forgot about probuilder

rigid island
river moth
#

hey im coding an 2d Platformer and im having my player as a prefab and the moment i execute my script to load the next scene it crashes and says (that my rigidbody was destroyed and im trying to acces it) but i have no clue how since i have a new player (with the same prefab) in the nwe scene and the player controller script assigned to it

somber nacelle
river moth
#

ok my apologies

#

MissingReferenceException: The object of type 'Rigidbody2D' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Rigidbody2D.get_velocity () (at <8a082034ac0e43f7a55898853ac40f9e>:0)
Videogames2024.PlayerController.RemoveTransientVelocity () (at Assets/Scripts/PlayerController.cs:171)
Videogames2024.PlayerController.TickFixedUpdate (System.Single delta) (at Assets/Scripts/PlayerController.cs:73)
Videogames2024.PhysicsSimulator.FixedUpdate () (at Assets/Scripts/PhysicsSimulator.cs:45)

somber nacelle
#

still need to see the relevant code

river moth
#

i dont exactly know where the error is

rigid island
#

its trying to do a Get on the velocity property but rb is destroyed

somber nacelle
#

yeah it seems like you add the objects to a hashset on your PhysicsSimulator singleton but then you don't remove them when they are destroyed

#

and since the singleton is DDOL it is the same instance in each scene so it keeps those references to the destroyed objects since you never clean them up

river moth
#

ah i see ty

rigid island
#

man if you're using regions, you got too much code tbh

river moth
#

what you mean by that?

somber nacelle
rigid island
#

idk I feel like thats when you know this class does too much

#

like its gathering inputs? it should only receive them not necessary track them

river moth
#

yeah get what you mean

#

not exactly the pretty way of doing it xD

rigid island
#

ig its preference lol

somber nacelle
rigid island
#

yeah true I meant it differently, my wording sometimes ๐Ÿ˜… Regions are very useful just meant the class was a monolith and yeah symptom for sure . I def use them too

#

didn't mean it like regions = bad code , but yeah it come off that way

terse surge
#

https://gdl.space/upimejicoq.cs

The problem:
Once PlayerCrouchHit is done playing it goes to idle for a very quick moment rather than back to PlayerCoruch

seems to be an issue with line 117. The warning I get:

somber nacelle
#

seems you don't have a state called PlayerCrouch

terse surge
#

That is indeed what it says, however

#

it plays it fine just not when its after playercrouchhit

#

maybe i should just remove that line?

#

after all once player crouch hit ends the only animation parameter that can be true if user is pressing down is the crouch anyways so..

#

maybe that will work?

rigid island
#

btw canMove = animator.GetBool("PlayerCrouch") ? false : true;
can just be canMove = !animator.GetBool("PlayerCrouch")
Ternary unnecessary here ๐Ÿค“

rigid island
terse surge
#

well it still same name..?

#

right

#

ion get it

#

looks to be same name

#

how would it even change name

rigid island
#

Just wanted to check the names in the actual controller

terse surge
#

oh alr

#

i should note this wasnt a problem before i introduced a second layer + a few things that were connected to this

rigid island
#

well are you checking for layer 2?

#

ever

#

since here you only check the one with index 0
GetCurrentAnimatorStateInfo(0)

terse surge
#

cuz it is suppsoed to only check there

rigid island
#

Baselayer seems to be on (1)

terse surge
#

so layer 2 is index 0?

rigid island
#

Layer2 seems to be index 0 though and BaseLayer index 1

lethal rivet
#

Is there a data type that works in the editor like a layer mask does, where I can make multiple selections out of a list of options? I plan to use it as possible game modes for a map represented with a Scriptable Object.

somber nacelle
#

flags enum

lethal rivet
#

Thank you!

terse surge
rigid island
#

nice

terse surge
#

so i should be checking in index 1

rigid island
#

yeah

terse surge
#

since i am not providing an index it uses 0 as default

rigid island
#

make your index a param or make it a separate method

terse surge
#

i use layer 2 only for invincibility animation when hit

rigid island
#

yea you know your project best UnityChanThumbsUp

terse surge
#

ok thanks

#

one small problem tho

#

its not playing the animation at the end like it used to

#

so the last paranmeter of the animation.play is the time of the animation it is suppsoed to start playing the animation, right?

#

this animation is 20 frames

#

wait length doesnt matter

rigid island
#

not sure on that one, I dont use Play. Usually I do transitions

terse surge
#

cuz 0 is beginning and 1 is always the end

#

dang

#

its still not playing the animation at the end ๐Ÿ˜ค

wraith cobalt
scarlet kindle
#

Hey this is kinda embarrassing, but I'm getting a simple

NullReferenceException: Object reference not set to an instance of an object

error, however, it's pointing to a blank line in VSC? I've checked editor references around that section of code and everything seems fine. I haven't even been touching that part of my project, so I'm really confused why it started randomly

#

I tried restarting Unity & my PC, didn't help

#

ok i found a fix, changing some initialization of a struct to Awake rather than Start for one of my monobehaviors... however, I'm unclear on why this started in the first place? I was adding more gameobjects to a particular scene that appeared to trigger this

#

it seems that maybe adding more GOs changed the random order it was creating other ones in the scene?

#

I think I'm confused about how to properly preserve order of important things, I guess as a rule of thumb, if I need to initialize any data structs, always do this in Awake rather than Start?

hot sorrel
#

Hi, what is the correct implementation of a one line event subscription using lambdas and how do i unsubscribe from that event?

I believe what I have attached works but how do I go about unsubscribing if there isnt a function "name" / "tag"?:

_player.GroundChecker.ReturnGrounded += value => { if (!value) _player.UpdateState(PlayerStateEnum.FallState); };

lean sail
somber nacelle
#

you cannot unsubscribe if you subscribe using a lambda expression like that. you'd have to store the lamdba in a delegate and subscribe that then you can unsubscribe that delegate. otherwise use a method

hot sorrel
#

mm ok thanks, i was trying to avoid having methods for every subscription but its probably just the simplest. all goods

somber nacelle
#

if the event is not static and both objects are destroyed at the same time and you only plan to unsubscribe on destroy, then you don't actually need to unsubscribe so you could use lambda expressions there no problem. but if the method is static or the subscriber is destroyed before the object with the event then you'd have to unsubscribe so you'd need either a method or a delegate variable

wicked scroll
# scarlet kindle it seems that maybe adding more GOs changed the random order it was creating oth...

Yep, you can't assume unity will initialize individual objects in any sort of consistent order. You can manage the order of specific components if you want to (https://docs.unity3d.com/Manual/class-MonoManager.html), but generally you should initialize stuff in Awake and then connect stuff in Start. So if you have data which needs to exist you should ensure that it is does in awake so that any script trying to access it can rely on it being ready when Start() runs.

scarlet kindle
wicked scroll
#

FWIW I tend to toss an Init() method on my monobehaviors and initialize them myself so that i can manage all that without dealing with unity's stuff, but that doesn't make sense for every setup

scarlet kindle
wicked scroll
#

I generate them from the gamestate, so there are various views which are responsible for querying that data and then building/initializing/updating the objects to represent it in the game world

#

and then i guess the order doesn't matter? dependencies are linked together already in prefabs for the most part

#

or resolved much later when everything definitely exists

#

i guess i could initialize or render the views in a particular order if i cared to by registering them in that order but it's never come up

scarlet kindle
#

So if I understand correctly, you're using MVC with Unity?

#

that's very interesting indeed

hollow swan
#

Hey guys so i have a big problem i'm trying to make a dialogue system for my game and i use

public void TriggerDialogue ()
{
FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
}
Everything work well if i start the dialogue from a button on the UI.
but if i try to call TriggerDialogue(); from anywhere else like Void Start()
I get this error

NullReferenceExceptiton: Object reference not set to an instance of an object
DialogueTrigger.TriggerDialogue() (at Assets/Dialogue System/Assets/DialogueTrigger.cs:16

rigid island
somber nacelle
#

seems like at the time you call that method there is no DialogueManager in the scene

somber nacelle
naive swallow
hollow swan
somber nacelle
#

you can say that it is there, but the evidence points to it not being there or not being active

naive swallow
spring creek
hollow swan
spring creek
hollow swan
#

no that not what i mean't

wicked scroll
# scarlet kindle So if I understand correctly, you're using MVC with Unity?

I guess so, though 'controllers' don't really fit in conceptually because unlike a web app where resources tend to be accessed directly, games tend to be more about abstract actions, so that's where my state updates come from. It might be closer to CQRS? But I don't know the exact definitions for everything.

spring creek
hollow swan
#

idk why

#

I did not change anything and just start it again but this time it work

#

also last time everything was active or existing just it wouldn't work for some reason

spring creek
#

Sounds like last time it ran in an order that caused an error

hollow swan
#

I was using this bit of code but each time i was putting TriggerDialogue(); in start to start the dialogue when i start the game it wouldn't work for some reason but now it does?

rigid island
hollow swan
#

i'm using a tutorial so why it not just assigned to the inspector idk but i thing it in case you have multiple dialogue and the name of the object is DialogueManager too

#

if you need the tutorial link i can send it

hollow swan
#

when i press the button everything work but not when the game is starting

#

Why? IDK

swift falcon
#

Ur getting a NRE

#

Make sure whatever ur trying reference isn't null

hollow swan
#

it shouldn't be null if it work when i press the button but not on start

swift falcon
#

The NRE is triggered from a different class from the one posted check in there

hollow swan
#

it telling me about this but i don't see the problem about that

#

and when i remove it it tell me the same for sentences.Enqueue(sentence);

swift falcon
#

I'm not to familiar with the Queue type to be quite honest

#

Share the whole class

hollow swan
#

i don't know why it work when i trigger it with a button but not with the void start it weird

mild coyote
swift falcon
#

Oh that'll do it

hollow swan
#

yeah

#

thanks man

#

not sure how you use awake but think i can do it

swift falcon
#

Awake is called before Start

somber nacelle
#

you don't even need Awake for this. just initialize the sentences queue in the field initializer

swift falcon
#

That to

hollow swan
#

YEAH

#

IT WORK

#

DUDE IT BEEN 1 WHOLE DAY I'M WORKING ON THIS

#

THANK YOU SO MUCH

#

I was litteraly about to go crazy XD

#

it would maybe have been easier to use an other way but i really wanted to use this one

#

and it finaly fixed thank you so much guys

#

idk why tho but i have an other project having the exact same file but it actualy work it weird but yeah?

thin hollow
#

Is there a way of locating assets from code without storing it as an explicit reference variable and without the need to dump everything into Resources folder?

sand iris
#

heyya wsg

somber nacelle
#

addressables. or if this is for editor-only stuff you can use the AssetDatabase class

thin hollow
somber nacelle
#

you can still use addressables. it is available for many versions, you're just looking at the page that lists the latest version that is for 2022.3

thin hollow
thin hollow
#

I've rewrote it as such, but IDK if it's fine this way. I think it should be fine if I call "Get" from my game manager singleton on the first chance it gets though...


        static GameObjectsList instance;
        private static AsyncOperationHandle<GameObjectsList> asyncLoad;

        public static GameObjectsList Get()
        {
            if (instance == null)
            {
                if(!asyncLoad.IsValid() )
                {
                    asyncLoad = Addressables.LoadAssetAsync<GameObjectsList>("Assets/Cliffworld/GameplayData/GameObjectsList.asset");
                    asyncLoad.Completed += h => { Get().Rebuild();};
                }
                else if(asyncLoad.Status != AsyncOperationStatus.None)
                {
                    instance = asyncLoad.Result;
                    if (instance == null)
                        DevLog.LogError("GameObjectsList scripted asset not found in GameplayData folder! Did you forgot to create it?!");
                }
            }

            return instance;
        }
somber nacelle
thin hollow
somber nacelle
#

where do you see that

thin hollow
#

Unless I misunderstood?

thin hollow
somber nacelle
#

asyncLoad.Completed += h => { Get().Rebuild();};
this line will not return the instance object to whatever initially called Get()

thin hollow
#

Maybe I should just put the content of "else if" portion into that lambda, then?

somber nacelle
#

that lambda will be entirely unrelated to whatever has called Get in the first place. whatever calls Get will end up receiving null if you enter that first inner if statement

thin hollow
#

Saving throw is that there are no such scripts on my loading screen and main menu scenes, where GameManager is being instantiated...

somber nacelle
#

just call WaitForCompletion on the async operation handle returned by LoadAssetAsync to make it run synchronously

hoary mason
#

is there any way to do the SelectionChanged callback on runtime?

quartz folio
#

There is no such thing as selection at runtime

#

Implement whatever your selection system is yourself

hoary mason
#

well basically wanted to do an OnUnselect, found out IDeselectHandler existed

#

yeah that works

quartz folio
#

Ah, UGUI

hard viper
#

UGUI = unity graphical user interface
UUGUUIUU = unity user graphical unity user interface for unity users

hoary mason
#

is there any way to check if the mouse is hovering over a non-UI object

rigid island
#

you still need collider for that tho

#

UI uses rect transforms somehow, no idea how it works on the back end

latent latch
#

Can just check if it's currently not hovering over a UI object

tawny mountain
#

Can someone help me figure this out? I'm trying to represent hours and minutes and floats (i.e 1 hour = 1.0 , 1 hour 30 min = 1.5 , 1 hour 45 min = 1.75, an so on)...

I'm getting timestamps and trying to get the diffrence in hours and / or minutes

public void CalculateHoursWorked()
{
    TimeSpan timeDifference = clockInDateTime - clockOutDateTime;

    hoursWorked = timeDifference.TotalHours;

    Debug.Log("hoursWorked Time difference in hours: " + hoursWorked);
}

public void CalculateLunchBreak()
{
    TimeSpan timeDifference = startLunchDateTime - endLunchDateTime;

    lunchBreak = timeDifference.TotalMinutes;

    Debug.Log("lunchBreak Time difference in minutes: " + lunchBreak);
}

but you can see in the screenshot the values as a double but if i convert to a float with a cast I'll get values like 17734516.83

#

Should I just use a float to count and convert to times for displaying?

knotty sun
tawny mountain
#

I'm still going to make those changes and try again

knotty sun
tawny mountain
#

Idk , I made your mentioned changes and running it again

tawny mountain
# knotty sun how could you get a negative result from BigNumber - LittleNumber ?
public void CalculateHoursWorked()
{
    TimeSpan timeDifference = clockOutDateTime - clockInDateTime;

    hoursWorked = timeDifference.TotalHours;

    Debug.Log("hoursWorked Time difference in hours: " + hoursWorked);
}

public void CalculateLunchBreak()
{
    TimeSpan timeDifference = endLunchDateTime - startLunchDateTime;

    lunchBreak = timeDifference.TotalMinutes;

    Debug.Log("lunchBreak Time difference in minutes: " + lunchBreak);
}
tawny mountain
knotty sun
dawn nebula
#

How do you guys typically handle collectables? Aka you collect a thing and the game remembers you got it and doesn't spawn it again.

#

Just ID the shit out of everything?

tawny mountain
dawn nebula
#

I mean it needs to be saved.

tawny mountain
#

Id's seems to be the way people are describing online , the few I found

clever lagoon
#

I like TextMeshProโ€™s auto-size feature, but I need to make a bunch of canvas texts (TextMeshProUGUI) all use the same, smallest needed size of the bunch. Is there a pre-made class/component to do that?

tawny mountain
tawny mountain
# knotty sun post your latest code
public void CalculateHoursWorked()
{
    TimeSpan timeDifference = new TimeSpan(clockOutDateTime.Ticks - clockInDateTime.Ticks);

    hoursWorked = timeDifference.TotalHours;

    Debug.Log("hoursWorked Time difference in hours: " + hoursWorked);
}

public void CalculateLunchBreak()
{
    TimeSpan timeDifference = new TimeSpan(endLunchDateTime.Ticks - startLunchDateTime.Ticks);

    lunchBreak = timeDifference.TotalMinutes;

    Debug.Log("lunchBreak Time difference in minutes: " + lunchBreak);
}
clever lagoon
#

yeah, no .Ticks TimeSpan timeDifference = new TimeSpan(endLunchDateTime - startLunchDateTime); at least non on example page

clever lagoon
knotty sun
wicked scroll
dawn nebula
wicked scroll
#

for something as simple as collectibles though maybe even bothering to come up with names is overkill

dawn nebula
#

Probably worth it to have something a little robust.

wicked scroll
#

i'm just imagining like...if you are placing coins in a mario level, you probably don't want to have to come up with a string name for each coin

dawn nebula
#

Nah that's ridiculous.

#

Just have them send an event to tick up some value.

wicked scroll
#

but if it's like a weapon or something that is unlocked, that you need to be able to persist so it needs an ID and you may as well have it be something descriptive

dawn nebula
#

Moons from Mario Odessey would be a better comparison.

#

Objects that need to be tracked.

#

And should not reappear.

wicked scroll
#

yeah, those having names would be nice because it would make it easier to keep track of how accessible specific ones are and whatnot

dawn nebula
#

Like for the Moon example

Mn-107

wicked scroll
#

the alternative would be to fully serialize each pickup, which you could do but might regret later if they end up having more data in them

dawn nebula
#

In the scriptable object I can just have a reference to the prefab that it's supposed to represent.

#

In the case of an enemy or a "Moon".

#

As well as the ID.

wicked scroll
#

that also can get annoying if you are moving them around a lot and then want to change their id

dawn nebula
#

Prefix and then number sounds fine.

#

Pure number sounds horrific.

wicked scroll
wicked scroll
#

ultimately though it's pretty arbitrary, so do whatever is useful for you

dawn nebula
#

Incoming Smith

knotty sun
#

why not use an enum?

dawn nebula
wicked scroll
#

mapping an enum to an SO is kind of annoying

#

and uncessary

#

but you need the SO since it has the prefab ref

knotty sun
#

a damn sight easier and cleaner than relying on strings

wicked scroll
#

you don't actually use the strings directly, except in cases where that's useful (like a command line interface)

#

there should be asingle source of truth

dawn nebula
#

I'm pretty sure the souls games and Elden Ring use a numbered ID system

#

Lots of card games also use internal string Ids.

#

though Ive sen some with enums

wicked scroll
#

i usually number id things that i'm spawning at runtime and string id or enum (if they are realtively constant) things i set at design time (usually as SOs)

#

yeah, like my 'cards' have string ids for the SO they are based on, but the instance of the card has a number id since those are spawned at runtime

#

cards all have names so it makes sense to give the canonical versions string ids

#

and so that you can have a debug CLI in your game to do stuff like addCardToHand flailing_blow

#

but for something like moons which are only placed at level design time and don't really get instanced, i could go either way

tawny mountain
#

hours worked is in hours
lunch break is in minutes

#

with this ```cs
public void CalculateHoursWorked()
{
TimeSpan timeDifference = new TimeSpan(clockOutDateTime.Ticks - clockInDateTime.Ticks);

hoursWorked = (float)timeDifference.TotalHours;

Debug.Log("hoursWorked Time difference in hours: " + hoursWorked);

}

public void CalculateLunchBreak()
{
TimeSpan timeDifference = new TimeSpan(endLunchDateTime.Ticks - startLunchDateTime.Ticks);

lunchBreak = (float)timeDifference.TotalMinutes;

Debug.Log("lunchBreak Time difference in minutes: " + lunchBreak);

}

#

so it was how I was geting DateTime originally

terse surge
# wraith cobalt What do you mean, 'at the end?' What exactly are you trying to do?

PlayerCrouch has is an animation that shows the player goong from a standing pose to crouching

PlayerCrouchHit is an animation that plays that basically has the crouch player move his shield so it looks like the fireball has been deflected, but when going back to crouch (both are non loop animations btw) it snaps from crouched (cuz thats how player crouch hit looks like) to standing then it crouches again cuz thats how the crouch animation goes

Thats why if the last animation is crouch hit i wanna play player crouch but at the end of the animation where the crouchong part is done and the player is already crouched so it becomes a seemless transition

wraith cobalt
terse surge
#

Is it more effecient to play the animation at the kater stage? That way i avoid making yet another animation cuz i already have a bunch

worldly hull
#

how to force unity to serialize dictionary?

#

or just give up and make it public lol

deft timber
#

you need to make your own property drawer for that

#

or use some online serializable dicitonaries

worldly hull
#

sad

deft timber
#

i made mine like this

#

<int, bool>

worldly hull
#

i gonna look for another way to do this then

deft timber
#

i can even make dictionairies in dictionaries ๐Ÿ˜„

worldly hull
#

basically what i need :

  1. read a int value from parameter
  2. find a texture in a collection
  3. map it onto a material
deft timber
#

<enum, <int, bool>>

worldly hull
#

so dictionary should be better

deft timber
#

it's pretty easy

#

plenty of tutorials

scarlet anvil
#

Hello all, quick question, is there still no straightforward way to use anaylzers/generators without needing an intermediate dll?

chilly surge
#

Although building the dll isn't that much of an issue, presumably you are not changing your analyzers and generators often.

scarlet anvil
#

Erh, I guess I'll make a tool to build the solution and apply the tag to the dll then

scarlet anvil
chilly surge
scarlet anvil
#

I don't really want to store the .dll in VCS

chilly surge
#

Hmm, fair.

#

It's what I do, it's ugly yeah but I don't change them often, and not needing to rebuild it whenever I checkout the project is worth that ugliness.

scarlet anvil
#

And if you don't, then I don't want everybody that need to boot up Unity to know how to compile the other solution, copy the .dll in the right place, and tag it properly, especially artists etc.

thick terrace
#

as weird as it feels checking in DLLs is pretty normal in unity, even with an automatic build system or something it's so much easier to know that everyone on the team is getting the exact same DLL and you don't have to worry about build issues or everyone having build tools installed

tough obsidian
#

hi actually i have removed the google ads from a project and created a build but the apk is crashing with the android runtime error on the logcat
is their some thing wrong with my gradle file?? i'll attach it with this message
apply plugin: 'com.android.library'
APPLY_PLUGINS

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.gms:play-services-ads:20.4.0'
constraints {
implementation('androidx.work:work-runtime:2.7.0') {
because '''androidx.work:work-runtime:2.1.0 pulled from
play-services-ads has a bug using PendingIntent without
FLAG_IMMUTABLE or FLAG_MUTABLE and will fail in Apps
targeting S+.'''
}
}
// Android Resolver Dependencies End
DEPS
}

android {
ndkPath "NDKPATH"

compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'

compileOptions {
    sourceCompatibility JavaVersion.VERSION_11
    targetCompatibility JavaVersion.VERSION_11
}

defaultConfig {
    minSdkVersion **MINSDKVERSION**
    targetSdkVersion **TARGETSDKVERSION**
    ndk {
        abiFilters **ABIFILTERS**
    }
    versionCode **VERSIONCODE**
    versionName '**VERSIONNAME**'
    consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}

lintOptions {
    abortOnError false
}

aaptOptions {
    noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
    ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**PACKAGING_OPTIONS**

}
IL_CPP_BUILD_SETUP
SOURCE_BUILD_SETUP
EXTERNAL_SOURCES

fiery saddle
#

I have quite strange bug. I have sound source that has mixer connected. First sound on that source gets played but others dont. Anyone encountered this behaviour?

deft timber
opaque prawn
#

Morning all. I'm evaluating water depth for players using FindWaterSurfaceHeight. When running as a server, with no active camera present, it seems this function doesn't work. Does anyone know how you could still return depth at a specific point in a water plane when no camera exists?

wind needle
#

Hey! I have this annoying problem with VS Code putting starting braces on a new line, instead of if (foo) {. I've set csharp_new_line_before_open_brace = none in .editorconfig, and some days it works! Very random, very inconsistent. I worked on this yesterday, and everything was working. Started VS Code today, and when I save it reformats the whole file.

Not sure how to debug this, and it's driving me mad. Do you have the same experience?

chilly surge
#

Although I do have to say, braces on new line is the C# convention, you should probably get used to it and follow it like rest of the community ๐Ÿ˜‰

wind needle
#

I've tried both. Is any preferred?

Ah, hate that convention. So very verbose, and leads to people skipping braces completely, which is a problem on its own.