#NullReferenceException
1 messages · Page 1 of 1 (latest)
I will be off for a while. So, I am going to send all the information needed for that issue and after that we will catch it up when we left it.
PlayerController.cs
https://blazebin.io/rwnxpyrtmmbp/0
A tool for sharing your source code with the world!
ObjectPooling.cs
https://blazebin.io/uarskywoinap/0
A tool for sharing your source code with the world!
objectPooling is null so it hasn't been assigned in the inspector
Yeah
The problem is that I have a parent game object for object pooling and child game objects
Here
The parent is empty on inspector
and my child game objects are that I send you
no, it hasn't been assigned in the player controller
Yes I see it before I had it as an instance
I mean I did something like
public static ObjectPooling Instance
I thought if maybe the problem was with that and change iut
it
So, now yeah I have to assign it inside player controoler
But don't know which object to assign?
The one that you want it to use
Show the player controller's inspector
Could you show RoundManager script?
Yes
Here
Whoops i made a silly mistake, i was meant to be looking at line 85 i was looking at 58
No problem I am going to send all of my scripts at the top so you can see them. I have sent already 2 of them
There's no field in the inspector for the object pooling?
Anyway, where are you setting/initializing objectPooling?
ugh i read the wrong line again
I made it singleton
public static ObjectPooling Instance;
why
Because thats how I had it before
Before, when it also didn't work?
I was just wondering if I am going to change that and take reference what will happen
Yes
in your playerController script you say that objectpooling.cs exists but not which one exists
IT doesn't work for both of them
Put it back the way it was and assign the reference in the inspector
Yeah but in player controller which object to assign there thats what I dont understand
I have collision, gemparticle and logs
Those are childs of object pooling game object
Okay well, where is objectPooling.cs? is it attached to an object or is somewhere else?
Well which one of them do you want to use?
So logsPooling, GemParticelPooling and collisionParticle pooling all have the ObjectPooling.cs Script on them?
Can I make like different classes for each of them
I assume you want to use gem particle pooling when the bird collides with a gem, right?
yes
and log pooling when it collides with a log?
Then you obviously can't use one field to store all of them
Okay well your playerController script knows that ObjectPooling.cs exists but it doesnt know that all these objects exists, you need to get a reference to ObjectPooling.cs on these objects.
public ObjectPooling gemObjectPooling;
public ObjectPooling logObjectPooling;
public ObjectPooling collisionObjectPooling;
then use whichever variable you need in the code
Yes ^
That will be on my player controller script?
yup
that's where you use the variables, right?
I dont think so because OP.cs is responsible for that like I said before I have OP.cs inside my child game objects
Ok I am going to make it on playe controller
How the objects are arranged in the hierarchy has absolutely nothing to do with it
You mean it doesn't matter where i am going to use those variables?
https://pastebin.com/4amgrWfV copy this into PlayerController.cs, go to where ever it is on the player and set the references
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
No, I mean that their arrangement in the hierarchy has nothing to do with it
What is that?
Guys I didn't want you to solve it for me but anyway XD
You're lacking skills in very basic Unity/C# concepts so it's hard to do otherwise
Nitku did also tell you what you needed to do earlier but you just like didnt
I know how to set references and all of that I am using unity 1 year already I was just confused where I have to use that references cuz I have OP.cs and PC.cs
If you don't know that you have to set the values of variables in the same script where you use them, that's a very basic issue
I am working on that game with a guy by the way he is a collaborator and trying to help me with the game. This part was made by him, so I wasn't sure what he did here XD.
He just left for me some issues to handle myself
Ahh that makes sense
These aren't the kind of things that would be different depending on who wrote the code
Guys I have to leave somewhere now it is a need, so I will come back and we will continue for now I have to close it. Thanks!
Hello, guys! Are you there?
Before closing the thread I have a very small issue to solve.
@visual fractal the issue?
So, what I want to do is to actually enable and disable my options ui elements in main menu scene. In main menu I have a button which says Options. So, what I done before was to load the options scene when clicking that button. Now, I got confused of how to make my options scene enable and disable I dont want to load a new scene.
@visual fractal any luck?
You can close that thread everything is fine!