#Alovon Unity Problem (Button Hiding)

1 messages · Page 1 of 1 (latest)

raven arrow
#

Okay made the thread

half venture
#

So where do you call this function

raven arrow
#

Well how can you call on a function from another script inside another script

#

as that is the only way to "Call" it based on how Unity sees it atm

raven arrow
#

as it doesn't let me drag the button itself into the script atm

half venture
#

I don't even know what you're talking about. Drag what in where?

#

I just want to know where you are calling this function

raven arrow
#

that is the problem

#

as the other functions here just "work"

#

without specific calls inside themsleves

half venture
raven arrow
#

at least nothing that I can see

half venture
#

When do you want to call it

raven arrow
#

That is inside the PlayerController script

#

and is the "GameEnd" state more or less

half venture
# raven arrow

Okay, so you want to call this function inside of SetCountText?

raven arrow
#

If I could, yeah

half venture
#

Then do so

raven arrow
#

yeah problem is it won't let me call the function like I can the value of count

static cipher
#

Because the function is defined in another class ?

raven arrow
#

Yeah, which is the hangup here

#

I can't call the function within itself seemingly if I set it to inactive by default

static cipher
#

So you need a reference to a instance of Button controller

half venture
#

You have to tell it which ButtonController you want to use

raven arrow
half venture
static cipher
#

You define a public ButtonController buttCintroller; at the top

#

Then drag the button cont component in there and then you can go buttController.MyCoolMethod()

#

Digi send him the referincing 101 video

#

Im on my phone and cant

half venture
raven arrow
half venture
raven arrow
#

the button is the object that the ButtonController script should be influencing

half venture
static cipher
#

No no

#

You need to reference ButtonController

#

Inside Player something

#

So you can button controllers method

raven arrow
#

Yeah, that is what I did

#

in image 2

static cipher
#

From player

half venture
#

Oh wait, it's getting the ButtonController from itself

#

is this the same object?

static cipher
#

Its private and he is trying to get button controller fro the player

#

Watch the video

#

About public fields

#

Not just the first thing you see

raven arrow
#

yeah that video has all the elements tied to the same object

#

the tank one

#

the UI Count, TankFlash.etc are all tied to the Tank Object

#

I'm trying to make the actions of one object influence another

#

that isn't onColide like with the cubes that incriment points

half venture
#

Did you watch the second section of the video

#

With the ammo display

#

There's even a handy little infographic in case reading is too hard

raven arrow
#

Yeah that's more or less what I am doing for the text

#

it just won't work with the button

half venture
#

Why not

raven arrow
half venture
raven arrow
half venture
#

So no

raven arrow
half venture
#

GameObject is not a component.

#

Also is ButtonController on the object you want to activate?

raven arrow
half venture
#

Why does the variable WinButton exist at all

raven arrow
#

And minor-side note

#

how do I guarantee the lighting in the main scene is prebuilt?

#

as RN if I start from scene one it looks like this

#

@half venture
@static cipher ?