Welcome,
Guest
. Please
login
or
register
.
April 26, 2026, 01:36:44 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
NullReferenceException with GetComponent
« previous
next »
Print
Pages: [
1
]
Author
Topic: NullReferenceException with GetComponent (Read 2970 times)
cloudsyk3
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 1
NullReferenceException with GetComponent
«
on:
June 03, 2014, 04:21:37 AM »
My code is as follows:
gameObject
.
GetComponent
<
UISlider
>
(
)
.
value
=
0
.
00f
;
Debug
.
Log
(
"loading value = "
+
gameObject
.
GetComponent
<
UISlider
>
(
)
.
value
)
;
and console log is:
NullReferenceException: Object reference not set to an instance of an object
loading value = 0
It is strange that it says null ref but could print out, the script is set in the gameobject.
Thanks
Logged
Caio.Lib
Newbie
Thank You
-Given: 7
-Receive: 2
Posts: 26
Re: NullReferenceException with GetComponent
«
Reply #1 on:
June 03, 2014, 09:14:10 AM »
Hi,
When you click on the message in the console is the same GameObject?
Are you using more than one script for this GameObject?
I think the error comes from another script.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
NullReferenceException with GetComponent