#archived-code-general

1 messages ยท Page 352 of 1

hidden flicker
#

This is the code

#

The object always has a connectedobject assigned

#

And yet it attempts connect

#

And it passes the condition of NOT having an object assigned, even when it ALWAYS has an object assigned

#

Actually, it DOESNT always have an object assigned apparently

#

Even though nowhere in the code does it remove it

#

Connectedobject isnt modified anywhere in the code

#

At all

cosmic rain
hidden flicker
#

It's initially assigned in the inspector

#

And it's not like it gets unassigned or anything

#

It always shows up

cosmic rain
hidden flicker
#

the connectedObject variable

cosmic rain
#

Okay, and the exact issue is?

#

Are you getting a null reference or something?

lament island
#

Trying to serialize a hashset for use in the editor but I don't seem to be able to actually edit the list to make changes

[System.Serializable]
public class SerializableHashSet<T> : ISerializationCallbackReceiver
{
    private HashSet<T> hashSet = new HashSet<T>();

    [SerializeField]
    private List<T> serializableItems;

    void ISerializationCallbackReceiver.OnBeforeSerialize()
    {
        this.serializableItems.Clear();
        this.serializableItems = new List<T>(this.hashSet);
    }

    void ISerializationCallbackReceiver.OnAfterDeserialize()
    {
        hashSet.Clear();
        foreach (T item in this.serializableItems)
        {
            _ = this.hashSet.Add(item);
        }
    }

    public bool Add(T item) => this.hashSet.Add(item);

    public bool Contains(T item) => this.hashSet.Contains(item);
}

What am I doing wrong here?

hidden flicker
cosmic rain
hidden flicker
#

A Debug.Log(). When the (connectedObject || connectedSocket) case does not pass, I print what connectedObject is. It returns null

cosmic rain
cosmic rain
hidden flicker
cosmic rain
hidden flicker
#

Yeah, I added it in after the fact

cosmic rain
#

Share the updated code then

hidden flicker
#

I mean, there aren't any other changes other than a log

lament island
# cosmic rain What's with that underscore in deserialize?

my bad, that was an old version with some non working parts. Here is the corrected code

public class SerializableHashSet<T> : ISerializationCallbackReceiver
{
    private HashSet<T> hashSet = new HashSet<T>();

    [SerializeField]
    private List<T> serializableItems = new List<T>();

    void ISerializationCallbackReceiver.OnBeforeSerialize()
    {
        this.serializableItems.Clear();
        this.serializableItems = new List<T>(this.hashSet);
    }

    void ISerializationCallbackReceiver.OnAfterDeserialize()
    {
        hashSet.Clear();
        foreach (T item in this.serializableItems)
        {
            this.hashSet.Add(item);
        }
    }

    public bool Add(T item) => this.hashSet.Add(item);

    public bool Contains(T item) => this.hashSet.Contains(item);
}
cosmic rain
cosmic rain
raven orbit
#

im watching a tutorial, and it is a bit too advanced for me and its hard for me to understand the code hes writing

lament island
raven orbit
#

should i watch a more simple one?

#

i cant find anything more elaborate

cosmic rain
hidden flicker
#

This has to be a Unity glitch

#

I'm so confused

hard estuary
cosmic rain
#

Then you can confirm if it has the reference assigned or not.

hard estuary
raven orbit
#

https://youtu.be/8eWbSN2T8TE?si=YX9baBeVqyF2QFlB just in case ill send the tutorial (im not asking for help on it)

In this Unity tutorial, I will show you how to code a simple patrol script in C# that can then be used in what ever 2D or 3D game you are currently developping !

Basically we will get a character randomly moving around a scene, wait X amount of seconds before moving somewhere else !

Here is the link to the HOLE AI PLAYLIST : https://www.yout...

โ–ถ Play video
hidden flicker
#

I did this

#

I didn't really learn anything new

proven jasper
#

Depending on your settings, it's possible that you fixed it awhile ago and your domain just didn't refresh until now.

hidden flicker
#

They all have the reference until suddenly they don't

cosmic rain
proven jasper
#

You could use a property and throw a debug.log whenever the value is changed to see where it's being altered from

hidden flicker
hidden flicker
proven jasper
#

apparently your result says it is though

hidden flicker
hidden flicker
proven jasper
#

So just make it a property and check

hidden flicker
#

Like show it in the inspector?

proven jasper
#

No just use a C# property and a backing field

hidden flicker
#

Not sure what those are

proven jasper
hidden flicker
proven jasper
#

That's not an equivalent

#

Your way isn't working apparently, so just try

hidden flicker
#

Ok

#

Where do I put that code

proven jasper
#

use your original variable name for the property so you don't need to change any code and just add a backing field.

#

that way all changes flow through the property

hidden flicker
#

Really quick question - if an object gets floating point errors can that make it lose a reference

proven jasper
#

floating point error is just mathematical inaccuracies building up, not an actual exception, so no

hidden flicker
#

I really don't know how to implement the backing field thing

hard estuary
# raven orbit https://youtu.be/8eWbSN2T8TE?si=YX9baBeVqyF2QFlB just in case ill send the tutor...

This video doesn't explain the basics, but it should be easy to understand for people who already know them. I assume the creator haven't explained the basics, because AI patrolling seems like a moderately complex topic (which implies that people with moderate knowledge will watch it), and he assumed everyone who doesn't understand the basics will watch his previous videos. Here is his playlist of videos about basics:
https://www.youtube.com/watch?v=pFeWUSWHIdk&list=PLBIb_auVtBwD5ovBwgGKbQK8d7efdKGlk

raven orbit
#

thank you, i really appreciate this ill watch it right now

proven jasper
#

it's a concept you're going to want to be very comfortable with anyway, so worth spending a few minutes on

#

the tl;dr version is that if my code has Property = "bob" then first _backingField will be set to Bob, and then it will log. It's a handy way to monitor and act on incoming changes

#

If we wanted to add an OnChange event whenever our variable was changed for instance, we'd just stick it right there in the setter and ensure nothing was accessing the backing field except that property (which is super easy to confirm in your IDE)

hidden flicker
#

Restarting Unity seems to have fixed it

proven jasper
#

lovely

trim rivet
#

I'm trying to add a field to my SO that calculates the sum of other variables in realtime, but I can't seem to get it to display (even using NaughtyAttributes)
Does anyone have any tips on solving this?

lean sail
trim rivet
thick terrace
lean sail
#

ah my bad i didnt even fully read to see this was just a getter

trim rivet
#

what's a backing field? ๐Ÿ˜ฎ brb googling

thick terrace
#

i don't use NaughtyAttributes so i don't know what it supports but in plain unity you'd need to write a custom editor for that type to display a property like that, it'll never be touched by unity serialization since it's effectively just a method

trim rivet
#

that sounds more complicated than it's worth tbh

lean sail
#

couldnt u also just give it a private set?

thick terrace
thick terrace
modest brook
#

hey guys, how can i make an object lock to the cursor? i wanna make a flashlight stick to the cursor the whole time
i have a custom cursor as well currently and a cursor manager and this is the code i have:

`void Start()
{
cursorHotspot = new Vector2(cursorTexture.width / 2, cursorTexture.height / 2);
Cursor.SetCursor(cursorTexture, cursorHotspot, CursorMode.Auto);

flash.transform.position = 

}`

knotty sun
#

trying to do anything in Start will achieve nothing. you need to lock your flashlight to the mouseposition in Update

lusty zephyr
little meadow
#

You may be able to just set transform.forwrd/up/right to the direction-to-mouse vector

deft dagger
#

unity error while evaluating property 'namespace' of task ':unityLibrary:packageReleaseResources'. See the Console for details.
i get this error when i try to make an android build, what should i do ?
and i started getting the error after switching from unity 2022.3.8f1 version to 2023.2.16f1

knotty sun
deft dagger
knotty sun
#

in that case at least go to the latest Unity 6 Preview version

deft dagger
knotty sun
#

Unity 6 Preview is what would have been under the old naming convention 2023.3

deft dagger
#

this ? @knotty sun

knotty sun
deft dagger
trim schooner
trim schooner
#

What's this from? Link

#

I've been using addressables on Android in 2021..
๐Ÿ™‚

deft timber
#

maybe older adressable package version works on older unity versions

trim schooner
#

Right, this is an addon to the Addressables package

deft timber
#

yea, it's com.unity.addressables.android package

trim schooner
#

The Addressables for Android package works in conjunction with the Addressables package to support Play Asset Delivery and provides you tools to pack Addressable groups into Android asset packs. This way you can take full advantage of asset pack based dynamic delivery.

deft dagger
#

do i just download git ?

orchid yacht
#

I have been thinking and want to understand how to properly build the logic with Zenject. I may have MonoBehaviour components, but I think it's not just about using two interfaces and "cluttering" the container with dependencies that always need to be injected into MonoBehaviour through a custom constructor method.In general, I am thinking of starting to create objects from prefabs at the moment of initialization/dynamically. Here, I don't fully understand the correct approach. Yes, there should be a service that handles configuration delivery, and a factory (here, I don't want to use a Placeholder because I think it will require a lot of injections and writing code, which isn't a problem).Suppose I have a player who will have scripts like PlayerSpawnPoint, IPlayer, PlayerProxy (can it be used to hide the implementation? Here, too, I don't understand if it's necessary to use an interface for the factory and proxy implementation - I think not). Some kind of PlayerBehaviour and so on will also be needed, and everything should be covered by a facade.It's interesting to create the player at the level of GameObjectContext, that is, through PlayerInstaller or not.
My main problem is that I don't fully see the application architecture. Of course, many implementations are possible, but I want to finally try dynamically creating objects, attaching components, using an asset provider, and developing smoothly. I sincerely ask for advice, as I'm still far from being a Unity expert.

knotty sun
deft dagger
sonic swan
#

When I am lerping my gameobjects transform when using time.deltatime as t myobject flickers really fast from a and b

#

Why is this happening?

knotty sun
#

because that is not the way Lerp works

sonic swan
#

Wdym like I have a which is objects starting position b which is final position and t when it's set as time.delta time it's flickers really fast

knotty sun
#

t should vary from 0 to 1. deltatime does not do that

sonic swan
#

Oh yeaaa

#

But there are many scripts that use that and it works

#

I did it yesterday for a object and it seemed fine

knotty sun
#

bet, they may kinda work but I can guarantee you they do not actually work

sonic swan
#

Time .delta time only works

#

If a is the current player pos

#

It's not a good solution

#

Cuz u can just use smoothstep

#

And get a more accurate result

knotty sun
#

yep and even then it doesn't actually work because end pos is never reached

sonic swan
#

So imma just use smoothstep

lean sail
#

i dont think smoothstep is what you want either if you're using deltaTime as the 3rd parameter

#

there is Vector3.MoveTowards, the 3rd parameter takes in a max distance to move which sounds more like what you want

knotty sun
#

@lean sail Remind me, is this a Brackeys screw up ?

gusty aurora
#

Is it not possible to inherit from Component instead of MonoBehaviour ?! I'm pretty it used to be a thing

lean sail
knotty sun
lean sail
knotty sun
lean sail
soft shard
#

I am very confused why a materials list refuses to update but a single material does - if I do someRenderer.materal = something; that works fine in changing the first element to "something" - if I do for(int i = 0; i < someRenderer.materials.Length; i++) {someRenderer.materials[i] = something; Debug.Log(someRenderer.materials[i]);} that doesnt change any element to "something", and since .materials creates instances, I also tried using .sharedMaterials which gave the same result and I dont understand why, maybe its too early here, am I missing something? Do I have to do some kind of renderer.ForceUpdate or something? Why does changing the first element with .material work and not the list with .materials? Nothing else affects this renderer (these are also standard HDRP materials, so no custom shader logic involved)

gusty aurora
thick terrace
#

if you're doing this frequently, you can use GetMaterials and SetMaterials to avoid the allocations from copying

soft shard
lean sail
gilded crystal
#

Is it possible to make one animator update before another without manually ticking it? I'm considering playable API but not sure if it's feasible

pliant spade
#

Hi, I have a weird issue, when I initialize the IAP for googleplay I get this error:
Initialization Failed: NoProductsAvailable No product returned from the store.

I have products in my catalog, I imported in google play, made a closed beta version, configured the IAP service in unity, but it wont initialize correctly. any idea why?

void tendon
#
public class DirectoryWatcher : MonoBehaviour
{
    // A class watching for any new files in a directory //

    public string m_FolderPath;
    private FileSystemWatcher m_Watcher;
    public GltFImportManager m_ImportManager;

    private void OnEnable()
    {
        m_Watcher = new FileSystemWatcher(m_FolderPath);
        m_Watcher.Filter = "*.gltf";
        m_Watcher.IncludeSubdirectories = false;
        m_Watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
        m_Watcher.EnableRaisingEvents = true;

        m_Watcher.Created += OnCreated;
    }

    private void OnCreated(object sender, FileSystemEventArgs e)
    {
        Debug.Log($" created sender {sender}, {e.FullPath}");
        m_ImportManager.LoadObject();
    }

    private void OnDisable()
    {
        if (m_Watcher != null)
        {
            m_Watcher.Created -= OnCreated;
            m_Watcher.Dispose();
        }
    }
}

public class GltFImportManager : MonoBehaviour
{
    public string m_AssestURL;

    private ImportSettings m_ImportSettings = new ImportSettings
    {
        GenerateMipMaps = false,
        AnisotropicFilterLevel = 3,
        NodeNameMethod = NameImportMethod.OriginalUnique
    };

    async public void LoadObject()
    {
        var gltf = new GLTFast.GltfImport();

        var success = await gltf.Load(m_AssestURL, m_ImportSettings);

        if ( success ) {
            
            var gameObject = new GameObject("gtlf");
            await gltf.InstantiateMainSceneAsync(gameObject.transform);
            GarbageItem item = new GarbageItem(0, gameObject, Random.Range(20, 40), gltf);
        } else {
            Debug.LogError("Loading gltf failed!");
            gltf.Dispose();
        }
    }
}

Hello, I'm running into an issue where my system file watcher is not successfully executing asynchronous event for loading objects. Any help would be appreciated ((:

leaden ice
#

You did

new GameObject();``` and ```gameObject.transform``` in a background thread. Neither of those are ok.
thick terrace
#

is the Created event on a FileSystemWatcher always called from a background thread?

#

i guess in that case you could put in an await Awaitable.MainThreadAsync() at the top of LoadObject

void tendon
#

ok thank you. makes sense - I will try that!

void tendon
thick terrace
void tendon
#

the function doesnt run

thick terrace
#

which one?

#

and how can you tell it doesn't run ๐Ÿค”

void tendon
#

Sorry, I have a debug message at the top of LoadObject, which doesnt get called, even after adding the Awaitable.MainThreadSync()

thick terrace
void tendon
#

yes, the oncreated is being logged, and it is called

glad sentinel
#

I want to make a 2d game with a fairly advanced movement system and I'm wondering about the benefits of an Event-based Manager or Action Queueing over a State Machine, I havent used Action Queueing before

void tendon
thick terrace
void tendon
#

just so I understand it correctly, what is the Awaitable function doing?

thick terrace
#

on the Unity thread, of course!

#

Awaitable is unity's own version of Task fwiw, there's various other useful helpers in there

void tendon
#

ah ok. I'm only learning about threading over the past week ..confuses me slightly! and so, the reason it doesnt work without that call is because OnCreated is synchronous, and doesnt await my function?

thick terrace
#

no, it's just that OnCreated is being called from a thread other than the Unity thread in the first place, i assume because that's how FileSystemWatcher works (i've never used it)

void tendon
#

oh yes, its a background thread - okay makes perfect sense

lusty zephyr
#

So, I'm making an inventory system and I was wondering how you'd keep track of the items on which spot. Currently, I'm using a list with all the items (item on listnumber 3 stands for spot 3 in the hotbar).

But if you remove an item, all spot change. What should be the best way to keep track of the position instead of a list?

sleek radish
#

Assign item as a children of the slot it in?

lusty zephyr
#

Why didn't I thought of that.

lusty zephyr
sleek radish
#

Why would it be?

lusty zephyr
# sleek radish Why would it be?

I don't know. It feels kinda wrong having 30 same things running the same time. I'm probably just overthinking it. I thought it'd take a lot memory

terse torrent
#

why does Debug.Log() not show up in the unity console?

#

;-;

leaden ice
#

It does

#

Maybe your code simply isn't running

terse torrent
#

for me it doesn't, for some reason

terse torrent
#

I have a collision code

leaden ice
#

It's not running

#

You did something wrong in your setup

terse torrent
leaden ice
#

That's not a real Unity function

#

You made that up

terse torrent
#

wat

leaden ice
#

Check your spelling

terse torrent
#

I mean I am following an 7 year old tutorial but ig you are right

leaden ice
#

You spelled it wrong

#

The age of the tutorial isn't relevant

terse torrent
#

what did I spell wrong? could you specify more?

leaden ice
#

Also your log is inside an if statement so even if you fix that it might still not run if the condition isn't satisfied

leaden ice
#

OnCollisionEntered is not a Unity message

terse torrent
#

oh yeaa

#

sorry

#

its OnCollisionEnter

#

thanks a lot!

leaden ice
#

Sure but it makes things harder for you to debug

terse torrent
#

how does it make it hard? I want to know when the object collides with the obstacle, so should I not use an if statement?

knotty sun
#

and what do you do when nothing get's debugged?

terse torrent
knotty sun
#

no it doesn't

terse torrent
#

wat ;-;

#

I think I should go to code beginner...

dire vigil
#

Hey guys, I've been developing a VR based Squash game and facing some issues in collision between the Racket and the tennis ball, I've tried to write the script for both of these dynamic objects but something is still felt missing, I am dropping both of the scripts below, kindly help..

amber mauve
#

Hi guys, i am building a linux build using IL2CPP on my Mac (silicon chip) for a dedicated server, and it's taking forever on the Linking GameAssembly.so (x64). Is it normal ?

main oxide
#

hi

haughty belfry
#

but you can speed it up for example: by using burst compilers and incremental builds

#

actually unity uses incremental build pipeline by default for release and development build

amber mauve
#

ok thank you

trail stream
#

any fix for this ?? i get this random blue area that covers a part of the map in game view for some reason

warm kraken
#

is your camera in orthographic mode? is it rotated slightly more then it should?

trail stream
#

i would have never figured that out

#

thanks alot man its fixed now notlikethis

molten isle
#

!code

tawny elkBOT
molten isle
#

How come my method isn't appearing in the button function, when the method is a public void? https://gdl.space/pahaloweta.cs (RotateObjectAt is the method I am attemptig to call)

molten isle
leaden ice
#

It's because it has two parameters

#

UnityEvent only supports a single parameter for the inspector

molten isle
#

interesting, so my only fix is to remove one of those parameters?

leaden ice
#

Or remove both parameters

#

You could separately serialize the parameters as fields

#

and just have a wrapper function without parameters to call this function with your field values

molten isle
#

Alright thanks

onyx cypress
#

in my game i have a arm holding a torch, when i look up and down both of them kind of stretch for some reason, but looks normal when looking forward

#

like this

leaden ice
#

also this isn't a code issue

onyx cypress
#

sorry

frosty trench
#

Hello everyone, before I added a background video, my circles could glow (first image), but right after adding the background video, the glow disappears (second photo shows that if i lower the alpha, the glow can be seen there)

#

I honestly dont know how to fix this

nimble eagle
#

Hey guys! I'm making a metroidvania and I'm having some trouble figuring out how to program the abilities. I don't know what's the best and most modular way to implement them. Can anyone help?

rich ice
#

What is a good way I can find other beginners to work with :D ?

little meadow
# nimble eagle Hey guys! I'm making a metroidvania and I'm having some trouble figuring out how...

Unless you have multiple characters with multiple abilites - you probably don't need the best and most modular way to implement them ๐Ÿ™‚
But other than that... I guess separate each ability to a separate component and make a prefab with it, and make it so that you can add any of these prefabs to the player and they'll do stuff on top of the core player components (you'll pass components and stuff around when initializing the abilities)

#

But my personal approach to anything that I can't imagine how to make nicely is... just make it work and see when it starts being annoying to work with and refactor until it's good ๐Ÿ™‚

nimble eagle
#

In the game I want the player to have 2 ways of combat. The main way is through a melee attack. The second way is through a revolver which is charged by hitting the enemies with the melee attack. Down the road I intend to add more abilities such as dashing, a charged melee and revolver attack, etc. For now I have a player controller which handles only the input, a player movement, a revolver script and a melee attack script

frosty trench
fleet gorge
#

your video player renders to a render texture, which is assigned to a material. change this material to be an unlit one

frosty trench
#

let me check this!

soft shard
frosty trench
fleet gorge
#

Is it rendering in world space or UI space?

nimble eagle
fleet gorge
#

I'll need to look into how the video player works again

frosty trench
#

But my previous background image was also on default layer and the glow was working

soft shard
# nimble eagle I'm sorry, I don't like my implementation so far and I'm not sure what other wa...

Ah, I see- maybe you could look into FSM (Finite State Machine) and implement a similar pattern with "states" or "sub controllers" for your input and abilities these states/sub-controllers can also use [System.Serializable] so you an edit them in the inspector and dont need to derive from MonoBehaviour - or you could look into interfaces with abstraction and generic classes, which would be a more code solution that wouldnt use the inspector, the abilities themselves could be inherited classes or possibly a list of ScriptableObjects that 1 mono script initializes/updates - if your using the "new" input system, you could also subscribe events for input to have certain keys call certain ability indexes, I do something similar for a "hotbar" in one of my games

nimble eagle
#

I'm thinking about making a monobehaviour script attached on the player that holds all of the abilities which are SOs

#

So basically a list of SOs that derive from a base class

fleet gorge
#

swap out when needed

#

if you place your SOs in the Resources folder you can Resources.LoadAll

nimble eagle
#

But what if I have a revolver, a dash, a double jump, etc?

fleet gorge
#

how many abilities can the player equip at once

nimble eagle
#

No idea, since it's a metroidvania, the player will gradually unlock more abilities as they progress through the game

#

So all of them basically

fleet gorge
#

ohh

#

yea then have a List of SOs

nimble eagle
#

Should I use a map instead of a list?

#

Would be easier to call each SO ability from the player controller I think

fleet gorge
#

the base SO will have different functions you can override like OnJump, OnShoot, OnMove etc

#

you can call the according functions in the player controller but don't hardcode it

nimble eagle
#

I was thinking the base SO would have a function TriggerAbility and each derived class implements it differently

#

And the player controller would call that function depending on the key pressed

#

For example OnShoot would be something like: abilityHolder.UseAbility("RevolverAbility")

#

And UseAbility triggers the function of the specified SO

#

(If I would use a map)

lean sail
#

Anything string based like this will be a pain in the ass

nimble eagle
#

Idk man, I'm not too good when it comes to system architecture

fleet gorge
#

you can use System.Action, it's like a list of functions.

System.Action onDeath;
public void deathEffect() {}
...
onDeath += deathEffect;

calling onDeath.Invoke calls deathEffect

#

you can add many functions to one System.Action

knotty sun
#

hmmm, no

nimble eagle
#

Please Steve

#

Make me understand this ability system thing

#

How would you do it?

knotty sun
#

Your SO approach is not bad, but replace the strings with enums

nimble eagle
#

Oh

#

I see what you mean

#

But how would I call a specific ability from the player controller?

#

abilityHolder.TriggerAbility(???)

#

I mean how do I pass an enum state to the function

knotty sun
#

say you have an enum

public enum Ability {
  RevolverAbility,
  // More here
 }

then

abilityHolder.TriggerAbility(Ability.RevolverAbility);
nimble eagle
#

Is the enum in the player controller?

knotty sun
#

and the method signature is

public void TriggerAbility(Ability ability) { }
knotty sun
nimble eagle
#

So its in both scripts right?

knotty sun
#

no, generally I put public enums all in their own script

nimble eagle
#

Ah, I didnt know I can do that

knotty sun
#

basic C#

nimble eagle
#

Would the ability holder still use a map?

#

Or just a list?

knotty sun
#

Either is good, whatever is easiest for you

fleet gorge
#

a map is just faster

nimble eagle
#

Which would you personally choose?

leaden ice
#

Dictionary is so much simpler if this is the use case I think it is

nimble eagle
#

I think a map is better cause its easier to work with strings than with index

leaden ice
#

well they'd be using their enum not a string

fleet gorge
#

dictionaries/maps work like arrays

nimble eagle
fleet gorge
#

in fact for c++ we just use enums for arrays

knotty sun
#

I would use an array, but I'm a stickler for performance. A Dictionary is probably easiest for you to implement without problems

nimble eagle
#

Okayy

#

Thanks for your assistance

#

Btw are dictionaries serializable?

knotty sun
#

no

leaden ice
#

not out of the box by unity*

nimble eagle
#

And I would need them to be right?

cold parrot
knotty sun
#

there is an easy workaround using the ISerializableCallback interface

little meadow
#

I have to say, I highly dislike those enums that tend to grow indefinitely over time... I'd rather use const strings (or not strings, but strings are "easy")

leaden ice
nimble eagle
#

What if I just load all the abilities from the project files into the dictionary and assign each key as the SO file name?

knotty sun
little meadow
lean sail
chilly surge
#

The performance impact of using const strings is probably minimal and insignificant, because they are interned. That said, you should still use something else rather than strings for other more important reasons.

leaden ice
little meadow
# leaden ice Isn't this basically equivalent to an enum in most important ways?

You don't have to stick them together. Adding a new implementation of the thing no longer requires adding something to an enum, and in a sense changing existing code.
Perhaps I'm biased, as I've seen these enums go out of hand way more than I'd like... ๐Ÿ˜ฆ At some point people add switches and if's over them and suddenly when you add a new thing, you need to find all usages of the enum and adjust that code as well.

#

Enums just make it very easy to feel like it's an exhaustive well-defined list of things

chilly surge
#

when you add a new thing, you need to find all usages of the enum and adjust that code as well.
There are diagnostics for that.

#

If you use strings, there's truly nothing that can help you, unlike enums.

little meadow
#

That's partially fair, but the thing is, you're less likely to mess it up like that, as you wouldn't have the same expectations as with an enum

#

(I'm not a fan of random strings, let me clarify that... but if they're consts and not eating performance... ๐Ÿคทโ€โ™‚๏ธ )

leaden ice
knotty sun
#

And, of course you conveniently over look the fact that a string takes up 2 bytes per character whereas you can store 256 enum variations in 1 byte

chilly surge
#

IDE0010 and IDE0072 will emit warning when you modify an enum and the switch no longer handles all the cases. You can turn that into a compiler warning (bonus point for turning on warning as error) to actually enforce the problem you are talking about.
If you use strings, there's truly nothing that can help you.

mossy ermine
#

cs
//using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
public float radius = 200f;
public float power = 10f;
private void OnCollisionEnter(Collision collision)
{
Vector3 explosionPos = transform.position;
Debug.Log(explosionPos);
Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
Debug.Log(colliders);
foreach (Collider hit in colliders)
{
Rigidbody rb = hit.GetComponent<Rigidbody>();

        if (rb != null)
            rb.AddExplosionForce(power, explosionPos, radius, 3f);
    }
}

}
guys does anyone know y the sphere overlap wont detect any colliders in my scene

tawny elkBOT
chilly surge
little meadow
#

There might be much better ways to organize, of course, by not dealing with such things at all... and mostly just using objects, refs and interfaces, and not some form of IDs

mossy ermine
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    public float radius = 200f;
    public float power = 10f;
    private void OnCollisionEnter(Collision collision)
    {
        Vector3 explosionPos = transform.position;
        Debug.Log(explosionPos);
        Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
        Debug.Log(colliders);
        foreach (Collider hit in colliders)
        {
            Rigidbody rb = hit.GetComponent<Rigidbody>();

            if (rb != null)
                rb.AddExplosionForce(power, explosionPos, radius, 3f);
        }
    }
}

does anyone know y my sphere overlap isnt detecting any colliders in the scene

little meadow
leaden ice
mossy ermine
leaden ice
little meadow
mossy ermine
leaden ice
little meadow
#

Because it makes it less convenient / even more weird to write it in the first place

chilly surge
# knotty sun And, of course you conveniently over look the fact that a string takes up 2 byte...

Strings are interned, you can have 1000 occurrences of "foobar" in your source code and there will only be one copy of it at runtime, and comparison of them will be just as fast as comparing two objects because it's just comparing two addresses.
I think the performance impact of string vs enum should not be the center of this conversation, but rather all the organizational issues and the fact that they are practically reinventing a language feature in their own unsupported way and thus missing out all the existing tooling benefits (like the diagnostics).

little meadow
#

enums are great for days of the week or months or anything that's well defined and won't be changing all the time

leaden ice
#

And what's so bad about an exception

chilly surge
#

It's 100% not better, it has the exact same issues as enum but more.

leaden ice
#

exceptions are excellent

#

they give us visibility into our errors

chilly surge
#

If you add a new const string, it's not any better than adding a new enum member.

#

Except you get no help from diagnostics to tell you to update your existing code.

leaden ice
#

imagine if instead of an exception you just left out the default case in your switch. Now we just silently fail instead of loudly failing

#

and our bug goes undetected for weeks

little meadow
#

no, no, exceptions are great, I'm saying that compiler warnings and errors are better, as those can help you even earlier in the dev cycle

#

and fine, I'll agree, probably strings aren't better

#

just pass instances or something around

#

the point is to not need a list of all things that are kinda unrelated... like all abilities... you shouldn't need one place that knows about them all and does stuff with them

wide terrace
midnight cypress
#

Hey everyone. Is there a way to set a texture.jpg to a material as the Base Map in a script?

little meadow
#

and that's what an enum like that is... a place that knows about all of them... then people start using it as such, then adding new ones becomes a problem

mossy ermine
midnight cypress
#

It seems I can set the normal map image just fine, but for some reason I can't figure out how to set the base map image

wide terrace
chilly surge
deep oyster
#

So I'm using a buoyancy effector2D on a water object that's using a polygon collider. If my character floats over a quad edge in the water, they get effected by twice the buoyancy and float in place. It seems like there might be no way to avoid this?

chilly surge
#

Enum represents an exhaustive list of possibilities (kind of, C# enum doesn't exactly but that's besides the point), if you have compiler to help you ensure that exhaustiveness, then you are good to go.

little meadow
chilly surge
#

Nope

#

The diagnostics ensure you must handle all cases

mossy ermine
chilly surge
#

The diagnostic will still warn you for trying to use default case to ignore everything else.

little meadow
#

Ah, okay, so then you can't use default, which is a problem in some of these places... or again, you just used an if to check if it's 3 of those now 26 enums

#

and now there's a 27th... what do you do? find all instances, think of what was the intended behaviour in each place, get sad, spend time, etc...

#

if they have different behaviours and you're constantly adding new ones, then you should have proper objects that you're passing around, with properties and whatnot

#

and then you don't need one place with all the IDs (the enum)

chilly surge
wide terrace
mossy ermine
#

its not getting any of the colliders for some reason

chilly surge
#

I suggest you to take a look at the links of those diagnostics, if you have an enum:

enum E
{
    Foo,
    Bar,
    Baz,
}

The rules will enforce you to write code like:

switch (e)
{
    case E.Foo:
        DoFooStuffs();
        break;

    case E.Bar:
        DoBarStuffs();
        break;

    case E.Baz:
    default:
        DoDefaultStuffs();
        break;
}

When you add a new variant to the enum, you are forced to also add a new case (even if you are going to just ignore it and let it handled by default), forcing you to acknowledge it.
You are also forced to always have a default case.

mossy ermine
little meadow
#

I see, I see... so it'll get a bit verbose? It is a cool feature that I did not know about ๐Ÿ‘ ... but I'm saying those just shouldn't be enums in the first place. Logic should be inside some object implementation and not in a place that knows about ALL things that you're changing all the time.
Open-closed principle or something, right?

leaden ice
#

And polymorphism

#

Which has its place but also its own drawbacks

wide terrace
# mossy ermine any idea y this is happening <@1097950947369562187>

Hmmm... the code looks fine to me. And layers shouldn't be a problem since it defaults to all layers. I'm not really sure :/

I'll try to make a small replication really quickly, just to see if I'm not overlooking something obvious. But hopefully someone else might have a better idea

chilly surge
#

Polymorphism also requires you to put the handling code on the object itself, which is problematic in its own rights.

little meadow
chilly surge
# little meadow Same as enums - they're great for stuff that's very localized and/or constant, v...

You are essentially pointing out the expression problem: https://en.wikipedia.org/wiki/Expression_problem

The expression problem is a challenging problem in programming languages that concerns the extensibility and modularity of statically typed data abstractions. The goal is to define a data abstraction that is extensible both in its representations and its behaviors, where one can add new representations and new behaviors to the data abstraction, ...

#

In object oriented code, adding a new variant is easy, just add that new class; but adding a new operation is hard, you need to now modify every single class.
In functional code, adding a new operation is easy, just add that new operation and switch on it; but adding a new variant is hard, you need to now modify every operation's switch.

#

They both have their problems, you might be only seeing half of the expression problem, the half that favors OOP.

wide terrace
# mossy ermine alr thanks for the help

Change your Debug.Log(colliders); to like Debug.Log(colliders.Length);, just to be sure - it looks like colliders do not serialize into a string, so logging the array may be misleading

mossy ermine
#

ok

#

ya ur right now it shows 4 colliders

wide terrace
mossy ermine
#

ya they have rigid bodys

#

how do i change to make it look for things in a specific layer cuz i have a feeling that might fix it

#

@wide terrace do yk how?

little meadow
#

thanks @chilly surge didn't think of it that way and didn't know about the expression problem...
still, the use-case was specifically about an enum of IDs for SOs that define abilities... that's bound to grow whenever they want to add/experiment with a new ability, plus they already have an object that they can work with ๐Ÿคทโ€โ™‚๏ธ not using said object and doing any magical ifs/switches on IDs is making the system way more annoying to extend, wouldn't you agree? because now the logic is all over the place, outside of the object/class that defines the ability

wide terrace
# mossy ermine <@1097950947369562187> do yk how?

Add a LayerMask field and pass it into the OverlapSphere() call as the respective argument - it'll let you select the the layers in the inspector through a nice interface.

I'm sort of skeptical that it could be the layers, but it's worth a try. You might also throw some logs in to check if the rbs are null, and maybe use a much larger force and/or ForceMode.Impulse, particularly if these rbs have some amount of mass

wide terrace
mossy ermine
#

it keeps giving me an error when i try to have a debug message give me the rigid bodies saying cannor acess floor rb cuz it doesnt have an rb

#

this is the player

wide terrace
mossy ermine
#

velocity

#

but the layermask thing worked

#

i still dont get y it wasnt working without it

wide terrace
#

I do not know... I would like to understand as well ๐Ÿค”

chilly surge
# little meadow thanks <@451999506918277131> didn't think of it that way and didn't know about t...

That very much depends on how you are going to use the abilities. If an ability is only ever going to be used one way (so there will never be a new operation), then sure.
However imagine a different scenario: an ability simply contains some metadata about the ability (cooldown, how much damage it deals, mana cost, etc), but different game modes may handle the ability differently. Perhaps not even game modes, you want to transmit "player A casted ability X" across network. Now what do you do, do you put every game mode's handling code into ability classes? Do you also put the network handling code into ability classes too? Why should ability classes even need to know the fact that this game has different game modes or that it's a networked game? Now you just run into the opposite problem: ability classes suddenly need to know the every possible way an ability is going to be used in the context of the entire game.

#

It circles back to the expression problem again, if you go the OOP route, adding a new ability is easy, but adding a new game mode is hard; if you go the functional route, adding a new game mode is easy, but adding a new ability is hard.

little meadow
#

sure, but the original request was "how to add more abilities easy" ๐Ÿคทโ€โ™‚๏ธ

#

it's a decent example (well, a bit extreme), but you'd probably still not use enums and switches, you'd need a more complex approach to do game modes that affect abilities in a good way, and would depend on the specific needs for said game modes

chilly surge
#

Yes, and there are solutions to the expression problem for both directions.

#

The point is, there's no one simple answer to picking which approach and either comes with its own downsides. If you completely ignore the problem of adding new operations later on, then the OO approach will make adding abilities very easy, but you better hope you aren't going to add more operations later on.

#

The moment you need to add a new operation, your 50 ability classes will all be red and your project will not compile until you modify those 50 different files.

little meadow
sly chasm
leaden ice
#

you should use direct physics queries

#

e.g. Physics.OverlapBox

sly chasm
slow plover
#

I'm trying to draw a bunch of instanced meshes to a secondary camera, but not to the main camera. The secondary camera is copied from the main camera, I set the DrawMeshInstancedIndirect call to use camera: secondaryCamera, which the documentation says should only draw to that camera, but the main camera is still drawing them. I must be missing something, anybody have clues on where I could look?

leaden ice
#

The docs say:

If null (default), the mesh will be drawn in all cameras

slow plover
leaden ice
#

well that would certainly do it

hidden compass
#

Can't see that on mobile btw

leaden ice
#

well first off the first two lines where you try to set it (the stuff related to LeftControl) will be overwritten by the second two lines where you do

#

so effectively only the if (Input.GetKey(KeyCode.LeftShift) && canSprint) part matters

#

theoretically you should be toggling between 30 and 35 degree fov due to that code

#

which isn't that much of a difference

halcyon dagger
#

Good morning / afternoon/ evening depending on where you are from!

I am looking for some pointers in the right direction on how to set an external display (display 2 for simplicity) and be able to change it's resolution at runtime. I already have a list of resolutions that I can set but when I change the resolution from the dropdown only display 1 is responding and changing:

https://pastebin.com/meGHcB9G

#

Any settings I'm overlooking for the additional displays?

#

launch arguments etc

tender gull
#

hey, can you clear for me few things about cameras? I'm using Unity 2022.3 with URP 14.0.11 and can't force my cameras to work...
firstly - I'd like to have separate cam for UI, so I have my UI camera on UI layout with UI as only layer culling and it's set to overlay.. next I have main camera as base and added UI camera stacked there... next I have canvas with image on UI layer (canvas and all it's children). Canvas is set as screen space - overlay.

So is it correct that both main and UI cam can't see it at all (preview in scene panel are empty), but still in game view canvas with image is visible? The problem is reversed if I turn canvas rendering to screen space - camera and select UI cam - UI then isn't visible anywhere (playing with distance didn't change a thing).

flat marsh
#

Hi guys I am having an issue where I cant access the variables of the child object from the parent object. Would someone please be able to help me? Here's the code https://gdl.space/qawatacawo.cs, and some screenshots of the inspector in case that helps:

knotty sun
#

floorCheck should not be of Type GameObject. It should be of Type Ground_check_script

tender gull
#

hey, can you clear for me few things

#

another problem is rendering to texture and than showing it with alpha channel... so:
I have camera rendering to the texture with bg set to black, no alpha (0, 0, 0, 0) with culling mask to catch an object.. it seems to work well - I got only that object in texture and image in preview looks as it should..
Now I add it to the canvas UI as an Raw Image and it starts to be strange - my rendered image looks like it has about 50% opacity... whole image - there is no alpha and I can't even make it to show as solid (color for image is white with full alpha).

flat marsh
knotty sun
flat marsh
eternal dome
#

public GameObject floorCheck;
To this
public Ground_check_script floorCheck

flat marsh
sonic swan
#

you know how you have mathf.smoothstep for smootly interpolating what tyoe of thing is there for exponentioal interpolatioinb

#

nvm i used animation curve and it looks worse that smoothstep

leaden ice
steady oasis
#
    void getDirection(){
        Vector2 direction = new Vector2(playerTranform.position.x - transform.position.x, playerTranform.position.y - transform.position.y);
        Debug.Log(direction);
        transform.up = direction;

        GameObject bullet = ObjectPool.instance.getPoolObjects();
        if(bullet != null){
            bullet.transform.position = muzzlePoint.position;
            bullet.SetActive(true);
            bullet.GetComponent<Rigidbody2D>().AddForce(direction * 5, ForceMode2D.Force); // wrong code
        }
    }

how can i make the bullet shoot in the direction that is calculated? that line that says wrong code, its a theory that doesnt work... so its wrong

leaden ice
#

perhaps you are calculating the wrong direction

steady oasis
#

its giving errors

leaden ice
#

what errors

#

maybe start with that

haughty belfry
leaden ice
leaden ice
steady oasis
leaden ice
steady oasis
steady oasis
leaden ice
# steady oasis

delete using System.Numerics from the top of your script. There's no reason you should have it there

steady oasis
#

it was default

leaden ice
#

and yes you should do direction.Normalize(); right after that

steady oasis
#

what is that? can you explain in nutshel?

leaden ice
steady oasis
leaden ice
steady oasis
haughty belfry
steady oasis
#

ohki thanks

haughty belfry
ashen oyster
#

Is there a way to send a rendertexture to a material without blitting? I tried

_material.SetTexture("_PrevFrame", _prevFrameHandle.rt);

and then using a sampler2D in the shader

sampler2D _PrevFrame;

To no success

#

Maybe important, I'm putting this in the execute function of a render pass

stable osprey
ashen oyster
#

Yes, I need two render textures in one shader

stable osprey
#

and why is blitting preventing you to do that?

#
public static RenderTexture Copy(this RenderTexture rt) {
    var newRT = new RenderTexture(rt);
    Graphics.Blit(rt, newRT);
    return newRT;
}
ashen oyster
#

Since if you blit you can only access the one variable you have acces to, _BlitTexture no? also, blitting executes a render pass

Blit(cmd, cameraTargetHandle, _rtHandle, _accumulateMaterial, 0);
Blit(cmd, _rtHandle, cameraTargetHandle);
#

Here's my HLSL:

    HLSLINCLUDE
    
        // The Blit.hlsl file provides the vertex shader (Vert),
        // the input structure (Attributes), and the output structure (Varyings)
        #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
        #include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"

        sampler2D _PrevFrame;
        float _Frame;
        
        float4 _BlitTexture_TexelSize;
        
        float4 frag (Varyings input) : SV_Target
        {
            float4 col = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, input.texcoord);
            float4 colPrev = tex2D(_PrevFrame, input.texcoord);

            float weight = 1.0 / (_Frame + 1);
            float4 accumulatedCol = saturate(colPrev * (1 - weight) + col * weight);

            return accumulatedCol;
        }
        
    ENDHLSL
stable osprey
#

calls to Graphics (or other GPU APIs) don't execute anything synchronously anyway

#

they asynchronously queue stuff to a buffer which gets awaited on the next sync call

#

yeah the issue is you're blitting to the RT you would like to keep intact. Using the Copy method I posted above should do it!

ashen oyster
#

Should do what exactly? make a copy of the render texture? Now how do I send that to the shader?

stable osprey
#

_material.SetTexture("_PrevFrame", RTUtils.Copy(_prevFrameHandle.rt));

#

RTs are still references, so if you pass the RT before it changes, the changed version will be used by the shader (-- when it does)

#

sry I was in the middle of grabbing coffee so excuse my low effort english xD

#

@ashen oyster did that work?

ashen oyster
#

Er no, give me a second, maybe you're more eagle eyed than me

#

Here's the execute script, I put comments on the places to explain what's happening

#

I just get a black screen

#

Yes I could've used code blocks but discord's syntax highlighting is abysmal

#

returning just col works fine btw, that samples the blitted texture

stable osprey
#

you seem to have 4 extra blits there -- are you sure they're correct?

ashen oyster
#

How do you mean?

stable osprey
#

anyway.. the issue is you're using SetGlobalTexture but _PrevFrame is not market as static (uniform in shaders)

#

why not material.SetTexture?

stable osprey
# ashen oyster How do you mean?

I'm talking about the accumulation stuff -- I don't really get what they're supposed to be doing lol -- just making sure you do

ashen oyster
stable osprey
#

maybe you didn't explicitly press ctrl+R after your shader change -- which is needed to apply shader changes

#

(actually not sure about newer versions -- it is the thing I have to do in older version tho)

ashen oyster
#

I'm pretty sure unity HMR that just fine since I've not needed to do that

stable osprey
#

well great that it works now then ^^

ashen oyster
stable osprey
#

I have been avoiding URP/HDRP because I wanna avoid this kind of necessary magic lol.. the standard RP is just fine ๐Ÿ˜†

ashen oyster
#

lmao, not for my usecases xD

stable osprey
#

pretty sure everything's a notch easier programming-wise without URP/HDRP lol

ashen oyster
#

Yeah sure but then you're doing post processing with monobehaviors which is silly imo xd

#

I'm a fan of these SRP injections

#

(even though it's a massive struggle to find any good documentation on it)

stable osprey
#

well the SRP just changes the standard Update() to a specialized Execute and provides a premade and not-fully-customizable command buffer afaik -- not much of a bonus imo xD

#

yeah sure it can be nice in that sense -- but organization-wise a nicely named script (e.g.: Shaders/Magic/PostProcessing/FadePostProcessing.cs) might be as good

ashen oyster
#

It comes down to "whatever works best" ig :P

stable osprey
#

also it doesn't have to be a MonoBehaviour if you've gone through the trouble of adding a CommandBuffer to your camera. That's actually the best practice (potentially even static method library)

kindred blaze
#

im making a voxel system and i thought i should disable the mesh of a voxel if it is surrounded on all sides by solid voxels for optimization. is it necessary to do this or does the renderer not render them automatically?

manic pike
#

Why would one need [SerializeField] when the field itself is already serialized and readable by the inspector?'

vestal arch
#

you would not

#

as the Serialization manual says, SerializeField just bypasses a check for the field being public. if it's already public, SerializeField doesn't do anything, as your ide might tell you

hard estuary
manic pike
#

Fair point; and I apparently did public out of habit instead of private

stable osprey
# manic pike Fair point; and I apparently did `public` out of habit instead of `private`

I've established some practices that I like to recommend:

  1. When you need it tweakable from the inspector but otherwise immutable, go for private field [SerializeField] MyClass field;
  2. When you need it readable from other scripts..
    2a) .. but only settable within the script, go for public MyClass field { get; private set; }
    2b) .. but only settable from the inspector, go for [field: SerializeField] public MyClass field { get; private set; }
  3. When you need it only tweakable within the script, go for private field
#

this way you never really need public fields

manic pike
#

I'm screenshotting this, if that's fine?

stable osprey
#

totally!

manic pike
#

Thanks!

wind mural
#

Hey guys I was trying to test something super basic and encountered a weird case which Im not sure if it existed since forver with Unity?

I have 2 GameObjects in the Scene
Object A with a Script A which has Awake and OnEnable methods just printing logs
Object B with a Script B which has Awake and OnEnable methods just printing logs

When I run this, I get logs as
Object A Awake
Object A OnEnable
Object B Awake
Object B OnEnable

As far as I remember all Awake should be called first and then OnEnable right?

vagrant blade
#

It's per object

#

But these will all run before any Start methods will run in your scene

sleek bough
#

If you need more granularity than Start-Awake you can turn Start into a coroutine and skip frames to guarantee later execution.

wind mural
wind mural
vagrant blade
#

I don't recall a time it was different, no

wind mural
leaden ice
mellow zinc
#

what is the website where i paste text and its on a link and i share it

leaden ice
#

!code

tawny elkBOT
steady oasis
#
 
void shootFun(){
        Vector2 direction = new Vector2(playerTranform.position.x - muzzlePoint.position.x, playerTranform.position.y - muzzlePoint.position.y).normalized;
        muzzlePoint.up = direction;

        GameObject bullet = ObjectPool.instance.getPoolObjects();
        if(bullet != null){
            bullet.transform.position = muzzlePoint.position;
            Debug.Log("Teleported to muzzle");
            bullet.SetActive(true);
            Debug.Log("Bullet is active");
            bullet.GetComponent<Rigidbody2D>().AddForce(direction * 5, ForceMode2D.Force); 
            Debug.Log("Bullet Given boost");
        }

    }```

Code for bullet spawning and shooting ๐Ÿ‘†  
Code for Object Pooling ๐Ÿ‘‡ 
https://gdl.space/zuvimomive.cs

ERROR:  ``` NullReferenceException: Object reference not set to an instance of an object
RANGED_manager.shootFun () (at Assets/Scripts/Enemy/RANGED_manager.cs:55)
RANGED_manager.Update () (at Assets/Scripts/Enemy/RANGED_manager.cs:26)

why cant it detect the bullet?

simple egret
#

(RANGED_manager.cs:55)

somber nacelle
#

i'm going to guess that ObjectPool.instance is null since it is not assigned to anywhere in the code we've been shown

simple egret
#

That is indeed most likely the issue, there is no singleton initialization code in ObjectPool

steady oasis
steady oasis
somber nacelle
somber nacelle
steady oasis
#

then what should i do?

somber nacelle
#

you need to assign to it. you clearly tried copying the singleton pattern without actually understanding what it is. maybe go back and look at where you copied that from and see where the instance variable is assigned

steady oasis
#

i saw a video, and it didnt explain anything like that. imma try what u said

somber nacelle
#

yeah you 100% missed the part where they assigned to instance

steady oasis
#

what part is it?

somber nacelle
#

my guy, it is a 4 minute long video. go watch it yourself

steady oasis
#

where they defined ``` public static ObjectPool instance;

somber nacelle
#

please actually pay attention to the video

steady oasis
#

i did

#

come on, a little hint

somber nacelle
#

then surely you saw where instance was assigned

steady oasis
#

cuz its correct code to code

somber nacelle
#

no it isn't

steady oasis
#

oh ohki found it

#

sorry

steady oasis
#

that is the whole enemy shooting and moving code

somber nacelle
#

clear your console, make sure your code is actually saved and has compiled, then do whatever it is that causes the errors. because line 55 cannot throw an error

steady oasis
#

forgot to delete it

#

it showed me the actual script when double clicking at the first time, ig i must have clicked a different message

twilit scaffold
#

I am looking at the URP samples. it gives an error in its initial form.

Error (active)    CS0434    The namespace 'Samples' in 'Samples.GameplaySequence, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' conflicts with the type 'Samples' in 'Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'    Assembly-CSharp-Editor    P:\UnityProjects\Samples\AnimSamples\Assets\Samples\Shader Graph\14.0.11\Production Ready Shaders\SRPCommon\Scripts\Editor\SamplesShowcaseEditor.cs    94    

In my infinite inexperience, i tried to move things to a namespace ShaderSamplesShowcase which causes:

Error (active)    CS8773    Feature 'file-scoped namespace' is not available in C# 9.0. Please use language version 10.0 or greater.

IDK what to do

knotty sun
#

show how you tried to add the namespace

twilit scaffold
#

namespace ShaderSampleShowcase; under the using references

somber nacelle
#

you cannot use file-scoped namespaces in unity. it has to be a block scoped namespace

twilit scaffold
#

Ok thanks, i just put it in {}, but the errors remain (Not the namespace error, the initial one)

somber nacelle
#

well you've got a type with the same name as a namespace. did you put that type into the namespace you created?

#

or have you considered simply renaming either of them?

twilit scaffold
#

I believe so. the namespace block encompasses everything except the using statements. I attempted to rename samples as the first thing i did, but it says i cannot.

somber nacelle
#

you have to rename it from the class declaration, you cannot rename it from there

twilit scaffold
#

I am having trouble tracing that back. where i thought it was, it is not. i will keep looking. Thanks

somber nacelle
#

wdym? did you not put that class into a namespace?

twilit scaffold
#

I thought i did. I am off to take some c# courses. Thanks for the directives ๐Ÿ™‚

white perch
#

Hello, currently I work on a Tycoon and I struggle a bit with inability to choose way to store sprites of each building from blueprints. With my current knowledge I guess that the most optimal solution would be to use the SerializeField attribute but it may be you know better way to do that : pp

hard estuary
# white perch Hello, currently I work on a Tycoon and I struggle a bit with inability to choos...

I'm not sure if I understand your problem correctly.
Adding serialized fields in objects directly makes it easier to configure your assets in the Inspector. The drawback is that sometimes you end up with storing the same information in multiple objects. Usually it doesn't hurt, but it could be a problem if you have thousands of instances of that object. In such cases, it's worth considering if it's possible to store it in some sort of singleton or manager. But in 99% of cases [SerializeField] is good enough.

somber nacelle
#

either put your world space camera there, or you'll need to manually raycast against that object and convert the hit point to a point relative to the canvas

tender gull
reef garnet
#

Anyone here good with Quaternions, the following code is for rotating my player but it's a little clunkier than I'd like, I want to know how I can rotate on the Y-axis at a different speed than on the x and z axes. Y axis rotation is for the players movement rotations whereas X and Z are for aligning with the ground normal

if (vector == Vector3.zero)
{
    rb.MoveRotation(Quaternion.Slerp(transform.rotation, lastTargetRotation, rotationSpeed * Time.fixedDeltaTime));
    return;
}

Vector3 forwardDirection = Vector3.ProjectOnPlane(moveVector.normalized, targetNormal);
Vector3 upDirection = targetNormal;
targetRotation = Quaternion.LookRotation(forwardDirection, upDirection);
lastTargetRotation = targetRotation;
var horizontalRotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSpeed * Time.fixedDeltaTime);

rb.MoveRotation(horizontalRotation);```
ashen oyster
#

Friendly reminder to set your render texture precision higher, I've been debugging for 6 hours only to find i set the descriptor to default instead of ARGBFloat.

#

All my issues were fixed after that :<

manic pike
#

nvm I realized the value was in the editor, not in the script

unique flower
open dome
#

Hello, i wanna ask a question about AudioClip in Unity.
When i try to GetData() from AudioClip that i load from path using UnityWebRequest it give me error: "Cannot get data on compressed samples for audio clip "". Changing the load type to DecompressOnLoad on the audio clip will fix this." But when i open the file from UnityWebRequest i have enable compress and stream to false. Does anybody know how to fix this?

stable osprey
#

@open dome do you download it from the internet? or load a file from your Assets folder?

open dome
stable osprey
#

hmm it should be plug & play

#

@open dome why not UnityWebRequestMultimedia.GetAudioClip?

#

getting data isn't necessary before you create an AudioClip out of your downloaded audio

open dome
stable osprey
#

audio clip ""?

#

can you try using var clip = DownloadHandlerAudioClip.GetContent(www); as in the docs?

#

also you check if it's done but if it's not you just skip -- your function is not very robust for non-local files

#

GetContent I think is synchronous, so potentially not ideal for online files either, but you'll get around it with isDone similar to how you did (while (!isDone) { yield return null; })

open dome
stable osprey
#

but it can play properly if you don't try to GetData, right?

open dome
#

I need the clip to be able to use GetData function, since the whisper plugin that i use require the access on that function.

stable osprey
#

I'm wondering whether at some point these are overriden

#

might wanna try it before GetContent?

#

also yeah sounds like your previous method should work too but Unity is weird in some cases when it comes to following the docs xD

stable osprey
#

you might also wanna try waiting a frame or two after the download is done

#

@open dome or clip.LoadAudioData()

open dome
stable osprey
#

surely Unity side bug since GetData should automatically load/decompress it -- but yeah.. dlHandler is instructed to not even compress it in the first place

open dome
stable osprey
#

I've had my share of frustrations with unity web requests -- to the point I just went with .NET's HttpClient eventually xD

#

once I have the MP3 or whatever it's just easy to load it as an AudioFile -- same to transporting it to any other formats

unique flower
#

any unity help

#

in reblinding the controls in unity

stable osprey
#

it worked!? I knew it!

open dome
# stable osprey this might work

Hmm... where should i put this function?
When i Debug.Logging the function it return True. But still can't use the GetData function from audioclip

open dome
stable osprey
#

damnnnnnnnnnn

#

sadly I'm out of insight on how to do it with code lol...

stable osprey
#

also, the BUT was to change a setting in preferences, but seems it doesn't exist ๐Ÿ˜›

#

insert the wait right above GetData

#

also, mind that GetContent is kind of synchronous and indeed expects dlHandler to be done

#

more robust is while (!www.downloadHandler.isDone) { yield return null; } (wait until it's done before proceeding with using the downloaded file)

open dome
stable osprey
#

go with different plugin, then, imo ๐Ÿ˜›

#

it's for speech-chat so it might look a little complex but the transcription part is much easier -- and it can serve as a server as well

#

(sorry I can't help with the actual issue you're having ๐Ÿ˜› I've exhausted all my ideas -- maybe someone else has more)

stable osprey
steady oasis
twilit scaffold
steady oasis
river ridge
#

Hi!

I've been banging my on this for a while, I smell some gotcha regarding articulation bodies, but I couldn't really find anything specific to them.
I can use rigidBody + Joints for this, but there is some other system that works with ABs nicely that I am trying to hook into, so I want to give it a good try before I change away from ABs.

Goal: Generate a string of objects (rope) given length etc. as public params to the root of the rope at start.
Observable problem: Child ropes are created at the given local position, but they snap to global coordinates through the AB on them, as if they were spawned as root, and then simply moved without the teleport method. (I did try teleporting the child too, got the error "this aint root" as I should.)
Annoyingly, the first child (the one connected to the root, R-c1) works as expected: it spawns SegmentLength away and stays connected. Every other child behaves as if its the first child...

Related bit of code:

// File and object: RopeLink.cs
void SpawnChild(int remainingSegments)
        {
            if(remainingSegments < 1) return;
            childRope = Instantiate(RopeLinkPrefab);
            childRope.transform.SetParent(this.transform);
            childRope.transform.localPosition = new Vector3(0, 0, SegmentLength);

            childRope.name = $"RopeLink_{remainingSegments}";

            var rl = childRope.GetComponent<RopeLink>();
            rl.Root = false;
            Debug.Log($"I am {transform.name} and i spawned {childRope.name}");

            rl.SpawnChild(remainingSegments-1);
        }

void Start()
{
    if(!Root) return; // dont spawn stuff if youre not the root
    SpawnChild(numSegments-1);
}

RopeLinkPrefab is set.
I have tried using Instantiate with the transform and parent parameters too, exactly the same behaviour.
Doing this manually in the editor works 10/10.

What am I missing about ABs and instantiating them here?

stable osprey
steady oasis
#

so that would fix the direction?

stable osprey
#

facingLeft/facingRight is irrelevant since the direction is always facing the player

#

it will fix both speed and direction yes

stable osprey
#

you're welcome

steady oasis
#

or it wouldnt work as supposed?

stable osprey
#

no, adding * Time.deltaTime is wrong

#

you're setting the velocity of the object, which is u = x/t -- includes dT already when translating to movement units

steady oasis
#

imma send u a video, a really funny bug ๐Ÿ˜‚

stable osprey
#

I like videos

steady oasis
stable osprey
#

poor cow lol

steady oasis
#

๐Ÿ˜‚

steady oasis
stable osprey
#

idk what you want -- but yeah how bullets interact with the world is an entirely separate system -- implement based on your design

#

I wouldn't mind the knockback in a game I was making -- I kind of dig it

steady oasis
steady oasis
stable osprey
#

make it explicit instead of letting the physics system handle it

#

explicit as in code specific AddForce event on impact

steady oasis
#

i dont understand

white perch
steady oasis
#

so when the bullet hits the cow, the cow exerts force to the bullet to cancel out the force?

stable osprey
#

alright, so yeah first step make it trigger (if you want), then add an OnTriggerEnter2D(..) { cow.AddForce(dir * knockbackForce)

steady oasis
#

Ooo ohki, thanks

stable osprey
#

but that requires Cow to use force instead of velocity/transform for movement as well

steady oasis
stable osprey
#

nah sry my mind ain't focused enough now for non-plain-code stuff xD still having coffee

steady oasis
stable osprey
#

if the Cow uses velocity, you go into custom physics territory -- like coroutine with knockback

steady oasis
#

๐Ÿ˜ญ nvm, lets wait for the tank enemy's turn

unique flower
#

Hello
I have a problem in input when i enter playmode the input names changes but the movement no
but when i change the inputs in the play mode it become fixed
how can i fix that?

stable osprey
stable osprey
unique flower
stable osprey
#

what? ๐Ÿ˜„

unique flower
#

it`s a personal font to make my game not the same with any game
but the font doesn't look like that i change some things in the inspector

stable osprey
#

oh you created a font just for your game? cool

unique flower
steady oasis
#

is there any way to not give knockback without using trigger? just asking

stable osprey
steady oasis
stable osprey
unique flower
#

but i will try

lean sail
steady oasis
stable osprey
#

you handle cow movement with velocity but non-trigger bullets apply force and depenetrate (depenetration likely causes the knockback you see)

stable osprey
#

so it's buggy atm, but bugs can make nice features lol

steady oasis
#

yeh, that gave me an idea for a new enemy

stable osprey
#

but yeah needs much more work for a proper custom knockback feature

hard estuary
#

To clarify, whenever you declare a field, it stores its content if it's a struct and stores the reference to content if it's a class. For example: when you serialize an int field, it stores its content, because int is a struct, but if you serialize Sprite field, it will only serialize reference to that Sprite, because it's a class. The reference usually takes only 12 byte of space. Also: multiple fields can refer to the same class, but can't do that with struct, they will just copy its content.

steady oasis
#

yeh maybe i will just stick to not making the bug into feature

stable osprey
#

it's a pretty cool feature tho just saying ๐Ÿ˜†

#

game would look much less "alive" if it flashed instead of getting knocked back

steady oasis
#

but here is the thing, when there are like 10-12 enemies during boss fights, thats just a nightmare for the player

#

but, can be a good game design feature ๐Ÿ˜Ž

knotty sun
unique flower
#

i can anyone help me ?

hard estuary
knotty sun
timid stone
#

What's your manner of doing movement in your 2D games

#

Usually did a rb.velocity for player and such but just learnt about transform.translate

#

Was wondering if there were any others

dusk apex
#

!csds

tawny elkBOT
dusk apex
#

Relative to Start and Awake, Awake would always occur and comes first whereas Start will occur after Awake and only if the object is active/enabled iirc

#

Start is called on the frame when a script is enabled just before any of the Update methods are called the first time. Like the Awake function, Start is called exactly once in the lifetime of the script. However, Awake is called when the script object is initialised, regardless of whether or not the script is enabled.
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html

knotty sun
#

for Unity Monobehaviours you cannot use a constructor

#

if it's a POCO, yes but then Start and Awake do not apply

dusk apex
#

Thus why I had assumed they would want to be redirected to the c sharp discord server for clarification - solely with the c sharp content.

unique flower
knotty sun
unique flower
knotty sun
#

perhaps you would prefer to hear it from a <@&502884371011731486>

vagrant blade
#

We have a no crossposting rules. Please don't, thanks.

placid summit
#

hi not sure where this goes but Visual Studio intellisense does not show be comments above functions/properties - can I enable?

dusk apex
placid summit
trim schooner
#

type 3 / to get this autocompleted

placid summit
# trim schooner type 3 / to get this autocompleted

I know but it was overloading my clean code with comments! I turned it off. I can at least edit to 1 line I suppose. Doxygen will grab any comment, unfortuantely visual studio seems not to and wants the specific summary in case there is further info

trim schooner
#

I know but it was overloading my clean code with comments!

I don't get this.. comments only exist that you add ๐Ÿค”

placid summit
#

so by default typing /// adds multiple lines of comment with 3 for summary, plus all parameters. Yes you can edit after but... This can hugely increase length of code to scroll through... that is all. If there was a /// add 1 line summary add-on it would be nice...

#

generally I wants comments - but small 1 line ones

dusk apex
tawny elkBOT
storm wolf
#

Are async methods ran on a different thread?

leaden ice
#

No

storm wolf
#

I am reading that they โ€œdont block the main threadโ€ but coroutines do. What exactly does this mean?

little meadow
#

I'd say they're quite similar...

placid summit
#

async is a bit of a mystery - you don't see it much in Unity code! But I see it much like coroutines. Coroutines delay the running of code until later and/or await the end of something. Nothing is multithreaded which is odd!

little meadow
#

You could run functions on other threads and wait for them using async-await... but that's not very common in Unity

placid summit
#

the docs talk on Coroutines: "yield: The coroutine will continue after all Update functions have been called on the next frame." In other words you are adding an immediate delay in the code to run the coroutine! But if the couroutine then yields for time or for an htttp call it makes sense...

#

which as @little meadow says is like async

storm wolf
#

Is it common to even use more than one thread usually

civic isle
#

no

#

i think unity does not support multithreading

little meadow
#

Depends on the perspective... Unity does it all the time, it's just that Mono's code is kinda limited to one thread...

hard estuary
storm wolf
#

Ok interesting

placid summit
#

you can use threads, but not access the Unity API in them, so limited...

civic isle
#

this is what i see

knotty sun
civic isle
#

i am surprised there isnt an easy way to multithread by now

placid summit
#

plus the engine itself is threaded (except sad webgl)

#

just not the 'main' thread

#

rendering etc

tired elk
#

ยฏ_(ใƒ„)_/ยฏ

hard estuary
placid summit
#

I think the forums would be fullup double if Unity was all fully threaded - not having done it myself there will be many gotchas to making things thread safe - I know that much

civic isle
#

i dont know anything ab it

#

so yeah maybe id break everything

placid summit
#

I think there was talk of doing it in a way that would be safer. Does DOTs not allow this now?

oblique spoke
placid summit
oblique spoke
placid summit
oblique spoke
open bluff
#

I want to create a Third Person Shooter character using the Unity "Animation Rigging" system. Is there a source for this?

rigid island
open bluff
rigid island
#

nah I build things, I don't grab random projects to start from

open bluff
rigid island
open bluff
#

Could there be a problem with this character? Looks like I did everything right

rigid island
acoustic sequoia
rigid island
#

the twisting is normal , you probably havent unchecked one of the axis (forgot which one, I think Z?)

#

under settings iirc

open bluff
open bluff
rigid island
open bluff
#

I tried removing the other axes as well, nothing changed. I think the problem was due to the character

rigid island
acoustic sequoia
#

Im creating a game template that i can use for any future game, any tips on how to make a save/load manager ? im thinking about how to make it as easy as possible for new components to become saveable and loadable with the manager doing all the heavy lifting... I know that i have to use an interface for the Isaveale and probably keep track of them all in the saveManager but im not really sure... do any of you have any experience with that?

open bluff
rigid island
acoustic sequoia
rigid island
#

thats what most games do yes

#

or just disable the IK looking back as I do sometimes

acoustic sequoia
rigid island
#

I typically make pocos so yea

#

just add interface and its ready to go

acoustic sequoia
#

i was thinking about having a structure like

SaveManager -> GameData -> ISaveables

#

so that i can call from anywhere a game load/save and affect the ISaveable when i need it

#

but not sure if it just doesnt complicate it for no reason

rigid island
#

yeah I make all my Saveables register themselves to the savemanager

acoustic sequoia
#

are you having multiple scenes ?

#

like at once opened ?

rigid island
#

not typically. Unless maybe I'm carrying DDOL or a Canvas

#

you can still do it across scenes as long as the manager has an easy way to be accessed. Singleton helps with that

#

since cross-scene referencing don't work

cunning burrow
#

not my code but I wanted to filter a certain element, any way to do that? (it's just a panel with a centered render texture image

cunning burrow
#

The docs are missing info

rigid island
#

from there grab whatever component /gameobject you want

#

idealy you need something to make it distinguished from others if you have multiple of same components

onyx cypress
#

THE PLAYER DONT GO TO ANOTHER CHECKPOINT IS THIS SCRIPT RIGHT?

#

using UnityEngine;
using UnityEngine.AI;

public class NavMESH : MonoBehaviour
{
public Transform[] waypoints; // Array of waypoints to visit
NavMeshAgent agent;
int waypointIndex; // Current waypoint index
Vector3 target; // Target position for the agent

void Start()
{
    agent = GetComponent<NavMeshAgent>();
                               // Start at the first waypoint
    UpdateDestination();       // Set the initial destination
}

void Update()
{
    // Check if the agent is close enough to the target
    if (Vector3.Distance(transform.position, target) < 1f)
    {
        // Get the next waypoint
        WaypointIndex();
        // Update the destination to the next waypoint
        UpdateDestination();
    }
}

void UpdateDestination()
{
    if (waypoints.Length > 0)  // Check if waypoints array is not empty
    {
        target = waypoints[waypointIndex].position;
        agent.SetDestination(target);
    }
}

void WaypointIndex()
{
    waypointIndex++;
    if (waypointIndex >= waypoints.Length) // Wrap around to the first waypoint
    {
        waypointIndex = 0;
    }
}

}

somber nacelle
#

!code

tawny elkBOT
rigid island
onyx cypress
rigid island
#

fuckin hell..

rigid island
tawny elkBOT
#

mad No

Be mindful, if someone requests your code as text, don't send a screenshot!

rigid island
#

send the link

onyx cypress
#

one sec

#

forget it

somber nacelle
#

it's honestly impressive how bad some people are at following simple instructions

broken light
#

whats the simplest way to prevent more than one scriptable object of a type being created

#

in my case i have an item database scriptable object, so there should not be two of these assets in the project

#

need to make sure if that happens i can throw an error or something

somber nacelle
#

you could put some code inside of Reset that checks the asset database for another object of that type. of course you'd then also have to wrap that in preprocessor directives. or you could go the even more cursed route and make it a singleton

broken light
#

hmm i see i wonder why theres no built in attribute to prevent more than one

#

unless i should not use a scriptable object

little meadow
#

why do you care about it being one though? having multiple can be useful for testing things and whatnot, plus usually you don't accidentally make more, and even if you do, they shouldn't break things

steep snow
broken light
#

yeh but its scene specific where as singletons are around for most of the application

gray mural
little meadow
#

wait... so you have different SO class for each scene?

broken light
#

different instances of the database

little meadow
#

so... you do want more than one... I am confused

gray mural
broken light
#

oh sorry i even confused myself there lol. no there is only one SO asset file but it exists for specific scenes that load from it but not all scenes need it so its not loaded in for those scenes (addressable situation)

#

for example i dont need it on the main menu

gray mural
little meadow
#

ah, okay... so... I'd generally just ignore this and just not make more instances ๐Ÿ˜„ unless it makes you really sad... in which case you can always make an something-something-asset-processor, which tells you "hey, these new assets were added" and you can then go through them, detect that some of them are not what you want and show the user a message "how about I delete those, huh?!" and then no matter what they pick - you delete them anyway to assert dominance!

broken light
gray mural
little meadow
spiral palm
#

is there a way to get a specific peice of data from a json?

broken light
olive bobcat
#

Subclass or Dictionary?... that's the riddle! ๐Ÿค”
Is it a subclass costly and heavy to store datas on the fly when you have about of 10/15 objects that interact with a trigger every ... mmm... 15/30 seconds?

broken light
#

json newtonsoft library

#

its a unity package in package manager

spiral palm
broken light
#

unity does the bare minimum for json

#

lol

spiral palm
#

it doens't appear in the unity package manager

olive bobcat
#

I have to manage a spaceship traffic, and I need to store about 5 or more different datas, so I was planning to use a List ... but a dictionary would be be |_____________ o _______________/ that long

#

So ... I was thinking about a subclass with a bunch of parameters.. it's easy to store it and also less chance to mess us with value ๐Ÿ™‚

spiral palm
olive bobcat
#

Yea, why not.. why I shouldn't use a subclass I like it so much in the end ๐Ÿ˜„
don't you think are nice? ๐Ÿ˜„

wide terrace
olive bobcat
#

See the trigger?
when the ships enter on the right side of the trigger I have to store
Class of the ship.
steering value
engine speed
if it's player or not
fuel
agent which is driving the ship.

So I guess to make a subclass with all of that parameters could be a nice idea, so I will store the subclass in a List for all the ships that use the tunnel

#

๐Ÿค” Could be better than a dictionary... I guess.

steep snow
#

Dictionary has a key and a value, the value can be simple, an int, or a complex set of data in a struct or class

onyx cypress
#

this error happens when i press on select player mask in inspector

#

this my code

rigid island
#

restart unity

#

also next time send the Link not the pasted

onyx cypress
#

oh ok sorry

knotty sun
frosty surge
#

I have an egg falling (in the direction of rocks) and you can control it right and left using its rigidbody in x axis, i want to know how can i increase its fall speed by code overtime, lowering mass and drag didnt work

rigid island
frosty surge
rigid island
onyx cypress
#

my monster only goes to three checkpoints

#

not all of them this is my code

rigid island
#

and shares the code wrong again

#

primo

onyx cypress
#

ok mate

#

isnt a big deal but ok

rigid island
#

making it inconvienet for someone to help you is the best way not to get help..

onyx cypress
#

ok

rigid island
#

this is wrong btw waypointIndex >= waypoints.Length

#

you always -1 the length for indexes

onyx cypress
#

oh

rigid island
#

as collections start from 0 index
10 items index can only go up to 9 etc.

rigid island
onyx cypress
#

yea

rigid island
#

I don't have eyes on your project, by the code alone I cannot know if its wrong

onyx cypress
#

it always stops in the 3rd checkpoint

rigid island
#

alright so that would be index 2?

onyx cypress
#

so it only goes to each checkpoint 3 times

#

yea

rigid island
onyx cypress
#

yea only first three

#

then just stays there

rigid island
#

can you show where all the waypoints are placed

onyx cypress
#

if i move the thing it goes the same checkpoint it stopped

rigid island
#

so the index is still there at 2 ?

onyx cypress
#

yea

#

this is one of the checkpoints

rigid island
#

also what is the stopping distance of agent? is it less than 1 at least

onyx cypress
#

its 0

rigid island
# onyx cypress its 0

alr can you record a short vid of whats happening with the agents inpsector visible

onyx cypress
#

ok sure

rigid island
#

not really seeing anything in the code that would stop it so early

storm wolf
shell scarab
rigid island
shell scarab
#

wait hold on it contains the manifest.... ok I guess "ProjectData~" inside of Packages should be in gitignore?

storm wolf
#

Like how do you go from just implementing an interface to it getting autosaved

#

Like for me I have to add my saveable stuff to the โ€œPlayerDataโ€ before it saves

shell scarab
#

should I ignore Packages/package/ProjectData~/ or Packages/package/?

storm wolf
knotty sun
shell scarab
onyx cypress
onyx cypress
#

because the first time i recorded it i messed something up, skip forward when i play it again

shell scarab
#

ahhh @knotty sun I know what did it, Unity Visual Scripting. For some reason it initialized on my brand new project. It is something that needs to be ignored.

onyx cypress
rigid island
#

each ISaveable has their own Data they save to

storm wolf
#

U dont have [Serializeable] on the interface tho right

rigid island
#

somesave to GameData, other PlayerData etc.

rigid island
# onyx cypress

Debug.log the Distance check and see whats going on there, start by trial and error

storm wolf
rigid island
#

the only thing that knows about the interface is the Save manager

storm wolf
#

Whatt

rigid island
#

yes they each send their own struct/class to save in the final class that actually writes to file/cloud or whatever

#

I can give you a basic example but I'm not at my workstation rn. I have easier time showing than explaining lol

storm wolf
#

Any example would be helpful lol

storm wolf
#

But then you would need to tell the objects they are isaveable

rigid island
#

the interface is in place to run specific method on all of them. or grab a specific item/struct

#

like .Save method lets say

storm wolf
#

Yeah i think thats the confusing part

#

But the objects arent ISaveable?

#

How do they call that method then

rigid island
#

the save manager

rigid island
#

an event usually starts the whole thing for me

opaque vortex
#

I would like to code my own SDK for users to upload their own custom avatars in my game, does anyone know where I can learn this?

onyx cypress
#

it ended on waypoint 4

storm wolf
rigid island
onyx cypress