#AI Manager finder
1 messages · Page 1 of 1 (latest)
yea
Like somewhere in the scene itself, in the game itself, no, its a empty object, it doesnt need to be in a specific spot somewhere
So then you're trying to display a message if the script cannot be found in the scene?
Anywhere in the scene yes
in the inspector not in the scene
but the box doesn't fucking appear
doesn't that mean that the ai manager is found?
because the box doesn't appear?
No no hang on
I'm talking about the AI manager script here
Not the animatronic thing
So then you're trying to display a message if the AI Manager script cannot be found in the scene?
Yes, that would be a yes to my question
So you don't want to use FindObjectsOfTypeAll because it searches in your scene, and in your project files
let me put that
but I still have a feeling that I should follow my theory
that
box not appear, AI Manager is found
box appear, AI Manager not found
The line is commented lol
Remove the comment mark // at the beginning of the line
You will get an error
BRO I LITERALLY CONTACTED MY TIC TEACHER TOO
AND HE TOLD ME TOO
USE THE //
fuck you mr. johnson
That just disables your code, you didn't understand your teacher correctly
There we go, the errors I expected
First one, remove the AIManager[] aiManager = null; because it's not supposed to be there anymore
I don't think the code is wrong, I think it's just old
It is wrong
bro I knew a guy who used the exact same code that I use before i deleted the // and everything worked for him
Then, it's Object.FindObjectsOfType<AIManager>(), not Resources.FindObjectsOfType
And that's pretty much it
deleted
brother
there is no
ohhhhh
im stupid nbm
alright
and now?
That's it
If you have one or more AI Managers in the scene then the message will not show
Else, it will show
no
there isn't no
there is the AI_Manager object and the AIManager script
which is on the object AND in the Assets/Scripts folder
There's an AI Manager object yes, it's detecting that
The function does not care about the Assets
Yes, try deleting that and come back to your Animatronic script
You'll see that there is the box now
Well yeah that's literally what your code is checking!
Do you even know what your own code does?
Then it's debugging time
Log the array's length before the if, in Animatronic's editor script
Like this, but the array's length instead of a random message
You didn't change anything
nah it should be above
Debug.Log($"Array length is: {aiManager.Length}");
I'm really starting to doubt your C# skills here
doubt them idc
This, above the if statement
cash money
Will print the array length along with a recognizable message
these are bugging me off
Then... remove them?
Debug.Log("Camera " + i.ToString() + ": " + cameraTimeBetweenViews[i].ToString());
it has + i.ToString() + ": " + cameraTimeBetweenViews[i].ToString its bugging me off like
its confusing me
i need to delete it whole but im scared sum not gon work
BUT NAH
it in the debug log ()
fuck it
nah but these are good I never got these before cuz of the camera logs
That's the point of editor code, it runs in the editor
You'll have to select the object the Animatronic script is on though, for the editor code to run
Because you've put the code in OnInspectorGUI, which runs when the Inspector of the Animatronic script gets drawn
it interferes with the fucking game doe
Bro
Do you even read what I'm writing
You do not need to run the game in order to debug an editor script
BROTHER, YOU DON'T SEE THE TIMES THE ERRORS ARE SENT?! MY TIMEMANAGER/GAMEMANAGE WITH THE "ANIMATRONIC" WORKS
fuck off bro
like actually
my shit went BONKERS
like
badonkadong
style
like
WEEEEEEEEEEEEEE
boom
Yes, an error on line 58 of game manager
OH REALLY?
I did not know that
thank you
if (gameTime >= transitionTimes[currentTransition])
Which, is probably due to the fact that you deleted the AI_Manager object earlier
you dont say
you don't say
currentTransition is either negative or greater than the last index of transitionTimes
im just trying to fix this one
it confirms the little 3 idiots want to "move" but they cant
One thing at a time please
Something on line 61 of GameManager is null but you're trying to do something to it anyway
Ah we're in for a world of hurt
🤨
Posting with the line numbers can help
AIManager.Instance is null
Yes! So add that AI Manager back to the scene
I did
Code says otherwise
Where do you set AIManager.Instance
in the fokin AIManager script, it had to get the instance from somewhere
It worked before you deleted the object, so either you didn't add it back, or you didn't attach an AI Manager to the object
can't get the instance from thin air
Where do you set it
this pic says otherwise
Where do you set Instance
uhhhhhhh
You have to listen to the things the code is telling you. It says the value is null, so go check where you set it
!code, and put a debug log in there and see when that's called. Either this isn't in the scene or you're trying to read it before this runs
📃 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.
At this point anything
I got this when I started the game
If that's what you put in Awake, that means it has run
Then the other script that fails on line 62 runs before AIManager, which would be the cause of the exception
How did you fix it?
bruv
[insert TF2 Medic saying I have no idea gif here]
My guess is by putting the instance in the scene
Yeah most likely
HAHA
5TIMES NO ERRORS
HAHAHAAAAAA
THEY SAID I COULDN'T DO IT
BUT LOOK AT ME NOW
HAHAAAAAAAA
🦅 IM THE BIGGEST BIRD IM THE BIGGEST BIRD 🦅
No you just fiddled until it worked
@broken cape Spam warnings include threads as well. And you are out of warnings.
Do us all a favor and learn how Unity works, and how scripting works
i wouldnt call that spam, i would call that celebration
I would call it a ban if you continue
no i wont
It's not magic at all, computers just follow your instructions
If you tell bad things, it does the bad things
But fog, you do know that i'm the biggest bird, right? Normal question no spam no nun
This is off-topic, you're running out of warnings here
alright brother brother kifflom SPR2, what was the other issue that I had?
The editor code, not showing the warning box
Ah yeah the other error
Then the array has less than 7 elements in it
!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.
if (gameTime >= transitionTimes[currentTransition])
{
currentTransition++;
AIManager.Instance.TransitionOccured();
}
this is everything that has sum to do with 58
currentTransition was too low or too high.
Debug.Log its value
Before the if statement
That's the initial value, which is valid
VALID 🦅
I will right now
Definitely above 6 since they just increment it in that if statement
Unconditionally it seems
well it doesn't give me a number yet
it just spams this like w the cameras
Because you haven't told it to?
Did you log a number
or did you log text
text brother
it's only going to print what you tell it to print; it's not magic
inb4 Log("What seems to be the problem?")
inb4 what this
any number?
No for god's sake
currentTransition
That's the source of the error
Logically you would like to see its value
Why would we ask you to log a random number
Log
The
Value
As I said the first time
Told you we were in for a wild ride :)
Look at the last log, before the error
Hope I did this correctly
Yes this is good
Okay, and what is the last log before you get the out of bounds error
it switched to 1
i dunno, i have to reach the bounds
So go do that
Wait until you get the error
A little worse since I joined this thread
so far its 5
It can't be that long
The transition times are less than 5 seconds each
Should have taken less than 30 in total
Yeah, the array is length 6, so you can only access indices 0 to 5
Accessing index 6 throws that error
Yes, there is no "Element 6" in your screenshot
So that would be the problem
You are increasing your currentTransition without regard to the size of the list
Don't increase it if it's at the end
do you want to the code? I'm not increasing anything manually
haha wrong
currentTransition++; does increase its value by 1
You have that in the code
It is perfectly good in this context
adding currentTransition--;?
No
Having currentTransition++;
If you don't have that then the transitions will never be made
So do what Digiholic said
.
Don't increase it if it's at the end
so i cant remove it
its will break everything
I also should NOT increase it if its at the end
I can't just move it else where in the script
Just, check that you're at the end before accessing the array
You know how to do that right? You've done at least two if statements, from what I can see looking at the past 2 hours of conversation
hmmmmmm
i dont know what I've done here
if (currentTransition++ = true)
{
currentTransition++ = !currentTransition++;
}
if im trying to read it out loud
it makes sense
but
game making wise
i dont think it does
WAIT
If it is, you can add one. Else, don't do anything
if (currentTransition++ < 6 )
{
currentTransition++ = !currentTransition++;
}
hmmmmmm
still not good
c# wise
Clearly not
I would suggest taking basic scripting courses at this point
Because you're just guessing, you have been guessing this entire conversation
its not my fault that I can't I make a script using my own words
do you know how much EASIER would that be?
It pretty much is your fault, sorry to say but truth hurts
i basically need to tell it
brother, if its less than 6 do not increase it no mo
Knowing how to translate words into code is the core of programming
give me translator pls
No, I won't give you code that just works
Then what do you want me to say
i have no idea
That's the closest I can get without giving you the code
If it's less than 6, you can add one. Else, don't do anything
Can't get clearer than this
so if the currentTransition < 6
let me COOK
if currentTransition < 6
{
bROOOOOO
Getting there...
Do you know what ++ means
increasing by 1
Right so in that snippet why do you want to increas currentTransition by 3
You increase it three times in that alone
OHHHHH
if (currentTransition++ < 6 )
{
currentTransition++ = !currentTransition++;
}
Means this:
- Check if currentTransition is less than 6
- Add one to currentTransition
- Check if currentTransition is equal to the opposite of currentTransition (which also makes no sense by the way)
- Add one to the currentTransition
- Add one to the currentTransition
This entire snippet is nonsense, but it also demonstrates a lack of understanding of ++ or variables in general
Yes that is basically it
aww
no no, not quite right
let me cook more
You edited this to make it less right
This is programming gibberish. I suggest doing the Intro to C# course linked in the pins and learn the syntax of dealing with numbers and if statements
no, not yet, let me cook
so "add" is a command or sum
no
it STILL doesnt look right
if (currentTransition < 6)
{
you can add 1
else = none
}
hmmmmmmmmm
if (currentTransition < 6)
{
currentTransition = -1;
}
what
Nope, still not
It would probably be a good idea to think instead of making random guesses until we tell you it's right like Patrick opening the pickle jar
(That sets the value to -1, it does not add one, it does not remove one either)
So then what do you think this snippet does
if (currentTransition < 6)
{
currentTransition = -1;
}
in words
what does this do
nothing basically
I don't care about "basically" this is a test to see if you have any idea at all what you are writing
explain what this does
so if its less than 6, its -1 which doesn't make ANY sense
Correct. So, why did you write that
you seem to know what it means
anyone can read WORDS
code is words
you just read it to me and translated it to words
Because you never bothered to learn properly?
= is a word. It means "Set this variable to"
-1 is a word. It means "negative 1"
These are all "words" in programming
im not a baby, i know what -1 is*
I learned - numbers half of the math lessons I did my whole life
currentTransition is a programming word that means "The number currently stored in the box labeled currentTransition I keep on the shelf"
So, currentTransition = -1 means "The number currently stored in the box labeld currentTransition I keep on the shelf, set that value to, -1"
as opposed to what
i HATE ints
What would you want to use instead
normal words and not this = that ++; to --; and Random.IEnumerator
"One" is not a normal word?
You just told me off for explaining that -1 means "Negative one" and now you're saying that numbers are too hard?
I never said that
Still waiting to find out what you expect to use instead of ints
It is basically the absolute simplest kind of numbers imaginable
no decimal points
relatively small selection of possible values
only thing that's simpler is a uint because those can't be negative
so the number is 6
So what do you think would make this easier instead of using ints
i basically need to tell it to to not increase it after 6
i know the if loop
its
if ( currentTransition < 6)
throw it out the window, save it for later
and NOW i have to tell it to
increase by 1 if necessary but if not, dont do it
So, you have a line for "If currentTransition is less than 6". What do you want to happen if currentTransition is less than 6?
make it increase by 1 if necessary
Okay, so, how do you increase a variable by one?
So then what's the problem?
You know what you want to do, and you know when you want to do it
so just moosh those two thoughts together
if ( currentTransition < 6)
{
currentTransition++
}
Congratulations
Yes
At no point in your guessing did you ever have that
That is indeed correct
No just place that if where you have the original currentTransition++
You are still increasing it in the first loop
So you will increase it twice
Take this if statement and put it around the already existing variable increase
And that TransitionOccured thing
if (gameTime >= transitionTimes[currentTransition], currentTransition < 6)
{
currentTransition++
AIManager.Instance.TransitionOccured();
}
?
That's not how you combine if statements
Yes, you could combine it into one if statement. But you should look up how to do that
It might be better to go the simple way here
You can put one if into another, you know that?
if (a)
{
if (b)
{
}
}
oh yeaah
the thing that makes you go boogy 🍔
if (gameTime >= transitionTimes[currentTransition])
{
AIManager.Instance.TransitionOccured();
if( currentTransition < 6 )
{
currentTransition++;
}
}
Why are you increasing it by two
now?
Have you tried it? Because that looks good now
i fell asleep lmao