#💻┃code-beginner
1 messages · Page 328 of 1
bump again
hi folks
My goal is for the child to spawn randomly but it always spawns at 0,0,0 the response of the script is below 👇
here i have an object that spawns enemies ,it works perfectly fine and a player attack that destroys the enemy if i hit x and he is in some radius that i choose
the issue is that if i kill one enemy ,other one are spowning and following me but i cant see them in game,they chase me but cant damage also
what can be the sollution?
This is where you get the spawn position for you child.
Vector3 randomChildSpawnPoint = spawnPoints[Random.Range(0, spawnPoints.Length)];
It will always spawn at one of the spawnPoints' Vector3s
The issue is thus in your array.
None of them are 0,0,0, that's why it's weird
Your image shows (0.00, 0.01, 2.00) though
Well, yeah, so it's the 3rd element
Yes, the logs show that it spawned at a random spawn, but it's always only at 0,0,0
ok so i found out that this bug happens only of i kill the main one
What is that?
GameObject childObject = Instantiate(loadedPrefab, randomChildSpawnPoint, Quaternion.identity);
// reset the childObject's position
childObject.transform.parent = playerInstance.transform;
i can just place him outside of the map
Never mind, I solved it, I randomly spawned him after he spawned
What does it mean? You reset the childObject's position.
No, i used it
childObject.transform.position += randomPlayerSpawnPoint;
What is cameraHolder? Is that the thing that jumps?
Do you have a video of the issue?
If the object "jumps" then I get the idea you are bobbing the wrong thing
hey guys, I'm super new to unity and i've just completed this tutorial https://www.kodeco.com/980-introduction-to-unity-scripting/page/5 now i'm trying to create a death/win message but getting this error can anyone help me identify what the issue is?
can you show the code on line 62 of that script?
within the parentheses are the line number then the column . . .
check the tutorial again to see what they wrote for that line . . .
you should see a difference . . .
use string not capitalized
Change String to string
String is namespace'd
And a bad way to write strings
For beginners at least
ahh, they were so close to finding it . . .
wow, that's a horrible tutorial . . .
it's actually an application task for a higher education lol
Yes, 90% of online tutorials are from pretend programmers sadly
can't believe they actually wrote that . . .
Ah, higher education consists of 100% pretend programmers in that case
hopefully they fixed it during the remainder of the tutorial . . .
You're better off following an actual C# tutorial
This won't change the position. https://docs.unity3d.com/ScriptReference/Transform-parent.html
But anyways, u could get rid of that line, and pass the parent as 4th parameter @rich egret when instatiating
thanks again that fixed it 
yes, watch a beginner C# tutorial first . . .
I will! But I of course delayed the application until the last day so i'm rushing through it 
Damn, I have no idea how I've read it as
childObject.transform.position = playerInstance.transform.position;
I need a break.
Can anyone help me? Im trying to install unity but it keeps validating
how can i make the apples array show in the inspector? https://sourceb.in/hQCtvC1RMD
[System.Serializable] ((I think))
Interfaces can't be serialized
My bad, I missed that lol.
This is a coding channel
Mb
hi my problem is the next i make a "game of life" and have a panel with a button start for laucnh my game but when i click on my button that click on my game object behind the panel
it's the thing that holds the camera and moves up and down and here's the video of what's happening, the bobbing works, but it makes the object jump left right or up and down, etc
and the object is attached to cameraHolder, and the main camera's position is being updated to cameraHolder
!code
📃 Large Code Blocks
Use 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 format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
why is this erroring?
You cannot use ref here because .gameObject is a property that doesn't use ref returns
Not sure why you'd need ref in that method, classes are passed by reference already
because i wanna change the original object
Change how? That method only gets a component on it, it does not re-assign the variable
On the TextMeshPro component yes, not on the GameObject
bump
Again, classes are passed by reference so the font size change will have an effect without re-assigning to the original object
ah
why its not working
using System.Collections.Generic;
using UnityEngine;
public class Score : MonoBehaviour
{
public int score = 0;
private void InTriggerEnter2D(BoxCollider2D other)
{
if (other.CompareTag("Player"))
{
score++;
}
}
private void Update()
{
Debug.Log(score);
}
}
is the object a trigger?
you misspelled method name, it should be OnTriggerEnter2D
A configured code editor will highlight this method differently when it's recognized by Unity. With VS, the name will be in blue and the "Unity Message" indicator will appear above the name.
!ide
If your IDE is not autocompleting code
or underlining errors, please configure it.
Select one:
• Visual Studio (Installed via Unity Hub)
• Visual Studio (Installed manually)
• VS Code
• JetBrains Rider
• Other/None
Do that if you haven't yet
The method is called OnTriggerEnter2D and it has another parameter
now its working
Thanks
bump
void HandleBobbing() {
if (!canMove) return;
if (Mathf.Abs(_rb.velocity.x) > 0.1f || Mathf.Abs(_rb.velocity.z) > 0.1f) {
_bobTimer += Time.deltaTime * (isSprinting ? sprintBobSpeed : walkBobSpeed);
cameraHolder.localPosition = new Vector3(
cameraHolder.localPosition.x,
_defaultCameraY + Mathf.Sin(_bobTimer) * (isSprinting ? sprintBobAmount : walkBobAmount),
cameraHolder.localPosition.z
);
}
else {
cameraHolder.localPosition = new Vector3(cameraHolder.localPosition.x, _defaultCameraY,
cameraHolder.localPosition.z);
}
}
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float Speed;
public float JumpForce;
private Rigidbody2D rig;
// Start is called before the first update
void Start()
{
rig = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
Move();
}
void Move()
{
Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
transform.position += movement * Time.deltaTime * Speed;
}
void Jump()
{ if (Input.GetKeyDown("Space"))
{
rig.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse);
}
}
}
why i cant jump?
Call Jump() in Update like you do for Move()
increase your jump force
its 10
It won't work because you move the transform in void Move(). This conflicts with moving using a Rigidbody
Use the Rigidbody in both
What?
about the error that appeared
Yes if you have an error you should post it here
Yep it's correct, there is no key on your keyboard labeled as "Jump"
Why didn't you keep "Space" like you had before?
bump of a bump
let me try
it worked
tyms guys
hi how can i make for that dont change the color of my square when my mouse are on the pannnel https://cdn.discordapp.com/attachments/1149752436681080952/1235210083135389706/20240501_144306.mp4?ex=66338a88&is=66323908&hm=0ad2b3caec45fbe698ece5ce2d4366edb6894f44926ea3fbe205e76304b422f8&
but when i spam space i can infinite jump
add on collision enter 2d method, check if collider is layer "ground" (which u must create) and if it is, set private bool _grounded variable to true and on collision end do the same but set _grounded to false, and check if _grounded == true in jump method
ok
what is a good way of making your own ui elemants
This isn't a coding question. Open an art program, make the UI elements, export and put them into Unity.
thx
how can i make a rect transform be anchored to left through code? the ancoredPosition field of the RectTransform class should be a vector2
is there anywhere i can see an example of how to do it this way?
What example do you need. it's just a property you assign
myRectTransform.anchorMin = new Vector2(0, 0); for example
It's the same as setting the anchors (min and max) in the inspector:
i dont know why but i keep getting these errors and i dont understand why
whats on line 132, 90
you're trying to access a variable on those lines within that script that does not have a value assigned to them . . .
look for the reference variable on each of those lines. that variable is null (does not have a value assigned). make sure you assign those variables a value before attempting to use them . . .
they should be assigned tho
obviously, they're not, or the error would not be there . . .
is it usefull to use scriptableobjects in inventory when making a survival game?
if they were assigned then somewhere along the way, they are removed . . .
i checked and as far as i can tell i dont remove them. could you tell me what that would look like?
what would "what" look like?
like remove them
the type of game doesn't matter, but you can use SOs for your items to create an inventory system . . .
you receive the errors, so somewhere in your code the value is removed. i have no idea where as it's your code. you need to log the value of those null variables or use the debugger to see where they get removed . . .
first, you need to find out which variables are null . . .
how do i use the debugger and its the variable movement and horizontal
it's best to follow a tutorial based on which IDE you are using to set it up . . .
try this: https://unity.huh.how/debugging/debugger
Dumb question: how do I fetch the actual length of an animation clip in my project?
AnimationClip.Length & the editor tab return 1.500, but the Animation windows show 1.150 (at the final 45th frame).
From what I tried the 1.150 is the "correct" one, but I don't see how I'm supposed to get it.
AnimationClip.Length is in seconds but the animation window shows seconds:frames
how can i get cloned button child like textmeshpro or image
at 30 fps 1:15 is 1 second 15 frames (=1.5 seconds)
is this a prefab?
yea
if so, the ideal thing to do would be to make a component that references the components you need
public class MyButton : MonoBehaviour {
public TMP_Text text;
public Image img;
}
stick that on the prefab root and reference the prefab as a MyButton
now you can do...
MyButton instance = Instantiate(buttonPrefab);
instance.text.text = "Hello";
The less nice alternative is to just use GetComponentInChildren to grab a TMP_Text from the newly created instance.
This can cause problems if you later decide to add more text components.
Wow. That's a damn weird notation then.
Guess I will just need to manually adjust the animation's end, and 1.15 was just coincidentally correct.
Thanks.
I spent an hour or two figuring out a bug where I got the wrong component with GetComponentInChildren after adding an extra renderer to something
thanks
you can easily add functionality to the component later, too
you generally don't. Just make a script that has a public void Setup(string text, Sprite image) {} function on the prefab root and call that function
public class InputActionIconPart : MonoBehaviour
{
[SerializeField] TMP_Text label;
[SerializeField] Image image;
[SerializeField] Image fillImage;
// actual logic down here
}
This used to just be a bunch of public fields
Then I rewrote it so that the fields are private and you interact with it through methods
hi, is anyone familliar with the game "crisis response"? im trying to do a reskin on it like other mods but i dont know how
this isn't a modding server
im stuck on this part of the code which is making a player teleported through a trigger which when player get hit by this hitbox it would teleport but it would just teleport however i wanted some to be a trap teleporter that just move the player back a couple x axis away from the teleporter
public class Player : MonoBehaviour
{
Rigidbody rb;
float speed = 10f;
public Transform PlayerPos;
void Start()
{
rb = GetComponent<Rigidbody>();
Vector3 Teleported = new Vector3(10, 0, 0);
}
void Update()
{
Vector3 movement = new Vector3(speed, rb.velocity.y, 0);
rb.velocity = movement;
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Teleporters")
{
transform.position = PlayerPos.position -- Teleported.position;
}
}
}
i forgot to remove the -- to -
use .CompareTag("Teleporters") instead of .tag ==
You declared the Teleported variable in Start(). That means it's only usable in Start
wherever you declare a variable, it's only usable within that scope
(a scope is basically anything confined by a { } )
also you wouldnt access it by Teleported.position but instead just Teleported since its already a Vector3
why.compare tag?
it's more efficient
wdym?
can you explain the different
actually its just
changing == into .compare
check Best Practices from the pins . . .
because gameObject.tag creates and allocates memory for a brand spanking new managed C# string object, which needs to be garbage collected.
CompareTag does the comparison on the native side, and doesn't allocate any managed memory.
While that conversation is going on, is there a list/guide or some documentation on what allocates managed memory etc? I've been thinking about the garbage collection side of stuff more recently (as anything I make has a tendency to 'stutter' every few seconds due to the garbarge collection lol.)
Creating new instances of any class in C#
Aah okay, interesting.
hey! so I'm trying to create a vector3 direction which points towards a gameObject called target. How can I do that?
rotationPoint = Vector3.RotateTowards(transform.rotation.eulerAngles, target.position, speed, 0f);
I have this but it just rotates it in an undesired direction
im using charger game lesson they are really just pretty straight forward
I used Quaternion.LookRotation before, which worked, but I want to use a vector3 now
Vector3 direction = toPosition - fromPosition;```
You need to create a new direction variable and assign a direction Vector3 to it
BTW in order to use LookRotation you will have needed to calculate the direction vector already
since the direction vector is the first parameter to LookRotation
wow im so stupid
thank you!
yeah I had this inside of my Quaternion.LookRotation
that's not what i meant. the pinned messages provides info under Best Practices for do's and dont's. CompareTag vs == is one of them . . .
Vector3.RotateTowards(transform.rotation.eulerAngles, target.position for reference - you tried to mix an euler angle V3 with a position V3 which predictably gave you nonsense
but I tried doing some silly shit like Vector3.RotateTowards(transform.rotation.eulerAngles, target.position - transform.position......
oh sorry
also, is there a way to make it so it doesn't have verticality?
Vector3.RotateTowrads expects two direction vectors. You gave it an euler angle vector and a position vector. Neither of them are direction vectors
set the y to 0
yeahhh
direction.y = 0;
More generally, you can use ProjectOnPlane. But effectively for projecting on the x/z plane, you just set the y to 0
no idea what rotationPoint is
dont need to construct a new vector for that
rotationPoint = target.position - transform.position;
If it's a direction vector it probably shouldn't be named "point"
point implies that it's a position
at least in my head
true
Also you may or may not want to normalize this direction vector, depending on how it's being used later.
ill just rename it to targetDirection
i normalized it when i used it in a quaternion
but idk what it does exactly
for LookRotation you don't need to normalize it
but if you're using it to set a velocity or something, you would want to normalize it
i am in a different script
oh WAIT
yeaaa I get it
I was about to say that some projectiles sped up extremely fast
when i only changed the direction of it, not the speed
but that was probably because of not normalizing
Why when I clone the object the movement script doesn't work in Unity?
no idea what you mean
"the movement script"?
I didn't know there was only one!
public class Player : MonoBehaviour
{
Rigidbody rb;
float speed = 10f;
public Transform PlayerPos;
void Start()
{
rb = GetComponent<Rigidbody>();
Vector3 Teleported = new Vector3(10, 0, 0);
}
void Update()
{
Vector3 movement = new Vector3(speed, rb.velocity.y, 0);
rb.velocity = movement;
}
private void OnCollisionEnter(Collision collision)
{
if (collision.CompareTag("Teleporter"))
{
transform.position = PlayerPos.position -- Teleported.position;
}
}
this is the revised is it better?
It means a basic movement script
You're going to need to be more specific about "doesn't work". We can't see your screen so we can't know what your issue is
You would probably want to share said basic movement script with us, otherwise we can't help.
!code
📃 Large Code Blocks
Use 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 format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
also explain if you have any errors in console when running the game etc
And explain what "doesn't work" means
btw is there a way to create a graph in a script?
This is the script
https://gdl.space/uhijafufek.cs
is it better?
basically something like this?
For some reason, it won't let me move when I start a scene. The script is inside a cloned object.
I think it has to do with the ground
Should set velocity for rigidbody in FixedUpdate not Update
Quick question , how can I take a GameObject from another scene , that GameObject is my save and load system and I wanna get I from the scene it is and reference it in my main menu manager so I can load some data that I need to be loaded when I press my continue button , how can I get that SaveAndLoadingSystem gameobject that has a script on it and I wanna get that script so I can access a method I need.
okay
what about compare tag?
because its still error
Are you getting any errors in the console
what is the error
Nope
It probably doesn't recognize the ground.
But when I put the object itself without cloning, it works great.
I have an enemy prefab that contains scripts that control all my enemies. I want to create enemies that look different, so they use different sprites and animations, but I've just realized I don't know how to do that since they all share the same scripts?
For example, when the enemy runs, it plays a specific animation, but if another enemy which looks different runs, how could I get it to play a different animation, despite them using the same scripts?
how d i do this then
Collisions don't have CompareTag. Objects you collide wtih do
#💻┃code-beginner message
again read this doc
#💻┃code-beginner message
This is an option: https://docs.unity3d.com/Manual/AnimatorOverrideController.html
What makes you think that? Have you done any logging or debugging to find out what's not running when it should?
Okay, I'll give it a go. Thanks
It doesnt have the compare tag
Indeed yes, the script is full of logs.
And I'm sure it's related to the ground because the camera movement and animation work so that means the script is "live"
So, what makes you think it's the ground? Have your logs shown you that you're not detecting ground when you expect to?
does anyone know?
Do you know what other options I'd have? Just curious
So i just put compare tag on to the object that get collided with
ok. n did you read the rest of what I said at all..
You call CompareTag on an object. Not the Collision. You've been given the answer as to what to do to get the object already
Because the character can only move when it is on the ground and there is no gravity
How about instead of guessing you just put logs in and see
🥱
See if it's grounded, and if not, see why it's not
I have already entered logs... this is the ground
Okay, what did you log, where, and what did it say?
foreach(ProjectileVelocityChange changes in velocityChanges)
{
if(lifeTimeCT - lifeTime <= changes.startAfterSeconds) SetVelocity(changes.newVelocity);
}```
does anyone know why SetVelocity never gets called?
lifeTimeCT is 5
lifeTime is 5 too and decreasing per second
startAfterSeconds is 2
newVelocity is 0
and yes I have elements in the changes array
IsGrounded: True
But the character is literally waving in the air
Okay, so it looks like it's grounded
@polar acorn
Then find out what it's detecting as ground
Look for where you set IsGrounded to true and see what could be causing it to do that
is it possible to change this layer while playing with script like player does smth to chnage it
Sorry, my mistake, it's the if (view.IsMine), do you understand Photon by any chance?
which layer?
ty
the terrain layer
which I used to create the ground basically I want to uopdate the ground texture
looked at the example in there and it seems like how they do it is to have both scenes have a Menu gameobject and i dont want my game to have a MainMenuManager gameobject and only the main menu scene to have it
Then you'll need to have both objects reference a different thing that does persist between scenes
When a scene isn't loaded, nothing in it exists at all
I think its TerrainPaintUtility
why is this a thing and how can I work around it?
So in order to reference anything from another scene it needs to be put somewhere that does exist all the time. Either a DDOL, or a file on the hard drive, etc.
can u ellaborate a lil pleas like what do I write in script
Because ProjectileVelocityChange is likely a struct, meaning you can't modify it, you'd be creating a new one entirely. It's not passed by reference, it's passed by value, so changing a property on it like this wouldn't accomplish anything
have you looked into it ? its not like one piece of code, its a whole process through the API
eg
here is a thread on something similiar
https://forum.unity.com/threads/terrain-layers-api-can-you-tell-me-the-starting-point.606019/
so something like , have a LoadManager Gameobject in both scenes and then reference that object in both MainMenuManager and SaveAndLoadingSystem scripts? then use DontDestroyOnLoad(this.gameObject) in Awake method in my SaveAndLoadingSystem?
i see. I guess I can keep the index of the element stored somewhere and check in every iteration if I'm on that index, and if I am, skip it?
If you need data to persist across scenes, put it on an object that is marked as a DDOL. I don't know what you're trying to use that data for, so you'll need to figure out what goes on it or not
and again, isnt there a way to create a graph?
like how theres velocity over lifetime in unity's particle system?
and u can set a graph there?
If your intention is changing what ProjectileVelocityChanges are in the velocityChanges list, you'll need to loop with an index, and then after making your changes, you'd have to set velocityChanges[i] = changes to store it back in
im jsut trying to load the saved player data when i press a button in the main menu scene
so changing ground is a long process ?>??? I simply wanted the grass to turn green and sky to blue after play turn off all air pollution sources
doing this at runtime is a process yes
its not trivial
there is no way to shortcut your way through these problems sometimes
AnimationCurve?
yup its basically that and custom inspector
but how can I use it exactly?
shit thanks
ill try to use this somehow
idk how
like I want the time variable to be controlled by something else
thats totally fine
same proceess to change sky as well? right?
basically what I want is like
at second 0 have the velocity be 10
at second 3 have it be at 0
at second 4 have it be at 10 again
but idk how to do it
and the curve editor is kinda bad
the sky would be a material
you need 3 points
yea i did that thats not the issue
you need evaluate time
Call Evaluate(n) to get a curve's Y value
but how can I use the values
oh?
hold up
so I can have SetVelocity(curve.Evaluate(lifeTimeCT - lifetime))?
So i coded smt small and i get this error
error CS8773: Feature 'parameterless struct constructors' is not available in C# 9.0. Please use language version 10.0 or greater.
How could i change the language version? or does smb have a alternative to this ```C#
struct EnemyData {
public EnemyData() {
EnemyPosition = position;
NodeIndex = nodeidex;
Health = hp;
}
public Vector3 EnemyPosition;
public int NodeIndex;
public float Health;
}
what-
idk what those values are, try it andsee
You can't change the language version. You need to actually give the constructor parameters
the problem is the constructor
EnemyData(Vector3 a, int b, float c)
Given that position, nodeindex and hp don't exist in the context, you want to add these to the constructor's parameters
ah alright ty, il try some stuff
yall i just started, how do i attach the camera to a model?
they need drag n drop
also not code related
where i ask then
That is just how you declare a constructor. [access mods] <Class Name>().
oki
ohh weird, never did that before
Unity dev moment
yea i never really used C# outside of unity
i know it has uses in creating databases
If you're just starting out then it'd be best if you went through !learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
You can create console apps, cross-platform apps with UI, entire websites, web APIs, etc. And yes there are handy packages to interface code with databases (ORMs - object relational mappers)
okay so i did add the DontDestroyOnLoad on the SaveAndLoadingSystem Awake ethod , but for some reason when i start the game and then press continue so it loads the data i need , it duplicates the SaveAndLoadingSystem but with empty references n everything but the real SaveAndLoadingSystem with the references there is there but why does it duplicate another SaveAndLoadingSystem gameobject ?
Ty I fixed it
Whenever you load a scene, it will spawn every object in that scene. DDOL moves the object to a separate persistent scene. So you load that scene again, there's still a SaveAndLoadingSystem object in that scene so it spawns. You'll need to have any extra copies of the object self-terminate if there's already one that exists.
https://gamedevbeginner.com/singletons-in-unity-the-right-way/
i mean i did this to check if theres more than 1 SaveAndLoadingSystem gameobject , if there is then Destroy it
Why are you destroying this object if there's less than one in existence? How can there ever be less than one, when this object is itself one of them?
OH SHIT I DIDNT REALIZE IT WAS LESS THAN
It's a little weird but that would work. The object would get moved to the DDOL scene, then destroy at end of frame
it was on DontDestroyOnLoad unity docs
Probably better inside an else though
hmm i cahnged the less than to more than but it deletes the SaveAndLoadingSystem gameobject with the references and not the one that has empty references
why cant I color this one building
So maybe you should consider a proper singleton pattern instead like I linked
Give it a material instead of using default. Also not a code question.
oh damn , so change this intoa singleton (this is in the MainMenuManager script which is on the same name gameobject in the MainMenuScene scene)
or change the references into Singletons?
The DDOL object should be a singleton that things that need to access data on it can use
so i did this in the SaveAndLoadingSystem script(left ss) and then used the singleton like that in the MainMenuManager script (right ss) , i hope i did it good lol
also did this in MainMenuManager cuz it kept saying that object is not referenced or smth
You will never need to use Find to get a singleton
You'll want to put the singleton in every scene
my character is suppose to walk is there a solution?
so it always loads no matter where you start
not a code question
can anyone send me a player movement c+code plz
😦
!learn
:teacher: Unity Learn ↗
Over 750 hours of free live and on-demand learning content for all levels of experience!
they sometimes dont work
wdym in every scene? if u dont mind me asking
I mean every scene
then u did something wrong
what does that even mean? sounds like you just haven't set it up correct
I do everything but everytime I add a rigidbody my capsule just starts rolling around rather than walking
thats because it needs to be locked
just use the premade controller i sent
I want to make the camera follow the player but slightly pan depending on where the cursor is. Does anyone know how I can do this?
Is this something that would have to be done with code or can be done with Cinemachines settings?
not sure if i understood it correctly, so i put the SaveAndLoadingSystem gameobject where the same name script is that has the singleton in MainMenuScene scene as well?
oh well I didnt know that
is this for mobile ?
huh ? works for whatever platform
Movement isn't for mobile or desktop or anything else
I mean will there be those buttons when I upload it to my scene
The only difference is gonna be input
I know that I m just bad with assets and stuff since I dont know how to change it
I m trying to make a horror game and some youtube videos are helpfull but I always doing something wrong so I might need to use assets for it thats why I joined discord so I could ask people about good or best assest
yes it comes with on screen mobile buttons
is there a one without on screen mobile buttons ? for pc
why?
just disable them,its no big deal
well I dont know much about unity thats why I asked its my first week on it
I mon second lesson on unity learn
if ur doing unity learn why are you already trying to make character controllers ?
you should not be starting with such complexities
I know I wanna save some script so when I get to that part on learn I could just ctrl v it
is even movement that complex on unity ?
that makes no sense, ur going to paste something you don't understand ofc its not gonna work
it is for a beginner when you don't know half the components and c#
well I coulndt find anyone on youtube explaining to a child like a explanatory
how old even are you
forget youtube, do the Learn paths from unity
those were fun ngl
thats my goal cause people are too bad at teaching stuff on youtube
what?!?!?
kinda boring for the first lessons actually hope it gets better
its a learning course
Boring? Is it, perhaps, too easy for you?
well some sure but its better to learn from structured courses
Unity learn is structured to ease you into it
nahh its just boring it just tought me how to open a opengl project and stuff
I got that it is a good feature to
learn the editor first, then code part
this way you know where to go and what to click
does he know c# atleast
I dont know I m doing whatever it tells me to do
which lesson are you doing ?
But you "first listen, then do", right?
you should start with the Essentials path
had some class on school when I was 17 about web devolobement on c+
cant rememeber much to
web devolobement on c+ ?
I read everything it now wants me to move the cube around thats the last lesson I m on
what is C+ ?
web design is its english ?
never heard of it
oh
I dont remember much
then you mind as well start fresh
and as much as I got it is quite different then what we are tought
Do you even remember some data types?
why my add listener doesn't work bruhhhh
private void LoadPosts() {
foreach (WikiPost post in WikiPosts) {
if (post.Day > day) continue;
GameObject button = Instantiate(buttonPrefab, postsContent.transform);
PostButton buttonScript = button.GetComponent<PostButton>();
if (!buttonScript) continue;
buttonScript.title.text = post.PostTitle;
buttonScript.profilePicture.sprite = Sprite.Create(post.PostCreator.ProfilePicture,
new Rect(0, 0, post.Photo.width, post.Photo.height), new Vector2(0.5f, 0.5f), 100f);
button.GetComponent<Button>().onClick.RemoveAllListeners();
button.GetComponent<Button>().onClick.AddListener(() => {Debug.Log("gowanowndoawdio");});
}
}
the way it works changes I guess we tought for making a web page not moveble objects and games
define "doesn't work"?
name me some and I will try to remember 😄
uh debug the function make sure it runs first
i click and it doesnt print my message
string, float, bool
is the button reacting to the mouse at all?
it does i checked
Changing tint etc?
nahh we had some different stuff
yea
how the language works its exactly the same
Then you haven't learned C#.
The types do not change
Go learn it first.
as much as I remember it told to us it was c#
i do web dev all the time in c# the same exact types are used
And pretty much every language has those
what comes before c# on web dev
it could've been java, java is very simmilar to c#
might be java
But it has the same data types.
what is the one called with <html>
java still has same types
html.
html
what comes after that one on advance
css? javascript?
css
css and js
dangit
if you want to dev in unity yes
bump, the function works and the button color reacts
I just wanna make a horror game doesnt matter if its made with free assest or codes
is it possble for me to make one while learning c#
I will be using assests
its not gonna happen over night
like enemy ai fps controller and stuff
you'll need to learn it eventually
it will probably take a few months
or more
depends how you learn, and how motivated u are to learn
i've learnt cs in like a month but i knew java before
I mean rather than waiting to make the game while learning c# I wanna make one with assest then I can make it complete version with codes later this way I can test myself and see if I m proceeding
learning cs never stops, doubt you learned all the cs
Gonna still neee to know c# to do that
Just do learn.unity pathways
If you find it boring, so what, just do it
nah, didn't learnt all of it, like i think the point where im at rn is decent, but def not all of it
your first few projects are not gonna be ur "Dream Game"
its gonna be crap
I m doing it also I search on google or youtube but people are either skipping some parts guessing you know what they do or using their old scripts to fasten thing wich teaches nothing
until you get better with time
I know I use blender brother 😄
Yes. Do learn. Don't do youtube
first ever character had 3 legs I dont even know how I managed it
no I mean code wise, its gonna be buggy etc.
its normal
yeah I know about all that I m ready for that actually I ve been trying few codes and I enjoy finding code mistakes and bugs to fix them
its like hide and seek
put a breakpoint in the AddListenr section
but inevitable :d
well yeah thats pretty much coding 80% of the time ur just chasing bugs
still not sure if i understtod it correctly
any suggestions on how to learn c# rather than unity learn I wil keep going with it but reading is not my thing sometimes so
any youtubers or webpages ?
huh, it doesn't seem to execute a breakpoint
Reading is gonna be the absolute best way
https://www.w3schools.com/cs/index.php
Tutorialspoint
Microsoft has a guide, ah nav just shared it
are you using the debugger properly?
You are gonna have to read most solutions, so you should get used to it now
@summer shard if so and ur not hitting breakpoint then no wonder its not subscribing
or at least i don't know how to recognize executed breakpoint and not executed one
idk
thats not cause I dont like it it cause of my eyes the more I read the more words scramble on my eyes eventually either I have to stop reading or change the background and font color
ok and did u run Attach Unity
if the breakpoint hits, you will see the Hammer icon
Unity would stop executing
it did hit
but it didn't hit the debug
after i clicked
are u sure logs aren't collapsed
they arent
and thats the correct button?
yup
what makes you sure?
it shows up in the game, and there's no other variables called "button" in this script
wait i think it doesn't work
it should change the title text but it's still _desc
sooo, it does print the "load" and "change title" logs but doesn't change them?
foreach (WikiPost post in WikiPosts) {
if (post.Day > day) continue;
GameObject button = Instantiate(buttonPrefab, postsContent.transform);
PostButton buttonScript = button.GetComponent<PostButton>();
Debug.Log("load");
if (!buttonScript) continue;
Debug.Log("change title");
buttonScript.title.text = post.PostTitle;
buttonScript.profilePicture.sprite = Sprite.Create(post.PostCreator.ProfilePicture,
new Rect(0, 0, post.Photo.width, post.Photo.height), new Vector2(0.5f, 0.5f), 100f);
button.GetComponent<Button>().onClick.RemoveAllListeners();
button.GetComponent<Button>().onClick.AddListener(() => {Debug.Log("gowanowndoawdio");});
}
can u show inspector for buttonPrefab
is there no way to edit AnimationCurves using some file or smth?
like this is obnoxious to work with
sometimes is easier to right click and Edit values that way to get more granular control
thats what I do yea
but yeah not the best curve window out there
but its impossible to see the curves
idk how to make it look better
like i cant zoom in only vertically
wdym zoom only vertically
It's very faint but both horizontal and vertical scrollbars have special areas at their extremities you can drag to zoom in
you know , technically you already have a script there you can link the button directly in that script
PostButton can just have field for Button and subscribe it there
yea but the argument is not monobehaviour and has to be stored in a script which is game manager
idk what that means
like wikipost is the argument to open post, and this is it's class
public class WikiPost {
public string PostTitle;
public string PostDescription;
public WikiUser PostCreator;
public Texture2D Photo;
public WikiComment[] PostComments;
public int Day;
public WikiPost(string title, string description, WikiUser postCreator, Texture2D postPhoto, [CanBeNull] WikiComment[] comments, int day) {
this.PostTitle = title;
this.PostDescription = description;
this.PostCreator = postCreator;
this.Photo = postPhoto;
this.PostComments = comments;
this.Day = day;
}
}
not sure this has to do with what I said earlier lol
doesnt really explain what ur trying to do with button exactly
wait omfg im so dumb, im so sorry, there was another panel over the original posts panel, which the button was supposed to go to and i was clicking the wrong button, that's why it didn't change it's title and all
Hello, im having an issue with my moving background. It works until the player dies then it just stops. I'm using this script for the moving background:|
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScrollBackground : MonoBehaviour
{
[SerializeField] private RawImage _img;
[SerializeField] private float _x, _y;
void Update()
{
_img.uvRect = new Rect(_img.uvRect.position + new Vector2(_x, _y) * Time.deltaTime, _img.uvRect.size);
}
}`
Is this script on the player?
theres nothing about the player in this code block
meaning unless you've tied it to the player some how.. it shouldn't matter about the player..
So nothing on this has to do with the player. If the player dying breaks this script, it's because of something the player is doing, not this one
Do you get any errors
nope
check the inspector when it breaks..
is the scrolling script still present.. and enabled?
yea
nothing seems to be broken
could it be just a unity bug? Maybe restarting it will help?
Log _img.uvRect after you set it
Log the value of the thing you set
after you set it
So you can see what it's set to
I still dont get it, sry I know close to nothing about code
but could the problem be linked to time.deltatime?
Debug Log should literally have been the first thing you ever wrote
learning how to Log/Debug should be your priority
are you setting Time.timeScale to 0 when player dies?
oh ok, mb, I know that guy as Debug.Log and not as log
mb
Log is the function
Debug is the class
@polar acorn sorry for tag but I need to know 
yes, when he dies, I get the gameover function that puts time.timescale to 0
Your singleton object should be in every scene so no matter which scene you start on it exists
that explains it then
Time.deltaTime is 0 then isnt it
if timescale is 0, yes deltaTIme is also 0
yea I guess, I removed the time.timescale and now everything works perfectly
Yeah but then how do I drag and drop my Serialized references cause I need the Player stats component , playerhud component etc which they are only on the player object so how can I? , check in the start method if the player parent from saveandloading script is not null then get the references?
but should I do that or should I put something else instead of time.timescale 0
probably could just use a bool to tell what code to run instead of setting a global value to 0
Your singleton should not reference objects in the scene
oh ok thanks!
if(gameRunning){ // do all ur stuff }
then u can toggle that bool in the player class when it dies
OOOOH so I have a object I'ma call it LoadManager I have that object in both scenes and inside the script should only be public static SaveAndLoadingSystem saveAndLoadInstance right? Or am I wrong or smth
You should have a singleton that holds the data you want to persist between scenes
that singleton should not reference any components on anything
other things should get and set data from the singleton
just use Time.unscaledDeltaTime. its the easiest solution
and then you would have that in the first scene of urs.. and if u apply DDOL to it.. and it will stick around in all ur scenes
I have a struct that is named SaveData and inside is the Data I wanna load so you mean have that as a singleton?

You would make a singleton that holds that struct
Other things modify that struct through the singleton
Apologies if this is the wrong thread but I don't really see a general questions section. Are there any work arounds to when an imported asset is rotated wrong? My script to shoot it is not working properly because the arrow facing in a "flying" position will be going via the Y axis
imma try that thanks
ofc I can rotate it but that still prevents it from shooting along the z axis in its proper orientation
a fix would be to pull the model into blender.. orient it the right way and then apply the rotation..
a work-around is to use an empty container.. w/ the object as a child object.. (orientate the child object to face the right direction in reference to the parent)
and then use the parent object (as the main object)
Or shoot towards transform.up instead of transform.forward
^ a third solution
Awesome that's all helpful thanks guys
np, and #💻┃unity-talk would be where general questions like this normally get asked, for future reference
okay so i made a new script and i made a singleton that hodls that struct , and i ptu this script on a empty gameobject , do i put the gameobject in both scenes?
Your variable should not be static
uh why
Because you want it to be tied to the LoadManager instance
You can/should have a static instance field for the LoadManager itself
you called this a "singleton" but I'm not seeing any of the usual singleton pattern aspects here
like an instance field etc.
https://gamedevbeginner.com/singletons-in-unity-the-right-way/ i saw this do the same thing
so idek
They did this:
public class Singleton : MonoBehaviour
{
public static Singleton instance;
}```
your code is not doing that
your code has a field of an entirely different type
the SaveData field should not be static
@frozen raft Please post your question here! Thank you!
the public static LoadManager instance; should be static
but you don't have that at all
You need to finish following this tutorial
but also restart it from the beginning because it's currently not rightr
i seriously dont get it ngl , i have a script and im trying to access a method from it that loads the data i need from a struct but theres references i need to make to the playerStats etc , by going with the singleton path , i dont understand how to do it since im not allowed to put a singleton where i need to make and get references but i need to have an object that is in both scenes , i cant put the SaveAndLoadingSystem in both scenes cause then i will have to put references n stuff from the player and i dont have the player in the main menu scene so idk how to go with this
Make a Singleton that has a reference to SaveData. Anything that needs to interact with the save data gets it from the singleton
Yeah but my SaveData struct is in the SaveAndLoadingSystem script , do I move it or something?
a singleton can be referenced from anywhere within the scene..
you can put a DontDestroyOnLoad method in the script to make it stick around in all the scenes..
so you'll have access to it from every scene w/ the right setup
Then make SaveAndLoadingSystem a singleton
But it has references and you said a singleton object can't have references
Why does it have references
you can pass references to it when needed
So I can set the player stats to the saved data stats
So if the player health was 30 then it will load the health to be 30
theres other methods of getting references than manually assigning them, as well
And I need the references cause those stats are on different components on the player obj
Why does this object need a reference to a specific object instead of that object pulling data from the one and only instance of this
^ yea, this is just a structure issue.
Imagine the data you want to pass between them is a large dodgeball. Your SaveAndLoadingSystem is in a tall tower, and the player objects are all running around in the field below it.
Does it make more sense for the players to throw the data ball up to the top of the tower, or for the tower to drop the data ball down to player?
(kind of LOUD) - cant fix this bug where the stinger doesnt play after being chased once and escaping and then going back into chase - i have a feeling it might just be me being stupid somewhere but i literally have no idea.
main script (StateChase is the part that calls the chase sounds) - https://gdl.space/dahinefesu.cs
chase sound handler - https://gdl.space/jokovufuce.cpp
For the tower to drop the data ball down to the player
Correct. So you make SaveAndLoadingSystem the source of the data, and the player objects can "catch" it by querying the singleton for the data they need
The SaveAndLoadingSystem doesn't tell the objects its data, the objects ask it for their data
Can't I just move the save and load methods to a diff script and make the SaveData a singleton then use that instance to set and get the stuff I need like health and weapon upgrades etc
I have no idea what your "save and load" methods are, but they seem like they make sense for SaveAndLoadingSystem to do them
You'd just have other objects read that data to do things
https://paste.ofcode.org/rrahDcqRjD3DrmFEz3WVHf this is the whole SaveAndLoadSystem script
or i could move the SaveData struct to another script and make that into a singleton then do the rest
So, as those values change in game, you'd have those objects change the corresponding value in your singleton
Then .Save would simply write the data to file
and vice-versa for Load
So, for example, when the player gets damaged, they'd change SaveAndLoadingSystem.instance.SaveData.health = newHealth (you might need to change your struct for a class)
And likewise, when a player object is created (either at the start of the game, when loading, when changing scenes, etc.) they'd set their health to SaveAndLoadingSystem.instance.SaveData.health
everything digi is saying is 💯 truth.. heres an example of my Save method...
it has a reference to a data class where my game stores its data..
whenever I want to save my new data I just call the Save method..
all the data is there and ready to be written to the JSON save file
whenever something happens (player reaches a checkpoint) or the (player changes the volume settings) it automatically just updates teh stored values in the _savaData class
in the place thats needed
my GameManager stores a reference to that data..
soo.. when my game boots up.. I set up all the game objects by using that reference
this is the asking part.. where my game objects ask for their values
so my buttons are not working, im using TMP buttons and im trying to click them and they do nothing (they where working fine yesterday) and the on click event is set up so i dont know whats going on
so if i wanna save the player health i do SaveAndLoadSystem.Save here? then do SaveAndLoadSystem.Load wherever i need to load?
did you add to it?
first i do smth like SaveAndLoadingSystem.instance.SaveData.health = health then save
think maybe somethings blocking the buttons?
hope im right lmao
and ur image is marked as Raycast Target?
yea it is
i dont know how
how do i fix that?
check its inspector during playmode, should see a window there might be collapsed on bottom right
it may be hidden drag up from the bottom
i debugged w/o even knowing it existed for almost a year 😅
it was
objects in UI , hierarchy order Last = Above.
also always make your Rect Transforms proper sizes
huh man i dont even know what im looking at 😭
this is what i get when i press single player
hover the button during playmode and see what it says
in TMP expand ExtraSettings
and you'll see the Raycast Target
all my text have this setting disabled.. b/c the text bar covers a good majority of the buttons
ur text so wide lol
thicc
I am trying to make a selection chat with npc but I cant choose the option
oh dont use legacy
yea, 2 things..
- u should disable the raycast target there..
- u lied to us (thats not TMPro)
also just dont put Text elements above buttons
UI is always hierarchy Bottom = First
using ink
may end up having to find dedicated asset documentation for troubleshooting..
conserning the second one i thought it was as thats what i clicked -_-
im gonna go ahead and say.. ive never used Ink.. so idk
just messsing with ya, but yea TMPro components are much better than legacy Text component
i thought i was using TMP
😭
yea, coming from Photoshop the heirarchy really threw me off for a while
in PS its the exact opposite.. top = top
yeah its strange at first but it makes sense since everything is drawn in order
so drawn last = above
gpu thangs
button order..
- Container
- Background (Button)
- Text
ya, thats how i finally figured it out.. just thinking about how its drawn.. 1 layer at a time
in photoshop its like drilling into the image.. layers come as u get to them (top down)
yeah thats a good way to look at it lol
this conversation may be relevent to u as well @rigid valve
make sure nothings covering the button (the text for example..) should have its Raycast target option disabled.. so u can click thru it..
check the EventSystem to debug what ur hitting ( during play mode )
yea @rocky canyon i switched it to TMP and it works fine
I am not getting any errors tho
i feel like an idiot now
bump
these are my buttons
yeah I was trying to use mouse to select options so was updating the code
eaelrir I wanted to use only keyboard for seelcting options and have mouse clamped but that didnt worked out
do u know a better way to create a dialouge with options??? rn I am using ink
either unlock the cursor for selections
or
there is a workaround for First Person view with locked cursor though by replacing the Input Module
Ink is amazing
its not the problem
this is my mouse code
📃 Large Code Blocks
Use 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 format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
!code
📃 Large Code Blocks
Use 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 format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
this is bad for mouse btw
* Time.deltaTime
don't use that on mouse inputs, its already frame independent
ok so besides that what are you showing me here, does the option not work for you if you unlock cursor?
will keep that in mind I am following a yt tutotial the guy was telling to use timedelta
when Im press the option I should get u selected "pokemon name" but I get nthng
yeah the tutorial was wrong then
I wanted this thing to work with arrow keys to nav and f to select but it wasnt working thats why I am trying mouse now still no resluts
did you put a Log to make sure button is actually working
well you gotta tackle one thing at time lol
let me do that rq
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-SelectableNavigation.html
if you want keyboard navigation for UI you'd need to set this up
do u have spare time I really need to fix this for college assignment
anyone got an idea why my inventory items wont stack
I'm only around this channel when Im looking away from my work
https://paste.ofcode.org/Li6EwbSANsBDzRX58747st
this is the code for complete dialoyge managment
many people here are knowledgeable if I don't respond I'm sure someone will
im doing that but uh it doesnt seem to work
https://paste.ofcode.org/8pHC4SCzUPtWpqwiMVQncT
this one is simply to check if player is in range
You have to make sure you're even getting interactions on UI working in the first place, worry about the code after
Does that object have a field named SaveData
why are you making a save system if you lack such basics
That's a class yes. Do you have a field named SaveData on your singleton
That isn't even a declaration of the SaveData variable
I cant output this index in debug log??
Just of a class that COULD be used (but apparantly isn't)
No comma
"WORKKING " + choiceIndex
if you put comma , you pass gameObject
that an int
if you want to debug the value add it to the string
"Working " + choiceIndex
I believe they wanted "WORKKING" actually
oh didnt see u wrote that already 😛
kinda forgot to put it oops
bump, stump, lump
where is the mouse ?
using fffff
what does this have anything to do with MakeChoice
you seem to have a wild misunderstanding how the Button component works
I am sorry 😶 I am still learning
i know but you have to do the simple stuff first, you're jumping into doing dialouge system without knowing yet how to interact with the UI lol
can I dm u if u dont mind
if you have to make a seperate scene/project and strictly work on Buttons / methods through UI etc. Take that approach you slowly put everything together
you're learning too many things at once
have u checked my mouse code? shouldn't it get unclammped from centre when I am chatting with npc?
I said that tho
You have to unlock the cursor and make it visible
otheriwse you'd need a special FPV Input Module made for locked curosr
how?? I googled it I found only this much
keep it simple for now and unlock th cursor to interact with UI
why did you put ToggleCursorLock() then
Yeah I get it
I want it to get locked again when I leave npc
so call the toggle
must be public to call it from another script
or subscribe to an event (probably too complex for you rn)
why call the toggle?
I got a question for HUD implementation:
So as you can see theres a screen with some material on it to appear like there some information on it. Its static and doesnt change. I bought some animated HUD which i can customise to display health and say speed, but im not sure how / If i can implement it to the actual ship (This game will be in VR, so i see no real alternative). Any suggestions?
if (DialogueManager.GetInstance().dialogueIsPlaying)
{
ToggleCursorLock();
}
you have to fix this
this will keep toggling
this is a code channel
probably #💻┃unity-talk
the info displayed will eventually need code though yes
but the initial placement is probably just related to using shaders/Ui
what are you doing
why did you do that
also dont send screenshots of code
to stop nonstop toggling?
so you remove the entire method instead of not calling it every frame?
so uh i did it for the player position but it keeps saying object not set to reference and idk tf did i do wrong
Either instance is null or SaveData is null
I mean .... okay u tell what to do
I did lol
you wont learn much if I tell you every single step though.
how ? 
show where you assign both
btw can u explain a lil what I did wrong here????
Okay and where do you set instance
And SaveData as well, actually
it's no longer a struct
Removing the entire method instead just remove calling ToggleCursorLock every frame
doesnt unity automatically create instance when its serialized in inspector
i dont set it anywhere , but wdym by set it? if u dont mind me asking
If it's a serialized class
oh right
Where do you put a value in the variable
now like I want npc to ask 5 que and if player asnwers all correct then a new action happens
for this
I write the ink script
then what tho 😶
setting aka =
like in instance and SaveData , well uh i dont put any value in it , cause i didnt know and idk what to put there
A variable is null until you actually put something in it
So you have to say which SaveAndLoadingSystem you want instance to be, and which SaveData you want SaveData to be
you have to follow guideson this as this is highly specific.
But also as good as INK system is you are still expected to know the basic c# workflows like using arrays etc.
can I do it here if choice index == xxx then do this
arent you following a tutorial for Ink?
pretty sure they cover correct choices / actions
no it was only till this pokemon part
smth like this? sorry if its wrong
is this approach wrong?
what the hekk
For instance: Did you read the singleton tutorial I linked you many many times
For SaveData: This would set it to itself, how would that accomplish anything
which approach
Hello friends 🙂 I have a question about "detection". I am making a platformer and naturally have to check collision with the floor, walls and cliffs... I am using Physics2D.OverlapBox right now to check those, one for each type of detection. Shoul I use collider triggers instead? Which one has a better performance or is it indiferent in this case?
yeah i read it lots of times ngl
Hi, want to create a basic time system, not too complicated, just a clock with 0-24hours and minutes, for example after 20:00 it will be night, after 7:00 will be day. Is it that hard? I search for videos but all of these tutorials was like a lot line of code. Im not on pc now but will be soon, thats why i asking, then ill try figure it out.
smth like this for instance
Yes, it covers where and how to set instance
bump chump thump
no its not hard
nvm i'll go watch a more explain tuttorial dont want to annoy u with supersilly ques
ok lol no worries just follow the tutorials, thats where i learned Ink
they cover everything you need
oooh okay okay , but now i gotta think for SaveData i guess
You either need to create an empty one or serialize the class so it can be set in the inspector
no u should not use triggers instead
imo the Physics class is the best method
any specifial u would like to suggest
this dude covers Ink https://www.youtube.com/@ShapedByRainStudios
I really don't know what is better, a gameObject with "several" children or "several" raycasts 😅 about the performance and all, I really don't like this many children (aesthetically at least)
lol I am wqatching this same guy
yeah he has good ones
https://youtu.be/-nK-tQ_vc0Y?list=PLkz5NgoW6xcWtxugVBcK58aIHpxyjjCSE
this one good too
Ever wonder how to convey your characters' thoughts or have your game talk to your player? In this tutorial, we take a look into a script tool called Inky from Inklestudios and write up a small dialogue for Phoenix wright in Unity!
Resources
Ink by Inklestudios: https://www.inklestudios.com/ink/
Brackey's Dialogue System: https://www.yout...
iirc some stuff is newer and has more feature btw
check the docs for ink
seems like serializing the SaveData class fixed all my problems lol
so now whenever i make a change to lets say the health and maxhealth , i do smth like this?
You answered your own question. Also you should not be worrying about that kind of "performance" esp as a beginner, just make the game
computers are very powerful these days, they can handle such things easily
I think you're right. Maybe I am overthinking about this. Just worry with performance problems in different devices (not mobile)
@rich adder thanks a lot!
anyone got an idea why my inventory items wont stack
Like this?
welp nothing saves

seems the values aren't updated when you save
but im updating them
lemme get u a vid rq
have no idea if you're setting this before you hit save ?
yep it is-
also if you serialized the class observe savedata in the inspector see if thats changing
it is
Show the code where that log comes from
simply from the SaveAndLoadingSystem script
Okay, so, you're logging all the values of the local saveData. Where do you put anything in it?
holy shit yeah
now it saves
pog
bumper bumper where art thou
after an hour and half you couldn't debug it lol
no sir im working on inventory
holy hell
GetComponent<ChaseEffectHandler>().StartCoroutine(GetComponent<ChaseEffectHandler>().OnChaseStart());
just make a public mehod that calls the coroutine
👍
anyway so is this only being called once ? OnChaseStart()
at the start of the chase when enemy spots player yeah, but then the hasStung bool resets OnChaseEnd and the canChaseTheme is handled in Update
so really the deciding factor whether it gets called is hasStung
@rich adder is are a keywork or smth
and i debugged it earlier and it was calling the chase music etc but it wasnt playing the sound
put Debug.Log inside then make sure its calling it again
it was im pretty sure but ill check again
its been a while since i've used the Ink editor
need to look at docs
alright. Also is it a 3D / "spatial" sound ?
the log is where stinger.PlayOneShot is ?
yeah
audio source volume is up and all that in inspector on chase?
yup
so i am saving data n everything but it doesnt load it , and im confused on why
u never put it into an object
Do you get the log? Are there any errors?
You load the object from the string and then promptly throw it directly in the garbage
from json returns data
You aren't doing anything with the result
how could i possibly do something with the result?
Well, what do you want to do with the result?
i just replayed the game but with the audiosource open in the inspector, was on low fps, escaped chase and went back into it and it worked lol?
Right now it's fax-machine-into-shredder.gif
think back to what you were trying to do
but it doesnt work if im not doing those things???
save the data and then load that said data
Okay, and what do you want to do with the loaded data
laod it to the player object and their respective components , health to playstats etc
