#archived-code-general

1 messages ยท Page 86 of 1

tawny elkBOT
#
Posting code

๐Ÿ“ƒ Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

๐Ÿ“ƒ Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

gray mural
#

I have this:
((float min, float max) neg, (float min, float max) pos) x
What is the best way to get Random.Range from x.neg.min to x.neg.max OR from x.pos.min to x.pos.max?

heady iris
#

are you saying that you want a random number that's either between [x1,x2] or between [x3,x4]?

gray mural
#

with Random.value?

heady iris
#

should it be a 50-50 chance to get either?

gray mural
#

yep

heady iris
#

then just see if Random.value < 0.5f

#

there's your 50-50

gray mural
#

oh

#

i knew that

#

there is no way better though?

#

just Random.value?

glossy basin
#

Hello there, has anyone messed with UniTask before? I have an issue of calling my task an insane amount of times (I am calling it on Update), I want to know whats the method for not calling the same if it is already pending

leaden ice
#

Doesn't really have anything to do with unitask

glossy basin
leaden ice
#

So you're just checking the status of the new task you create

glossy basin
#

I need this to be on Update, as this is an infinite world generator

leaden ice
glossy basin
#

it does finish

leaden ice
#

You'd need to look at the code for CreateChunkAsync

#

Or make another function in between that checks if there's already a task for that coordinate on progress

glossy basin
leaden ice
# glossy basin

But you're not putting anything into world data untill the Chunk is done

#

So it's going to start that process anew every time

#

You need to track the pending tasks for creating chunks too

#

You could make another dictionary that tracks the in progress tasks

glossy basin
gray mural
#

I cannot drag GameObject to SerializedField of Prefab, what should I do then?

hexed pecan
#

(Or other prefabs but that doesnt help)

#

Either have that focal point as part of the prefab, or set it via code

gray mural
#

I should Instantiate prefab with script already

hexed pecan
#

You can set the reference right after spawning it

gray mural
hexed pecan
#

Or have the focalpoint object be a child of your prefab. But idk if thats valid in your case

gray mural
#

oh, ok, thank you, @hexed pecan

fluid lily
#

If I have a Vector2 that I cast to object, can I then cast object to Vector3, or do I have to to cast to Vector2 and then cast to Vector3?

heady iris
#

hm, good question

#

I'd expect an error caused by an invalid unboxing

#

the example tries to unbox an int as a short

#

and it errors

warm stratus
#

i tried with a list that contains all the audioSource, but when i change scene, the list reset but i am in DontDestryOnLoad

uncut vapor
#

Why can't I use System.Windows.Forms?
Google told me I gotta add it in dependencies but it's not there

knotty sun
gray mural
#

GameObject.FindGameObjectWithTag does not find not active GameObjects in scene, right?

knotty sun
uncut vapor
knotty sun
warm stratus
fallen epoch
#

Where is the list?

knotty sun
winged tiger
#

guys can I run code like

if (settings.type == "removable_part")
        {
            randomTime = Random.Range(1, 5);
            kosiarka = FindObjectOfType(typeof(Kosiarka)) as Kosiarka;
            attachParent = transform.parent;
            GameObject attach = new GameObject(gameObject.name + "_pos(created)");
            attach.transform.position = transform.position;
            attach.transform.rotation = transform.rotation;
            attach.AddComponent<BoxCollider>().size = new Vector3(0.01f, 0.01f, 0.01f);
            attach.transform.SetParent(transform.parent);
            attachPos = attach.transform;


            last = takenOff;

            if (Bolted)
            {
                int childCount = transform.childCount;
                List<Bolt> children = new List<Bolt>();
                for(int i=0; i < childCount; i++)
                {
                    Transform currentChild = transform.GetChild(i);
                    if(currentChild.GetComponent<Bolt>())
                        neededToUnScrew.Add(currentChild.GetComponent<Bolt>()); 
                }
            }
        }

in the editor? Like [MenuItem("")] but it uses non static variables so I have no idea even If I can do something like that

winged tiger
#

oh

#

okay thanks

vale spade
#

if i switch scenes, do all game objects get destroyed ?

knotty sun
warm wren
#

or switch scenes additively

vale spade
knotty sun
#

no

vale spade
#

cool ๐Ÿ™‚

#

As an embedded software engineer i question all garbage collection ๐Ÿ˜„

knotty sun
#

there is gonna be a lot of GC

warm stratus
#

public void disableAllSounds()
{
Debug.Log(" BLABLA "+GetComponents<AudioSource>().Length);
AudioSource[] audioSources = GetComponents<AudioSource>();

    foreach (AudioSource audioSource in audioSources)
    {
        if (!toRemove.Contains(audioSource))
        {
            toRemove.Add(audioSource);
        }

    }
}

here is my function, the Debug.Log show 0 but in all Update it shows 1 i really don t understand why

tawny elkBOT
#
Posting code

๐Ÿ“ƒ Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

๐Ÿ“ƒ Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

vale spade
#

i would like to load only Hub when i press play, is that possible ?

warm stratus
vale spade
warm stratus
#

ok thanks

knotty sun
# warm stratus ok thanks

that looks like a scheduling problem, you are destroying the AudioSource at some point so maybe debug when you do that

warm stratus
#

i mean i wan t HAHA 1

#

in Start and in Update

knotty sun
#

it's simple
if Update shows 1 but then disableAllSounds shows 0 then deleteSource has run. It's up to you to figure out how and why

warm stratus
knotty sun
#

there is no Start method in the Code you posted

warm stratus
knotty sun
#

what am I? A mind reader?

warm stratus
#

` private void Start()
{
FindObjectOfType<AudioManager>().disableAllSounds();
}

private void Update()
{
    FindObjectOfType<AudioManager>().disableAllSounds();
} `

sorry, here it is (Update is to Debug)

solemn rune
#

Question: I want to use Update in a custom editor script. So I use void OnEnable() { EditorApplication.update += Update; } to run an Update function. But I get null reference when trying to reference an Event (Event current = Event.current;) this does work in OnInspectorGUI. What am I doing wrong?

knotty sun
#

and the Play method is called when?

warm stratus
#

in Awake... ok that s not good

knotty sun
#

Also it looks like not only does Play add the AudioSource, it also deletes it after a delay

tawny elkBOT
#
Posting code

๐Ÿ“ƒ Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

๐Ÿ“ƒ Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

warm stratus
gray mural
warm stratus
solemn rune
#

let me make my problem a bit clearer

#

Im using Event.OnMouseDrag in OnInspectorGUI. How would I get this a bit more fluent?

#

Im not Debug.Logging anything btw. I'm assuming here that OnINspectorGUI is just not being called fast enough for that to be fluent

warm stratus
#

ok i try not on a prefab to see if the prefab is the problem(i think not)

#

it s not ...

warm stratus
severe coral
#

If I have a class layout like this...

        public abstract class Operator { }
        public abstract class Operator<AType, BType, CType, ACalc, BCalc, CCalc> : Operator
        {
            public abstract CCalc Operate(ACalc a, BCalc b);
            public abstract CType Combine(CCalc[] separated);
            public abstract CCalc[] Separate(CType combined);
        }
        public abstract class IntComposedOperator<ABCType> : Operator<ABCType, ABCType, ABCType, int, int, int>
        {
            public class Add : IntComposedOperator<ABCType> { public override int Operate(int a, int b) => a + b; }
            public class Subtract : IntComposedOperator<ABCType> { public override int Operate(int a, int b) => a - b; }
            public override ABCType Combine(int[] separated) => default;
            public override int[] Separate(ABCType combined) => default;
        }
        public abstract class Vector3IntOperator : IntComposedOperator<Vector3Int>
        {
            public override Vector3Int Combine(int[] separated) => new Vector3Int(separated[0], separated[1], separated[2]);
            public override int[] Separate(Vector3Int combined) => new int[] { combined.x, combined.y, combined.z };
        }

How would I use reflection to get an array of the "Add" and "Subtract" classes specifically dervied from Vector3IntOperator? I've tried doing this but it doesn't seem to work... (This bit uses some linq aswell)

    public static Type[] GetDerivedTypes(this Type type, bool includeGenerics = true) => type.Assembly.GetTypes().Where((t) =>
    {
        return t.IsSubclassOf(type) && (includeGenerics || t.ContainsGenericParameters == false);
    }).ToArray();
fallen epoch
#

```csharp at the start

severe coral
#

thanks

wide terrace
#

Maybe set a trigger area covering the interior of the house, then fade the roof out OnTriggerEnter2D() and fade it back OnTriggerExit2D()?

#

Or toggle it with a trigger in the threshold

vital comet
#

Hey guys, I'm running into a NullReferenceException error currently. I've been away from unity for a while so I just updated my Hub to the latest and downloaded Unity 2021.3.23f1 a couple of hours ago. I created several 2d and 3d projects to make sure it always happens and immediately once I load the project I get the error in the console.
This is the full error.
NullReferenceException: Object reference not set to an instance of an object
Unity.PlasticSCM.Editor.ProjectDownloader.ParseArguments.GetOrganizationNameFromData (System.String data) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/ParseArguments.cs:42)
Unity.PlasticSCM.Editor.ProjectDownloader.ParseArguments.CloudOrganization (System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/ParseArguments.cs:24)
Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.DownloadRepository (System.String unityAccessToken, System.String[] commandLineArgs) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:63)
Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.DownloadRepository (System.String unityAccessToken) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:51)
Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.Execute (System.String unityAccessToken) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:43)
Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.RunOnceWhenAccessTokenIsInitialized () (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:32)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <9959c9185b684a4d9d56448296fb9048>:0)

#

If I double click the error it opens the ParseArguments.cs file and selects this line.
if (data.Length < guidLenght + 1)

#

All my code still runs fine but constantly getting an error seems worrying. ๐Ÿ™‚

vital comet
#

I don't believe so, I don't even know what it is.

fallen epoch
#

Version control system, Unity owns it.

knotty sun
#

In that case remove the Version Control package via the Package Manager

vital comet
#

Ah, I think I may know what is happening. I think a friend and I may have used it several years ago to try and code something together. I didn't realize packages carried over between installations. Let me go remove that and see if it fixes the issue

knotty sun
vital comet
#

Yeah, that definitely sounds familiar

#

Thank you guys, that fixed it and let me know to go delete/update old packages that might have messed me up in the future. UnityChanThumbsUp

knotty sun
#

good rule of thumb, when you create a new project first thing to do is remove unwanted packages from the package manager

vital comet
frigid bone
#

How would you guys handle attack delay? , for instance :
Enemy Attacks -> 0.25 seconds later the hit lands , if the player is close , player takes damage.

Im unsure how to deal with the delay.
The entire "Enemy is near - attack - call function on player" part is easy , its just the delay thats the main problem

weak vapor
#

naively you could have one method that does the animation, and then have the delayed invoke call do your hit check

fallen epoch
#

Depending on how you're handling it, you could flicker a collider after the amount of time

frigid bone
weak vapor
#

my go-to for this sort of thing are coroutines

#

using invoke is a quick and dirty way to get it done

frigid bone
#

How dirty is it tho?

#

Im not planning on any pausing

weak vapor
#

lets say that the level ends before the hit check happens

#

you might need some conditional in the hit-check logic to negate it in that case

#

coroutines on the other hand can be more easily interrupted

frigid bone
#

Do you have any documentation for coroutines?

#

Ive never used it before

weak vapor
#

they're a staple in c#; i reccomend googling for a resource that you like interacting with

#

youtube tutorials if you're visual/audio

frigid bone
#

Ohh dang , have i missed something big?

limber fog
#

script that moves a thing when its inside the window

    [SerializeField] public MouseMoveManager mmm;
    [SerializeField] public RectTransform rectTransform;
    [SerializeField] private Canvas canvas;
    // Start is called before the first frame update
    void Start()
    {
        mmm = Window.GetComponent<MouseMoveManager>();
    }

    private void Awake()
    {
        if (rectTransform == null)
        {
            rectTransform = transform.parent.GetComponent<RectTransform>();
        }
        if (canvas == null)
        {
            Transform testCanvasTransform = transform.parent;
            while (testCanvasTransform != null)
            {
                canvas = testCanvasTransform.GetComponent<Canvas>();
                if (canvas != null)
                {
                    break;
                }
                testCanvasTransform = testCanvasTransform.parent;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        
    }
    public void OnDrag(PointerEventData eventData)
    {
        if (mmm.inWindow == true)
        {
            rectTransform.anchoredPosition += eventData.delta / canvas.scaleFactor;
        }
        
    }```

it works correctly, its just working a little to well...
frigid bone
limber fog
#

how would yall suggest i fix the above problem?

frigid bone
weak vapor
#

glad to hear it!

junior pollen
#

Hello, how can i change a volume's override values from a script? tried looking in the unity documentation but found nothing

junior pollen
#

saw this one but im using urp and not hdrp

eager flame
#

Hi so I just took a tutorial my lecturer gave me on how to make a character jump but the character only jumps in certain places, when the character is on a higher platform they refuse to jump when I hit the space bar

somber nacelle
#

sounds like you are probably using a layermask for your ground check and those higher platforms are not on a layer included in the mask

wicked tangle
#

I've never used hdrp but I think the volumes are the same

eager flame
somber nacelle
plush blaze
#

good evening everyone. i have a problem: i have set in my app the possibility to change from full screen to window. I save the settings. When I load the app again, the toggle is ticked, when it should not be. How do I solve this?

clever spade
#

Save your settings

plush blaze
#

I have already set the save settings works, but in the canvas the toggle is ticked and should not be. The app starts in the window.

clever spade
#

And your toggle is reading from your save?

eager flame
#

Well the character seems to just jump in certain areas since adding the ground check (transform) to my player controller script so perhaps that seems to be where the issue started

plush blaze
# clever spade And your toggle is reading from your save?

I set it up like this in the Option Menu script:


public void SetFullscreen (bool isFullscreen)
    {
        Screen.fullScreen = isFullscreen;
    }

    public void SaveSettings()
    {
        PlayerPrefs.SetInt("QualitySettingPreference",
                   qualityDropdown.value);
        PlayerPrefs.SetInt("ResolutionPreference",
                   resolutionDropdown.value);
        PlayerPrefs.SetInt("FullscreenPreference",
                   Convert.ToInt32(Screen.fullScreen));
        PlayerPrefs.SetFloat("VolumePreference",
                   currentVolume);
    }

clever spade
#

Where are you loading your settings?

#

You save it but you aren't doing anything to read from it when you start the app?

plush blaze
#
  public void LoadSettings(int currentResolutionIndex)
    {
        if (PlayerPrefs.HasKey("QualitySettingPreference"))
            qualityDropdown.value =
                         PlayerPrefs.GetInt("QualitySettingPreference");

        if (PlayerPrefs.HasKey("ResolutionPreference"))
            resolutionDropdown.value =
                         PlayerPrefs.GetInt("ResolutionPreference");
        else
            resolutionDropdown.value = currentResolutionIndex;

        if (PlayerPrefs.HasKey("FullscreenPreference"))
            Screen.fullScreen =
            Convert.ToBoolean(PlayerPrefs.GetInt("FullscreenPreference"));

        if (PlayerPrefs.HasKey("VolumePreference"))
            volumeSlider.value =
                        PlayerPrefs.GetFloat("VolumePreference");
        else
            volumeSlider.value =
                        PlayerPrefs.GetFloat("VolumePreference");
    }

#

and then in the void Start I insert LoadSettings(currentResolutionIndex);

bleak python
#

I need to debug text mesh pro source files, but all my changes get wiped on reload. How do I get past this?

dull yarrow
#

How to save my characters data and inventory and all in a script?
Make lists of different classes?
What if the items are scriptable objects?

hollow hound
#

Is there a simple way to find vertices of a rotated box collider in 2d?
Technically I can calculate it based on it's bounds with some adjustments for rotation, but is there more simple and straightforward way to find them?

junior pollen
#

hello, can someone help me with this?

wide terrace
junior pollen
#

it's supposed to be PostProcessManager instead of VolumeManager

#

but that also gave an error

#

ig the post i took this from is old?

wide terrace
#

Well the error's just saying that the VolumeManager class doesn't seem to have a method called QuickVolume(). I don't know what either the VolumeManager or the PostProcessManager classes look like or if they have such a method, so I can't say how you should correct that

junior pollen
#

ah

#

is there any other way to change a volumes override values from a script?

wide terrace
#

I don't know - hopefully someone more knowledgeable will chime in!

junior pollen
dull yarrow
#

```playerTeamData = new List<Class_Character>(SavePlayerData.playerTeamData) ;```` This is copying my list without references correct?

clever spade
# junior pollen <:sadok:1068114223621754981>
{
    VolumeProfile profile;
    ChromaticAberration chroma;

    private void Start()
    {
        profile = GetComponent<Volume>().profile;
        
        if(profile.TryGet<ChromaticAberration>(out chroma))
        {
            chroma.intensity.value = 1;
        }
    }
}```
Maybe this will help you.
thorny onyx
#

ive been on this problem for a while now, I want to add a gliding mechanic to my flying game controlled by the mouse (classic momentum based glide) however when using rigidbody the downwards momentum becomes too much to go back up efficiently

#
        rb.AddForce( transform.right * 200f * Time.deltaTime);``` dont rly have much important code its pretty straight forward
#

inversing my y velocity when mousepos.y > playerpos.y might give the effect im looking for?

#

however i still want gravity in effect

void basalt
#

@thorny onyxAddforceAtPosition

#

there is also 0 reason to be using time.deltatime

thorny onyx
#

alright

void basalt
#

I mean, you COULD use time.deltaTime if you want your 200 to be spread out over 1 second

thorny onyx
#

nah that doesnt sound efficient

void basalt
#

When you're building flying mechanics, you have to think to yourself "how does an airplane actually work?"

#

adding force upwards at the center definitely isn't how it works

#

Planes have ailerons on their wings. I think that's the right term

#

when they move, they generate lift

thorny onyx
#

thats not what im doing though is it

void basalt
#

"gliding mechanic to my flying game"

thorny onyx
#

no i meant im not applying it at the center

#

its going right

#

how would make it more like an airplane then

void basalt
#

just told you

thorny onyx
#

ok lemme think

void basalt
#

planes have moving flaps on their wings

#

when the pilot pulls on the stick, these flaps move

#

you don't have to make flaps, but you have to think about what they're doing

#

honestly you could probably just get away with adding force at the nose of the plane

thorny onyx
#

so more x speed = more y potential momentum?

#

its a flying squirrel btw not a plane

void basalt
#

alright

#

I would just add the force at the head of the squirrel

thorny onyx
#

what would be the best way to calculate that pos

void basalt
#

parent an empty rigidbody to it. Position it yourself

#

empty gameobject

#

not rigidbody

thorny onyx
#

ah ok

#

that does feel much better

#

although i do want it to feel more arcadey where the x velocity can easily be transferred into y velocity

#

not take 5 seconds to reverse

#

that was my original question, not sure how to do that

void basalt
#

I mean, there's a bunch of ways to go about this problem

#

If you detect a key change, you could just set the velocity to 0,0,0

#

but ONLY when a key changes. Otherwise your squirrel will not move

thorny onyx
#

wont that look bad though having it stop all of the sudden

void basalt
#

yes

#

you'll have to brainstorm some stuff

spark sandal
#

hey all, bit of a conundrum for me. I have a method that takes in a Dictionary<T, int>, does some stuff, and returns T. not sure how to handle returning null or some kind of "bad value which probably should never happen"

public T Method<T>(Dictionary<T, int> dict) {
   foreach (KeyValuePair<T, int> entry in dict) {
       if (whatever) {
           return entry.Key;
       }
   }
  // this doesn't work obviously
   return null;
}
#

this technically doesn't throw any errors but seems... weird?

return (T)System.Convert.ChangeType(null, typeof(T));
wide terrace
spark sandal
#

sometimes it's objects, sometimes it's ints

wide terrace
#

I'm bad with generics, but would like to suss this out as well ๐Ÿ˜…

spark sandal
#

from what i can tell, convert.changetype will basically make me a default value int, or a null object. which is what i want pretty much. ๐Ÿคž

wide terrace
spark sandal
#

so just return default;?

#

ha doesn't throw any errors..

wide terrace
#

The thing I'm looking at says

public T? Method<T> (//...
{
  //...
  return default;
}

...but I'm not sure if it's necessary to make the return type nullable up there

spark sandal
#

this appears good for now. thank you!

wide terrace
#

very cool! Yell at me if it goes sideways ๐Ÿ˜

heady iris
#

yeah, default is what you want there

wide terrace
heady iris
#

this is not necessary if you just use default, since it'll choose an appropriate value for the type

#

It would be necessary if you wanted to be able to return null

wide terrace
acoustic scroll
#

Are there any issues with using a MonoBehaviour to run a coroutine using an IEnumerator from a different script?

I've started it like this:

coReposition = actor.StartCoroutine(CoReposition(station, repositionDuration));

But it only gets through the first yield return new WaitForEndOfFrame() and just stops.

#

And I mean just stops. Even the code immediately after the loop is ignored.

leaden ice
#

I general, It's best practice to run coroutines on the Monobehaviour that declares them to avoid confusion about which object's lifecycle the coroutine is tied to.

But there's no technical issue with what you're doing as long as you understand how it works

acoustic scroll
#

The container for the IEnumerator isn't a monobehaviour so it has to rely on one to run the coroutine for it. I know the actor isn't getting destroyed or deactivated so maybe it's the container... I'll do some testing.

leaden ice
#

Showing the coroutine code an explaining where it stops etc might help too

#

As well as other code around this

acoustic scroll
#

Woah, there's some other weird stuff going on with this. I suspect the script got pointed to the prefab rather than the object in the scene, which would be weird but it's happened before.

#

No, looks like it's definitely referring to the correct object. But here's something weird. Occasionally the actor will finish processing the coroutine as normal. I don't know what triggers it exactly.

#

Huh... apparently changing screen focus triggers it.

#

Yeah, it appears the coroutine only processes when focused in game view, even if scene view is actively rendering.

somber nacelle
leaden ice
#

Is there a good reason you're using WaitForEndOfFrame?

If you just need to wait one frame the correct way is yield return null;

faint hornet
#

anyone consider them comfortable with frustrum cullign in 2d spaces?

cosmic rain
#

Frustum culling is the same regardless of if your game is 2d or 3d.

faint hornet
#

gotcha

visual fractal
#

How do I get a player to spawn in a certain place with Network Manager without using spawn points?

visual fractal
#

Already asked there. Nobody is on that channel. Can you help?

#

Or do I need someone else?

potent sleet
#

maybe no ones actually understands what you're asking.
did you actually look at the pins ? they have NGO server pinned

visual fractal
#

Ok, well, here's something this might be the right channel for. Why is Visual Studio not linking to Unity?

cosmic rain
#

!vs

tawny elkBOT
#
Visual Studio guide

If your IDE is not underlining errors in red or autocompleting code,
please configure it using the link below:

โ€ข Visual Studio (Installed via Unity Hub)
โ€ข Visual Studio (Installed manually)

glossy basin
#

@leaden ice hello there, sorry for pinging this late, just wanted to thank you for your help earlier, queing up my data did solve the async task issue!

acoustic scroll
digital fern
#

Does someone knows a good resource about building an RTS controller where you can do things like :
-> Select Actors -> Select Ability "Cast Spell" -> Select "FireSpell" -> Select "CastPosition" -> Execute Cmd

mental kindle
#

hello! i just created a script that upscales a render texture to create 3d pixel art, but when i pan the camera, it has an odd warping effect. does anyone know how i can fix this?

#

https://www.youtube.com/watch?v=NutO1jzuVXU this is essentially the effect that i am looking to achieve, but im not sure how to

Date of Recording: 2020-10-10

Following the example of many 2D pixel art games, we render our scene at a low pixel art resolution (640x360) and upscale the result to the screen resolution for presentation. At render-time, the camera is snapped to the nearest "pixel", and when blitting to screen, the snap offset is corrected so that the camera i...

โ–ถ Play video
dusk apex
mental kindle
#

ill try to record a video

potent sleet
#

also using a RT is a cheap hack to get pixel rendering

mental kindle
#

then how should i do it?

potent sleet
#

I'd look into Shaders or URP Renderer feature

#

if you wanna check out the latter
https://youtu.be/-8xlPP4qgVo?t=101

Today I'm walking you through my new pixelated rendering code. I opted for this new approach to solve a couple issues I had with the old one.

This is NOT a tutorial: I've got plenty to learn about this subject and I don't feel qualified to talk about it in detail. I just felt like I should update you on this topic since I've outgrown my older t...

โ–ถ Play video
ocean river
#

im having problems with alpha setting...
i have a white sprite, its alpha should be set like "colUp.color = new Color (0, 0, 0, 200);", but ingame it doesnt change anything. only when its at 0 it goes fully transparent.
do you know what im doing wrong...?

#

this is the ... sprite

mental kindle
ocean river
#

i want to fade it like Color(0,0,0, color.a - fadeSpeed)

#

but it wont show the transparency ingame

#

only 0 and >=1 change stuff

potent sleet
#

code

ocean river
#

Sprite Renderer, like in the picture?

#

oh

#

its a object, a function called once.

            colUp.color = new Color (0, 0, 0, 200);
        } else {
            colUp.color = new Color (0, 0, 0, 0);
        }```
#

part of the code

#

just temporary tho

potent sleet
ocean river
#

im setting the alpha?

#

private SpriteRenderer colUp;

potent sleet
#

just change the alpha?

fallen epoch
#

There's no fade there, just a hard change from one value to another

potent sleet
#

there's that too

#

it needs to be in update / coroutine

ocean river
#

its just temporary.

potent sleet
#

then - the .a value

#

put it back in the color

ocean river
#

it doesnt do that transcult/transparent thing, its either full or empty there

#

.a is a temporary variable which cannot be changed

potent sleet
#

you have to create a copy, fade it then pass back in

fallen epoch
#

check the material - it might not be set up for transparency

ocean river
#

YEAH ik that but it doesnt even show the thing behind it

#

you get me

#

i know how do fade

fallen epoch
#

oh right, also that, actually saving the updated colour back to the material instance

ocean river
#

but it does only show like 255 or 0(i set it to 200 there)

#

the material is a sprite

#

like seen in the image

#

sprite default

#

another way to say it, when the value is above one it always shows the sprite like its set to 255, or the 0 thing

potent sleet
#

just try what i said

#
 [SerializeField] private SpriteRenderer sr;
    private void Awake()
    {
        var currentColor = sr.color;
        currentColor.a = 0.3f;
        sr.color = currentColor;
    }```
#

color class goes 0 -1

potent sleet
visual fractal
#

@cosmic rain I've configured it. Is there something I need to enable?

potent sleet
#

are you talking about VS ? you just enable it in preferences in unity after you got the workload @visual fractal

visual fractal
#

Which section of preferences?

potent sleet
#

did you not follow the guide

#

it's one of the steps

warm stratus
#

Hey, i have a problem

private void Awake()
    {
        Debug.Log("salut");
        deltaScene = "demarrage";
        if (instance == null)
        {
            instance = this;
        } else
        {
            Destroy(gameObject);
            return;
        }
        DontDestroyOnLoad(gameObject);
    }

When i call a function in a Start method, it seems that Destroy(gameObject); takes time to execute and the gameObject is not destroyed in the Start method when i destroy it on Awake

cosmic rain
warm stratus
cosmic rain
#

No. What's even "the end of Awake"? ๐Ÿ˜„

visual fractal
#

@potent sleet There is only an option for VS Code, and I can't for the life of me remember where I put Visual Studio on my computer.

warm stratus
cosmic rain
#

There's no such thing as "the end of Awake". Awake is just a function.

#

Start being executed after awake, doesn't create anything called "the end of awake"

warm stratus
#

the script execute each Awake and then each Start doesn t it?

#

ok it takes all script and execute Awake then Start and then it execute another script

#

?

potent sleet
#

it should tell you there

visual fractal
#

Ah. Ok. And where in the installer will I find this information?

cosmic rain
warm stratus
cosmic rain
#

There's DestroyImmediate, but why would you need to do that? It's not recommended.

warm stratus
#

@cosmic rain

potent sleet
#

why do you have more than 1 audio manager in scene

cosmic rain
potent sleet
cosmic rain
#

If it does, then it does it before you call Destroy, so DestroyImmediate wouldn't help either.

warm stratus
potent sleet
cosmic rain
visual fractal
warm stratus
warm stratus
cosmic rain
#

Make a scene only for initialization.

warm stratus
#

ok i try

#

it works YESSSS thanks dlich and Null you are awesome

hushed needle
#

Hello. I wrote some code for my game that changes the player's appearance direction with the cursor position. But currently, only two of the four directions work, but code is the same for all four directions.

#

this is my code (rotate45 = 0f)

mellow sigil
#

all those || should be &&

hushed needle
#

nice

gray mural
#
powerupIndicator = GameObject.FindGameObjectWithTag("PowerupIndicator");

GameObject with tag PowerupIndicator is not active in the scene, so I cannot find it. That throws null error though.
How do I find not active GameObject then?

warm stratus
#

Hey,
i made a script for saving in json
https://hatebin.com/cgkzohkqqw
but it don t work when i do

FindObjectOfType<JsonManager>().Save("volume", 1f);
FindObjectOfType<JsonManager>().Save("succes", new Dictionary<Vector2, bool>()
{
  {new Vector2(0, 0), true}
});
Debug.Log((Dictionary<Vector2, bool>)FindObjectOfType<JsonManager>().Load("succes"));

it shows null

primal wind
swift falcon
#

should such stuff as jumping (adding force to the player, not getting the input) go into fixedupdate or just update?

warm stratus
#

ah hmm is it possible to store a dictionnary in a json?

swift falcon
warm stratus
swift falcon
#

are you sure that Vector2 can be stored in JSON?

#

you may want to convert it to a list of two floats instead

warm stratus
swift falcon
warm stratus
swift falcon
#

either search manually through the list for fitting entries via fors or LINQ

#

LINQ is more convinient and readable, but unity runs .Net 4.7 and linqs in that are... far from optimal

#

so if it's called really often use fors

warm stratus
#

public Dictionary<int, int, bool> succes;

swift falcon
#

...you can't do that

warm stratus
#

aaaa

#

public Dictionary<List<int>, bool> succes;

#

@swift falcon

fallen epoch
#

How does tuples convert to json? Could just (int, int) if its clean

warm stratus
upbeat dust
#

Peformance question: are public voids expensive?

Lets say i have a method that i want to call from another script
Script A has the method
And i want to call it from script B

Is it cheaper to make a public bool, in script A, and modify it from script B, and check the value of bool in script A Update
Or simply make the method in script A public, and call it from script B
?

upbeat dust
#

really? not at all? But dont public voids take up more resources since they are sort of global?

west lotus
#

Also they are called methods not voids. void is simply a keyword indicating that the method does not return anything

fervent furnace
#

i think directly modify without function call will be better if you are so care about performance

#

or you just test it

west lotus
#

If its inly modifying a bool he will have to be literallion doing it 10s of millions of times a frame to even matter

upbeat dust
#

thats what i was thinking about, so public methods are better in my case?

#

my method only needs to be executed once

west lotus
upbeat dust
#

OK, thx for info

swift falcon
#

private and public methods don't have any difference post-compilation

#

they simply indicate what should and should not be called by other programmers

#

there are publicizers which allow you to make certain fields and methods public if you need that for some reason

upbeat dust
#

So the fact that the script has that transferable ability doesnt affect performance a lot?

swift falcon
#

...wha

west lotus
#

Its how often the methods are called and how heavy a work they do

#

That can impact performance

upbeat dust
#

Sorry im bad at phrasing questions. So calling a public method from another script, and calling a private method doesnt make much difference to performance?

swift falcon
#

I'd like to highlight that despite that, virtual methods do impact performance

upbeat dust
#

Got it, clear now, thx a lot

swift falcon
#

you shouldn't really care about performance in such cases unless something is called A LOT every tick

#

if you have issues then the bottleneck is somewhere else

upbeat dust
#

yeah its for a VR game, and due to its weak graphics processing and many scripts i have in there, just want to ensure the way i code is effective, on a large scale

west lotus
#

So adopt the profile often methodology

#

Write a script

#

Profile with the profiler to see how much that script takes up

swift falcon
#

yeah profiling is very useful

upbeat dust
#

For sure got to try that, thx guys

west lotus
#

Use markers to easily identify pieces of the code

swift falcon
#

wasn't able to find what exactly this one can be caused by, plus my jobs tab doesn't have leak detection entry

#

duckduckgo shows only unanswered stackoverflow questions when I google it

fervent furnace
#

i implement my object pool only for gameObject and i meet a problem, for every pooled GO, it has a reference to the pool's script so that it can pass itself back to the pool:
public ObjectPool pool; private void BeDestroyed(){ pool.ReturnPool(gameObject); }
how to not store the reference (using static variable in pool's script)? but what if there are more than one pools? use more static variables?
public static ObjectPool pool1,pool2,pool3... void Awake(){ if(gameObject.name=="XXXX")pool1=this; else if(gameObject.name="YYYY")pool2=this; ... }

sage latch
west lotus
swift falcon
#

only code I have is player movement

west lotus
#

Oh your not doing allocations yourself?

swift falcon
#

no, that's what surprised me

#

it doesn't seem to have anything to do with my code

west lotus
#

Well unity tends to have a leak here and there from version to version

swift falcon
#

I'll just ignore it then

west lotus
#

Does it happen when you enter exit play mode or constantly?

#

Might be worth it enabling the stack trace and sending a bug report

swift falcon
#

enter

#

yeah probably

frigid bone
#

A question about unity inheritence:
If i have a "Unit" base and a "Villager" child to that , does unity call "Update" on both of them or one?

sage latch
fervent furnace
#

child update() even if you dont override it, but the compiler will warn you

frigid bone
#

So i should try to keep the base with only functions and variables?

#

And keep the update on the "Endproduct" so to say

sage latch
#

In Unit:

protected virtual void Update() {
    ...
}
```In Villager:
```cs
protected override void Update() {
   base.Update();
   ...
}
frigid bone
#

Ohh so i call it inside gotcha

#

Thanks alot ๐Ÿ™‚

hard estuary
#

Is there a better way of writing (x % y + y) % y) or should I keep it as it is?

sage latch
#

You can make a function

fervent furnace
tawny elkBOT
#
Posting code

๐Ÿ“ƒ Large Code Blocks
Large code blocks should be posted as links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/
https://paste.myst.rs/, https://hastebin.com/

๐Ÿ“ƒ Inline Code
Surround code with three backquotes. Not quotation marks.
To get C# formatting the first line should only contain cs or csharp.
Add a comment with a line number if there is an error message.
```cs
// Your code here
```
Do not share screenshots of code unless requested.

gray mural
primal wind
#

Oh forgot, it's GetComponent that does

#

Sorry

gray mural
red scarab
#

Should I keep the "System.Collections.Generic" namespace in my script if I only have one Dictionary<>? Or should I change that implementation to "System.Collections.Generic.Dictionary<>"?

somber nacelle
#

the using directive does not impact performance so it's up to you

gray mural
#

I have found the solution for my previous issue in case someone needs it:

// finding non-active GameObject with tag

powerupIndicator = GameObject.FindObjectsOfType<GameObject>(true)
.First(w => w.CompareTag("PowerupIndicator"));
finite hazel
#

can anyone help me? i try to setup a terminal in debian to run as a server for my application in unity. i want to ask some basic things for ssh and ftp

heady iris
#

this is not a unity code question

#

this is also not a unity question

finite hazel
#

it is a unity question. since i am trying to do that, only to run unityproject.

#

and i am in general section

heady iris
#

Ask questions and discuss anything related to general coding concepts in Unity

uncut vapor
#

Is it possible to get Font from a byte[]

heady iris
#

there should be quite a few resources out there for getting a linux server set up

somber nacelle
finite hazel
#

can you help me find some? cuz all google is full of promos rigth now. always try to show you some difrent method using a diferent package. and no one uses unity as example.

uncut vapor
heady iris
#

you are asking questions about very basic configuration. go experiment with it for a bit.

#

that's how i learned when i was 14 and very bad at computers

#

(my first debian install didn't have sudo)

finite hazel
uncut vapor
#

???

finite hazel
heady iris
#

it's important to ask about what your original goal was

uncut vapor
#

Right, sorry

heady iris
#

no worries

heady iris
uncut vapor
#

Ye I still don't get what you mean

heady iris
#

i guess i should ask if you're attempting to do this at runtime

#

or just in the editor

uncut vapor
#

At runtime

somber nacelle
#
  1. why are you trying to do it at runtime?
  2. there doesn't seem to be any workflow i can find to convert a ttf file to a usable font for TMP at runtime, though unity's FontAsset class can get a font asset from a system-installed font
uncut vapor
#

Yeah I found that
But I can't get the Font itself which it needs as an argument, not TMP_FontAsset

heady iris
#

i really wish TMP called the result something other than a "font asset" when there's also the Font asset

somber nacelle
uncut vapor
#

Well yeah
But I still need Font
Which I got no clue how to get

somber nacelle
#

surely if you are doing this at runtime you will have a path to the downloaded font, no? so use that overload that takes the path to the file

uncut vapor
#

Ohh
I didn't see that it can take the path
Thx lmao

somber nacelle
#

i linked directly to the overload that takes a path . . .

warm stratus
#
public void Save(string fieldName, object value)
    {
        SaveObject saveObject;
        if (File.Exists(filePath))
        {
            string saveString = File.ReadAllText(filePath);
            saveObject = JsonUtility.FromJson<SaveObject>(saveString);
        }
        else
        {
            saveObject = new SaveObject();
        }
    
        var field = typeof(SaveObject).GetField(fieldName);
        if (field != null)
        {
            field.SetValue(saveObject, value);
        }
    
        string json = JsonUtility.ToJson(saveObject);
        File.WriteAllText(filePath, json);
    }


private class SaveObject
    {
        public float volume;
        public Dictionary<(int, int), bool> succes;
    }

Is that good to save juste 1 thing?

gray mural
#

ResetChildren() Coroutine is not started here:

private IEnumerator NewWave(bool firstWave = false)
{
    loadingWave = true;

    wave = (firstWave) ? 1 : wave + 1;

    Time.timeScale = 0f;
    yield return new WaitForSecondsRealtime(deathDuration);
    Time.timeScale = 1f;

    yield return StartCoroutine((IEnumerator)ResetChildren(enemiesDocument));
    yield return StartCoroutine((IEnumerator)ResetChildren(powerupDocument));
    yield return StartCoroutine((IEnumerator)ResetChildren(playerDocument));

    Instantiate(playerPrefab, playerDocument.transform);

    for (int i = 0; i < wave; i++) SpawnEnemy();

    for (int i = 0; i < Mathf.CeilToInt(wave / 2f); i++) SpawnPowerup();

    loadingWave = false;
}

that's ResetChildren() btw:

private IEnumerable ResetChildren(UIDocument parent) 
{
    foreach (Transform child in parent.transform) Destroy(child.gameObject);

    Debug.Log("reset");

    yield return null;
}
#

yield return Coroutine

somber nacelle
#

probably because ResetChildren returns IEnumerable instead of IEnumerator for whatever reason

#

the yield inside of it is also 100% pointless so i don't even see why this is supposed to be a coroutine in the first place

gray mural
gray mural
somber nacelle
#

the error is thrown because of the pointless yield return null which isn't actually serving any purpose and the fact that you are using StartCoroutine. it absolutely can be a normal method (and yes, it's called method not "void")

gray mural
#

nope, it cannot, wait for a while

somber nacelle
#

yes it can unless you have other code in there that you conveniently decided to leave out

heady iris
#

The names are very similar -- and, more annoyingly, you can kind of use them interchangeably

#

I actually do not understand why that's possible.

#

IEnumerable means "you can enumerate me" and IEnumerator means "I am an enumerator"

heady iris
#

that doesn't make sense to me; I'd think that this would have to be an enumerator

gray mural
#

oh wait

#

no

#

unity it now shown here

#

lol

#

I have switched to Unity in the middle, but you cannot see it

somber nacelle
#

yeah and for future reference, videos of your code is absolutely one of the worst ways to share your code

#

but there is literally nothing wrong with that method being a regular method that returns void. it serves no purpose in being a coroutine

gray mural
#

look, I gonna download the video

somber nacelle
#

use your words to describe why you think that has to be a coroutine

gray mural
somber nacelle
#

i doubt that

gray mural
somber nacelle
#

wow was it really so hard to just copy/paste the error?

#

that's also 100% unrelated to it being a coroutine or not, it's entirely caused by you destroying the object then trying to operate on it again

gray mural
#

yes

#
yield return StartCoroutine((IEnumerator)ResetChildren(enemiesDocument));
yield return StartCoroutine((IEnumerator)ResetChildren(powerupDocument));
yield return StartCoroutine((IEnumerator)ResetChildren(playerDocument));

with this thing it does not throw any errors, because I do them in order with yield return, so they are not executed simultaneously

somber nacelle
#

methods still happen sequentially. what is most likely happening is that the object that this coroutine is running on is being destroyed thereby ending the coroutine at the next yield

gray mural
somber nacelle
gray mural
gray mural
somber nacelle
#

the ones that teach you how the code works. you know the beginner courses. because you are assuming that the methods you call in that coroutine happen simultaneously which is not the case. your code is all running on the same thread so only one line at a time can execute

gray mural
gray mural
somber nacelle
#

why are you even destroying the objects anyway? if you want to "reset" them, just set them back to their starting positions and state

#

also wtf is up with your objects being children of a UIDocument

gray mural
heady iris
#

question mark

gray mural
somber nacelle
#

okay i'm not even going to attempt to help you anymore because your shit makes absolutely no sense and you don't seem to want help because you argue every little thing ๐Ÿคทโ€โ™‚๏ธ
good luck

gray mural
# gray mural oh, thank you, now everything works perfectly

@somber nacelle
I have said you "thanks" in this message, because you helped me to fix my issue. After that you were wondering why do I even need to use yield return Coroutine and I have explained it to you properly. I don't know why do you say that I am "arguing". I have said that my issue in non-simultaneously executed voids, that IS sure the issue. You have helped me - I have explained you why do I need to do so. I do not see any argument here.
Thanks for good luck though ๐Ÿ™„

deft hornet
#

Hi, i have a case opening system that is similar to csgo. A lot of random items go through and when the animation stops the skin at the middle is selected. I use a constant speed value to always make for example the 50th item to stop at the middle. When i test it and scroll once it goes as expected but after that the animation starts playing slower. Help plz

warm stratus
#

Hey, why it shows an error (when i print the entire Dictionnary it shows null)

private void Awake()
    {
        filePath = Application.persistentDataPath + "/" + fileName;

        SaveObject saveObject = new SaveObject
        {
            volume = 1f,
            succes = new Dictionary<(int, int), bool>()
            {
                {(0,0), true}
            }
        };

        string json = JsonUtility.ToJson(saveObject);
        Debug.Log(json);
        SaveObject loadedSaveObject = JsonUtility.FromJson<SaveObject>(json);
        Debug.Log(loadedSaveObject.succes[(0,0)]);
    }


leaden ice
leaden ice
warm stratus
deft hornet
# leaden ice CSGO almost certainly does not use the animation itself to select the item. Tha...

    public void Scroll(CaseScriptableObject casee)
    {
        if (_isScrolling) {
            return;
             }
        _speed = 6;
        originalSpeed = 6;


        if (_cells.Count == 0)
        {
            for (int i = 0; i < 100; i++)
            {
                CaseCell newCell = Instantiate(_prefab, transform).GetComponentInChildren<CaseCell>();
                _cells.Add(newCell);
                if (i == 67)
                {
                    winner = newCell;
                }
            }
        }
        foreach (var cell in _cells)
        {
            cell.Setup(casee);
        }


       
        print("Scrolling with speed: " + _speed);

        GetComponent<RectTransform>().localPosition = new Vector2(502, 14);
        print(GetComponent<RectTransform>().localPosition);

        _isScrolling = true;
        isOpeningCase = true;
        print(winner.gameObject.GetComponent<Image>().sprite.name);

    }

   


    private void Update()
    {
        if (_isScrolling)
        {
            print("help kfgdjgkdhf");
            float scrollDistance = _speed * Time.deltaTime * 15;

            transform.position = Vector3.MoveTowards(transform.position, transform.position + Vector3.left * 100, _speed * Time.deltaTime * 15);
        

            if (_speed > 0.05f)
            {
                float newSpeed = Mathf.Clamp(originalSpeed - Time.deltaTime / 1.8f, 0, 4);
                originalSpeed -= Time.deltaTime / 1.8f;
                originalSpeed = Mathf.Clamp(originalSpeed, 0, 4);
                _speed = Mathf.Clamp(speedCurve.Evaluate(newSpeed), 0, 4);
            }
            else
            {
                _speed = 0;

                if (isOpeningCase)
                {
                    unboxScript.Unbox(winner.selectedSkin);
                }

                isOpeningCase = false;
                _isScrolling = false;
            }
        }
    }
warm stratus
#

what can i use instead?

leaden ice
gray mural
#

oh

#

sorry @warm stratus, wrong person

warm stratus
warm stratus
leaden ice
#

but (int, int) is not serializable by JsonUtility either

warm stratus
#

without newtonsoft JSON
?

leaden ice
#

Use Vector2Int

warm stratus
leaden ice
#

and when these functions are called

#

please don't ping me like that

#

it's been 2 minutes

#

I don't respond as quickly as ChatGPT because I'm human

plush blaze
deft hornet
simple egret
warm stratus
#

@leaden ice i think that doesn t work

leaden ice
#

Define "that"

warm stratus
#

Vector2Int to serialize

leaden ice
#

Vector2Int serializes just fine

warm stratus
#

private class SaveObject
{
public float volume;
public Dictionary<Vector2Int, bool> succes;
}

leaden ice
#

As I aleady said

#

You cannot serialize Dictionary with JsonUtility

warm stratus
#

ahhh Dictionnary i thought juste Tuple

#

ok thanks

leaden ice
warm stratus
#

and List ?

leaden ice
#

It can serialize List

warm stratus
#

ahhhh sorry

warm stratus
ocean narwhal
#

Im using Creator Companion with Unity 3d, and I'd like to make a copy of the current world i've made so far so that if something goes wrong with the current one, I can open the new one without restarting completely. Is there a way to do this?

gray mural
agile axle
#

Hey folks!
I'm having a lot of trouble getting the Jobs system to work. No matter what I try, in both Unity 2022.1.23 and Unity 2021.3.15, I'm not able to access the IJob interface.
I've got the Collections package installed, and I'm using UnityEngine.Jobs, but the only interface available is IJobParallelForTransform

gray mural
#

@ocean narwhal
Assets => Export Package => Export (.unitypackage)

agile axle
leaden ice
#

If you type IJob does Unity get an error or just VS

ocean narwhal
agile axle
leaden ice
agile axle
#

Don't think so. In this instance I opened up a new project, brought in the packages, and tried to create a job

warm stratus
#

PraetorBlue it works !!!! thanks a lot

uncut vapor
somber nacelle
#

What about the one I linked to that very obviously takes a string? Do you have all of the correct parameters?

uncut vapor
somber nacelle
uncut vapor
#

The one the package manager showed me which is 3.0.6

somber nacelle
#

Okay and now for a question I should have asked earlier why are you trying to create a font asset at runtime?

uncut vapor
#

Because I want the player to be able to add their fonts?

somber nacelle
#

So you remember how I pointed out earlier you can get a FontAsset from installed fonts? Do that.

uncut vapor
#

???

uncut vapor
#

Unable to load font face for []. Make sure "Include Font Data" is enabled in the Font Import Settings.

abstract nimbus
#

Is this how you make sure your 2D game works for all resolutions? I'm not sure because I came up with this solution by myself lul

    private void AdjustViewportRect()
    {
        cameraComponent.clearFlags = CameraClearFlags.SolidColor;


        float currentAspectRatio = (float)Screen.width / Screen.height;
        float targetAspectRatio = fixedAspectRatio;

        if (currentAspectRatio > targetAspectRatio)
        {
            float newWidth = targetAspectRatio / currentAspectRatio;
            float xOffset = (1f - newWidth) / 2f;
            cameraComponent.rect = new Rect(xOffset, 0f, newWidth, 1f);
        }
        else
        {
            float newHeight = currentAspectRatio / targetAspectRatio;
            float yOffset = (1f - newHeight) / 2f;
            cameraComponent.rect = new Rect(0f, yOffset, 1f, newHeight);
        }
    }
#

this script is attatched to my camera

leaden ice
abstract nimbus
#

to make sure objects in my scene are not outside the edges

#

objects that are not in a canvas to be specific

#

I want the aspect ratio to always be 16:9 in this example

leaden ice
#

so you want to force a given aspect ratio

abstract nimbus
#

yes

#

this code does that tho but idk if there is something in unity for this already

leaden ice
#

It's too early for me to think about the math but sure something like checking the screen reatio and adjusting camera viewport makes sense

uncut vapor
abstract nimbus
#

I mean I would have to use this script on all of my 2D games

abstract nimbus
#

oof

#

isn't that a very common issue tho?

leaden ice
#

I'm not a Unity developer

#

please don't ask me to justify their decisions lol

abstract nimbus
#

you shouldn't have answered in the first place tho (uh sorry that sounded rough)

#

oh Unity developer as in you work with unity. I thought you meant you don't know much about unity ๐Ÿ˜‚

floral zephyr
#

I need help

#

when I press W and S at the same it time, it adds both speeds up and it makes me go faster

#

how do I clamp it, to not go faster when I do that

oblique spoke
abstract nimbus
#

๐Ÿค”

#

I'm using orthographic mode tho

oblique spoke
abstract nimbus
#

uh I guess not, idk what that is

oblique spoke
#

Unity package for all kinds of camera stuff

abstract nimbus
#

I haven't installed anything like that so I think not

#

oh well I will stick to my solution cuz it works great anyway ๐Ÿ˜‚

#

I was just curious

#

(it was my solution but GPT wrote the code lul)

worn musk
#

Is this the code general chat?

restive ice
worn musk
#

You were meant to Say No Its patrick ๐Ÿ˜ 

vagrant agate
#

anyone know if I can sync char[,] network variable through netcode

restive ice
#

im trying to make a jump script that takes the rotation of my player and the angles of the surfaces they land on into consideration.
as you can see in these two gifs, it works fine for horizontal surfaces but not for slanted surfaces. On slanted surfaces, I seem to jump in the exact opposite direction of what I'm expecting. I'm not sure how I should decide when to reflect the jump vectors' x and z components, I think that's whats going wrong here.
Can anyone help me?
Here's the code I'm currently using for my AttemptJump method:

private void AttemptJump()
{
    var ray = new Ray(transform.position, -transform.up.normalized);
    RaycastHit hit;
    if (!Physics.Raycast(ray, out hit, _jumpCheckDistance)) return;
    if (rb.velocity.y >= 0) return;

    rb.velocity = Vector3.zero;

    var jumpDirection = Vector3.Reflect(ray.direction, hit.normal);
    jumpDirection.x *= -1;
    jumpDirection.z *= -1;
    
    Jump(jumpDirection);
    
    Debug.DrawRay(hit.point, -ray.direction.normalized, Color.magenta, 1f);
    Debug.DrawRay(hit.point, hit.normal, Color.red, 1f);
    Debug.DrawRay(transform.position, jumpDirection, Color.yellow, 1f);
}
deft hornet
# deft hornet ```cs public void Scroll(CaseScriptableObject casee) { if (_isS...

Hi, i have a case opening system that is similar to csgo. A lot of random items go through and when the animation stops the skin at the middle is selected. I use a constant speed value to always make for example the 50th item to stop at the middle. When i test it and scroll once it goes as expected but after that the animation starts playing slower. Help plz

plush blaze
hexed pecan
#

I mean surely its there for a reason but isnt that what makes it go opposite of what you expect?

restive ice
#

on a flat surface, i could just use transform.up to find the direction for the jump

#

but on a curved surface, that would look weird

#

if I were to fall directly above on a circle like so:

#

that would shoot me in this direction

#

when youd expect this right

#

so I need to reflect the incoming vector, aka -transform.up

#

in the hit.normal

#

but if you do that on a flat surface

#

you'd jump like so:

#

hence why I reflected the z and z components there to jump back into the green direction

#

but that obviously then breaks the same thing for tilted surfaces

rugged storm
#

hay I have this script for making a grid, of randomized tiles, I now want to make more levels(each their own scene), each with different tile sets, my first thought is to make a public list of possible tiles for it to pick from (and give every tile type a weight but not sure how to do that) then set that list in each scene via the inspector in unity, is this a good way to go about doing it? https://gdl.space/ivejigahav.cs

restive ice
restive ice
hexed pecan
hexed pecan
rugged storm
restive ice
restive ice
rugged storm
#

my projects is just a 2d turn&grid based rpg thing

restive ice
swift falcon
#

Can anyboyd help me with sending a message from unity to/using/with discord webhook?

restive ice
#

now the movement is messed up for flat surfaces

heady iris
hexed pecan
# restive ice yeah my bad

Btw you can also align any direction to a surface by multiplying it withcs Quaternion.FromToRotation(Vector3.up, hit.normal) * someDirection;

hexed pecan
restive ice
#

so you should launch in the direction you rotate towards

heady iris
#

so you're shooting a ray in the player's local down direction

hexed pecan
#

Ah okay I see the capsule rotating now

heady iris
#

and you want to have the player bounce like they're on a pogo stick, so on a flat surface, they should wind up jumping in their local up direction?

#

tilting 45 degrees to the right -> jump to the right

restive ice
heady iris
#

so if the player's up vector is aligned with the ground's normal, they should bounce in the direction of the ground's normal

heady iris
hexed pecan
#

Yeah it could help here

restive ice
heady iris
#

although, actually...hmm, no that's not right. What I'm thinking of would work out to just be "bounce in the local up direction"

#

i imagined finding the rotation from the player's up vector to the ground's normal, and then applying that rotation to the player's up direction

hexed pecan
heady iris
#

wait, that's not even the wrong thing I imagined it to be๐Ÿ˜ตโ€๐Ÿ’ซ

restive ice
restive ice
heady iris
restive ice
heady iris
#

if the pogo stick had perfect grip, you'd just bounce straight up, really

#

it engages with the ground and holds still as the spring compresses and releases

#

I'd expect to deflect off at an angle if I was just a superball or something

swift falcon
#

Hi guys all right? someone speaks Portuguese?

restive ice
#

like if I come in at green here id expect to bounce off in the red direction

heady iris
#

maybe you could add a small amount of deflection if your up vector is far away from the normal vector

heady iris
hexed pecan
heady iris
restive ice
#

yeah I guess the physics are just kinda confusing here

heady iris
#

actually, that might give you the behavior you're expecting

hexed pecan
heady iris
#

make the player tilt towards the normal (or just fall over, really)

restive ice
restive ice
heady iris
#

imagine if the pogo stick had a big spike on the end

#

so that it would refuse to tilt

#

then it'd definitely jump straight back up, no matter the slope

restive ice
restive ice
heady iris
#

so yeah, I think you just need transform.up, plus something that makes you tilt over

#

you should have to actively work to keep yourself standing straight up on a slope

restive ice
hexed pecan
#

Or cs FromToRotation(Vector3.up, transform.up) Might be what you want ๐Ÿค”
Sorry my brain's a bit fried atm

restive ice
glossy basin
#

Hello there, I need an optimization tip here

#

Is there any other way to return my data from my native array that does not involve using a for loop?

#

ToArray is not an option as it creates garbage that eventually stutter my game after some frames

restive ice
glossy basin
#

Using a for does not create garbage but slows my game down by a couple ms

restive ice
#

it still works on flat surfaces too :)

heady iris
#

that looks pretty nice!

simple egret
heady iris
#

i wonder if you can do anything faster with unsafe code

#

if the data can just be blitted between the two arrays

#

basically just slamming the memcpy button

simple egret
#

Array.Copy uses low level copy internally

glossy basin
heady iris
#

this thing does typecasts and boxing, though

simple egret
#

Are those arrays not some T[]?

heady iris
#

this sounds relevant

glossy basin
simple egret
#

Oh well, yeah sometimes looking at docs works

heady iris
#

i haven't worked with native arrays in a hot minute, but i did remember doing this at some point

#

the most interesting opportunity for optimization here is that NativeArray can only contains unmanaged types

glossy basin
glossy basin
heady iris
#

unmanaged types do not need special consideration when copying them around

#

they're just dumb data

#

the constraint on T in NativeArray<T> just says it must be a struct, but you get a runtime error if any of the types that make up T (if it's a struct) are managed

simple egret
#

So it's a ref struct? Or is that not supported in Unity

heady iris
#

nah

#

although you can get refs to native array elements, I'm pretty sure

#

let me go find that one part in my code that has the Super Unsafe Code in it

#

ref UnsafeHashMap<Entity, Cost> foo = ref UnsafeUtility.ArrayElementAsRef<UnsafeHashMap<Entity, Cost>>(attackerCosts.GetUnsafePtr(), i);

#

dear god

#

so yeah, you can take refs to native array elements if you pinky-swear you won't screw up

#

oh right, ref struct is its own special thing

#

i was just thinking of taking a ref to T

#

ref struct is scary

glossy basin
simple egret
#

Yep, it's super restrictive so it can be optimized a whole lot.
Can't be put on the managed heap so: can't have members of reference types, can't implement interfaces, can't be part of a class or non ref-structs

heady iris
#

can: be a silly little guy

formal slate
#

Are rhere like any tweens that would help me animate a break animation for an object, I want a crystal to break can I like use any Dotween or LeapTween for that?, Thanks in advance

pine olive
#

Hey so I am having a really weird issue with a button enable not being called trying to scratch my head to figure it out

    private void Call()
    {
        OnPurchaseInGame?.Invoke(ShopItem, HandlePurcheseInGameComplete);
    }

    public void HandlePurcheseInGameCompleteTest()
    {
        if (int.Parse(ShopItem.PriceText) <= curency)
        {
            //do something
        }
        else
        {
            PurchaseButton.interactable = false; // not getting called

            Debug.LogError("Not enough money"); // error is getting called

        }
    }

for some reason nothing in here is being called except the error but if the IF is true then it will call it any ideas?

formal slate
#

Also the spelling of currency is wrong in code, you have written curency

pine olive
#

ya both values are correct.

formal slate
pine olive
#

ya I did that on purpose xd

#

honestly not sure why oh lol it's bc of the video I watched they did it that way which was weird prob going to change it back lol

hard estuary
pine olive
#

I will check and see

swift falcon
#

Alguรฉm fala portuguรชs?

rugged storm
# restive ice you might want to use a tilemap?

Looking into tile sets I see what you mean but tbh I like using the system I am now (tile game objects) as I don't see how switching to a tileset actually helps me do what I was trying to easier, I am already making a grid and stuff fine, I'm just wondering the best way to feed the script a set of tiles to use for each level(scene) and have then weighted to be picked properly

swift falcon
#

Alguรฉm portuguรชs?

rugged storm
#

heres my grid script again if anyone else can help https://gdl.space/ivejigahav.cs, also sidenote to make my Hiearchy less messy in run time, when I Instantiate each tile is there a way I can have it be put under some parent object?

pine olive
restive ice
#

U could add your own weight values along with for example the prefab for that tile

#

Though maybe just writing a custom editor script that shows weight fields next to each prefab slot would be a better solution

#

As u could show errors where your weights add up to more than 1

daring cove
#

Hey,

I'm running in this Unity bug:

"The editor layout could not be fully loaded, this can happen when the layout contains EditorWindows not available in this project"

This is preventing me from entering playmode not because of the Error pause rather it is freezing my whole editor in Application.Reload

I don't have any custom editor windows in my project

Any ideas?

glossy basin
hexed pecan
#

And/or resetting your layout

rugged storm
#

actually wait let me specify a little more... what is a good way to pick something from a list based on weights, I already have a tile object that I can give a weight to per tile prefab I just don't really know the way to pick something randomly from a list based on the weight of the items in that list. and also If there was a better alterative to using a list of weighted tiles or if thats a pretty good pay to set up my grid.

glossy basin
#

or just delete the library folder manually and re run the project

heady iris
#

yeah, nuke the Library and reimport

glossy basin
#

It always works , specially when the anoying bee/artifacts issue appears

hexed pecan
#

I feel like layout reset will fix the warning, and library reimport will fix the freeze itself

#

Dont think the warning is related to your freeze

heady iris
#

i've gotten some very weird problems (often involving freezes during builds) that reimport-alls fixed

daring cove
glossy basin
glossy basin
daring cove
glossy basin
#

Makes sense

hexed pecan
#

Library reimport can speed up your project's startup time a lot

#

I had a 10-20gb project, hadn't nuked the library in a while, I did it and went from 5 minutes to 30 seconds load time

#

Somethings leaking...

daring cove
hexed pecan
#

Yeah the first import will take more time

daring cove
#

But what is weird about this is that this just suddenly popped out out of no were. I was working on a big scene and added a few new assets and after that the editor couldn't enter playmode anymore.

hexed pecan
#

What are those "few new assets"?

daring cove
#

The assets didn't have any scripts attached to them. They were just 3D models 4-5K polys with mesh colliders.

#

All marked as static as well meaning it shouldn't affect the rendering time that much.

heady iris
#

I am planning out the save/load system for my soulslike game. I have a good handle on how I'm going to handle storing the player's level and stats, but I'm not sure about storing things like "which bonfires/shrines/sites of grace/whatever-you-call-it you've visited"

#

I guess I could assign a unique string key to each bonfire-equivalent

#

or maybe a GUID?

#

i would also need to be able to figure out which scene a specific bonfire is in

potent sleet
#

GUID is good option

glossy basin
#

maybe add that to a hashset so it doesnt add more than once?

heady iris
#

yeah, it'd avoid the annoying situation of "Cool Castle Bonfire" getting relocated into a ditch and having a confusing name

knotty sun
#

guid is a terrible option, it's just a long string. Now Hash of GUID might work

glossy basin
#

Im not an expert though, just sparing some ideaS

heady iris
#

well, a guid is just a hex representation of a number

#

it's a 128-bit integer

#

this would be using a proper GUID type, not just a string

hard estuary
# heady iris or maybe a GUID?

Automated GUID generation for each instance sounds fine, as long nobody will replace the instances with different ones.

potent sleet
#

yup.
In my case SerializableDictionary was my best friend

heady iris
#

it doesn't look like System.Guid is marked serializable, annoyingly

potent sleet
#

meh ToString works fine for my usecase

#

but depends on yours

heady iris
#

I might make a ScriptableObject and call it BonfireSpec

it would contain the name of the location (as a localized string) and then a GUID to identify it

#

then it wouldn't matter if I deleted the actual bonfire prefab and put it back later

#

i'd just slap the SO back on

#

that does open the door to accidentally using it twice

hard estuary
#

Reducing the save file size is definitely encouraged if you're storing all saves on server, autosaves create a lag spike or the file size is already high. Otherwise any solution seems fine.

daring cove
#

It seems like nuking the Library didn't work I've been stuck on the same Application.Reload for 7 minutes

heady iris
#

the main priority here is reliability and convenience, yeah

#

a bitfield woudl be very, very concise...and fall apart and explode very easily

#

i'll need something similar for things like one-time pickups

#

defeated bosses

#

that kind of thing

latent latch
#

I don't feel like souls games have much to save from. You've only a single resource counter, bunch of one time pickups, handful of bosses and events.

#

Elden Ring did change it up a bit, but still it followed the pattern of everything just respawned when you reloaded.

daring cove
#

I'm getting this error when resetting the window layout.

MissingReferenceException: The object of type 'DockArea' 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.

heady iris
hexed pecan
#

Break animation is also vague, is it 3D or 2D? etc

heady iris
#

each function took save version n and gave you save version n+1

#

since this was a giant blob of javascript, there were zero static types anywhere and it was miserable

#

I suppose that, if I just use Newtonsoft.JsonUtility.ToJson/FromJson, I won't really have that option

dull yarrow
#

I have 2 lists. One that have a list of a class that is related to my characters stats, and other that have a list of GameObjects that are my characters instantiated objects.
Those lists are related to my characters on my game
Imagine that i change a item of that character, his stats will change too. Is normal that i need to then apply the changes on both lists?

heady iris
#

Sure, as long as the "stats" list stores the calculated stats

#

(which it probably does)

dull yarrow
#

Yes it does

heady iris
#

in that case, you need to make sure that list of stats never gets stale

#

so, any time you do something that should affect your stats, you'd better update

dull yarrow
#

One more thing, so i can proceed to apply this on my game
I have items as Scripatble objects. How should i saved them on a list? Should i apply the same concept? Creat a list o item classes and then have another list of instatiated items?

heady iris
#

well, you can just have a list of scriptable objects, directly

gray mural
#

does anybody know why is UnityEngine.Random(float min, float max) so not random?

heady iris
#

in my game, the player inventory is a list of InventoryItems. Each one stores a scriptable object that stores the definition of the item, and can also have some extra data (e.g. upgrades you've applied)

heady iris
#

what problem are you having?

gray mural
#

my enemies are spawning quite not random

heady iris
#

randomness doesn't always look like the platonic ideal of randomness

leaden ice
heady iris
leaden ice
#

UnityEngine.Random(float min, float max) doesn't exist btw, so I'm assuming you mean Random.Range

heady iris
#

this is a uniformly random distributed set of points

gray mural
#

UnityEngine.Random.Range(float min, float max)

leaden ice
#

and the results you're getting

gray mural
#
private Vector3 GetSpawnPosition(bool spawnPlayer = false)
{
    Vector3 currentPos;

    while (true)
    {
        currentPos = new Vector3 (TupleRange(spawnPos.x), spawnPos.y, TupleRange(spawnPos.z));

        GameObject enemy = enemyPrefab;

        enemy.transform.position = currentPos;

        Bounds bounds = enemy.GetComponent<MeshRenderer>().bounds;

        Vector3 topLeft = new (bounds.min.x, bounds.min.y, bounds.max.z);
        Vector3 topRight = new (bounds.max.x, bounds.min.y, bounds.max.z);
        Vector3 bottomLeft = new (bounds.min.x, bounds.min.y, bounds.min.z);
        Vector3 bottomRight = new (bounds.max.x, bounds.min.y, bounds.min.z);

        if (OnIsland(topLeft) && OnIsland(topRight) && OnIsland(bottomLeft) && OnIsland(bottomRight))
        {
            if (!spawnPlayer)
            {
                if (Vector3.Distance(playerDocument.transform.GetChild(0).transform.position, enemy.transform.position) <= minEnemyDistance)
                    continue;
            }
            break;
        }
    }
    return currentPos;

    bool OnIsland(Vector3 position) => Physics.Raycast(position, Vector3.down, 2f, LayerMask.GetMask("Island"));
}
#
private float TupleRange((float min, float max) tuple) => Random.Range(tuple.min, tuple.max);
leaden ice
leaden ice
#

oh

heady iris
#

they're passing a tuple of min, max in

#

this looks reasonable

leaden ice
#

ok im just blind lol

heady iris
#

only the first few lines are relevant; most of this is just logic for trying again if the position is too close to the player

#

which could cause problems, I guess

leaden ice
#

The question is:
TupleRange(spawnPos.x) what is the value of spawnPos.x and z here?

#

Debug.Log

#

also yeah the try again logic could also potentially be an issue

gray mural
heady iris
#

show us the distribution of enemies

daring cove
#

I have a problem with Navmesh.

I have scene that is 8 km2 that has far better performance than a scene that is 2 km2.

The scene that is 2 km2 does not even start because of how big navmesh is.

Any ideas on why the 8 km2 scene doesn't have the same issue?

heady iris
daring cove
leaden ice
heady iris
leaden ice
#

I think you really need to add a bunch of log statements here

heady iris
#

(this is likely)

#

you could have a ton of agents wandering around the smaller map

#

or maybe the smaller map has way more details that makes the mesh much more complex

gray mural
heady iris
#

show us a screenshot

leaden ice
daring cove
heady iris
#

a qualitative "they're too close together" description could very well just be randomness

#

is the problem that enemies randomly appear very close to each other?

warm stratus
#

Hey, when the Time.timescale is 0, does the Invoke stops and the coroutine with yield return new WaitForSeconds(time); too?

#

freeze*

heady iris
#

WaitForSeconds uses scaled time

#

so that will sit around forever, yes

#

there's a realtime/unscaled (i forget the name) version

warm stratus
#

and Invoke too i think

#

Time.time maybe

#

the unscaled

gray mural
heady iris
#

just take a screenshot

#

top-down view, so we can see all the enemies

heady iris
leaden ice
#

and see what Random.Range is giving you

#

that might be even more productive

gray mural
#

@leaden ice @heady iris
That sounds quite strange, but enemies were spawning very closely to each other, but when I have written about this issue, they started spawning normaly

heady iris
#

let me put it this way: every message you send that isn't a screenshot of the distribution of enemies you're getting is non-useful right now

#

it's random

#

sometimes it goes one way, sometimes it goes another

warm stratus
#

and is there a way to scale the audioSource with Time.timescale?

heady iris
heady iris
gray mural
warm stratus
#

ok the pitch is the time that is played the sound?

heady iris
#

it's random.

heady iris
gray mural
#

what a strange random though ๐Ÿซฅ

heady iris
#

randomness does not always "feel" random

#

because we're really prone to finding patterns

warm stratus
heady iris
#

an interesting read

gray mural
heady iris
#

indeed

#

i read it during a game jam, when i was going full-tilt to make a game in 48 hours

#

:p

gray mural
heady iris
#

nah, i got a finished product but it turned out i spent all of my time on procedural generation instead of making the game fun

#

i did have a really cool level generator

gray mural
#

do you guys even publish your games somewhere?

heady iris
#

if you want to reduce the "clumpiness", you can check that no two enemies are too close together

sage latch
heady iris
#

this will have a quadratic cost as the number of enemies goes up

gray mural
heady iris
#

then your random positions will sometimes look a little clumpy

hexed pecan
#

Didnt read the full conversation, but may I suggest Poisson Disk Sampling

#

If you want somewhat evenly spaced points

heady iris
#

indeed

#

i brought it up at some point in there

dull yarrow
#

Around*

heady iris
gray mural
#

I have to add much more logic, because the enemies are spawned according to the wave. 1 enemy, then 2, then 3 and so on. If the wave is too high, it would be impossible to spawn the enemy, which leads you to really nice never ending while loop

heady iris
heady iris
dull yarrow
heady iris
#

oh yeah, I see what you mean

#

well, you can create game objects that are associated with the inventory items

gray mural
heady iris
#

let me find the one I liked

hexed pecan
#

Same.

gray mural
hexed pecan
heady iris
warm stratus
#
AudioSource[] audioSources = FindObjectsOfType<AudioSource>();
        foreach (AudioSource audioSource in audioSources)
        {
            audioSource.pitch = Time.timeScale;
        }

thats really bad for fps each frame or that s ok?

hexed pecan
heady iris
heady iris
#

it'll have to scan the entire scene, and it might affect sources you don't want to rescale

warm stratus
hexed pecan
heady iris
#

I would create a component -- AudioTimescale or something -- that controls one source

gray mural
hexed pecan
gray mural
#

I have just said that it is quite interesting to do this random by my own

hexed pecan
#

I get that

dull yarrow
lament bloom
#

I'm trying to design my player input so that

  1. moving the mouse around moves the camera as well as the direction the player is facing while moving forward
  2. moving from side to side (A and D or left and right arrow) while stationary should cause the player to move left or right as determined by the camera
#

however as pictured there are some issues when i try to move from side to side

#

my code is a little messy but the line determining player velocity per update is

 velocity = playerCamera.forward * forwardInput * currentSpeed + Vector3.up * velocityY + playerCamera.right * horizontalInput * 1;

where horizontalInput is just Input.GetAxis("Horizontal")

#

does anyone know what i might be doing wrong here? please lemme know if there's more info i can provide that would be valuable

leaden ice
lament bloom
#

i have a character controller component on which I call characterController.Move(velocity * Time.deltaTime)

leaden ice
#

seems like you might have multiple cameras or something?

lament bloom
#

oh you're right

#

hmm

leaden ice
#

Make sure playerCamera is assigned properly