+ 3

C#/Unity: Obsolete scripts

I have a warning after loading standard assets "supportsRenderTextures always returns true, no need to call it". Any thoughts how to fix it in code?

16th Mar 2017, 11:22 AM
Ekaterina Gorskikh
Ekaterina Gorskikh - avatar
5 odpowiedzi
+ 15
I know someone I can ask, but not til next week katerina. I do think sololearn should have Unity/Blender Q and A, thank you for the question
17th Mar 2017, 11:35 AM
‎‏‎‏‎Joe
‎‏‎‏‎Joe - avatar
+ 11
Isn't it a warning only? (not an error) Does it stops running/compiling that code? I don't know why supportsRenderTextures always return true, but (as I can guess) you were told that you don't need to wrap your "enabled = false;" in "if", cause with !true it will never be executed. (Perhaps you can delete that part or (ex)change it to "enabled = true;" but I think variable "enabled" anyway defined somewhere else)
17th Mar 2017, 7:10 PM
Andrew Harchenko (Tomsk)
Andrew Harchenko (Tomsk) - avatar
+ 1
You can check the value of supportsRenderTextures, and change its value into true. I think this value is false or void.
16th Mar 2017, 12:39 PM
黃瀞瑩
黃瀞瑩 - avatar
0
Thanks guys! Unfortunately I can't find anything about my issue on Unity website. I'm totally newbie in coding so any help will be useful. I think I should add some details to my question. I guess this part of the code causes the warning: override protected void Start() { if (!SystemInfo.supportsRenderTextures) { enabled = false; return; } base.Start(); } How should I change it or can I simply delete this part of the code?
17th Mar 2017, 3:13 PM
Ekaterina Gorskikh
Ekaterina Gorskikh - avatar
0
You're probably not struggling with this now, but if anyone out there is... override protected void Start() { base.Start(); } Because supportsRenderTextures always returns true.
6th May 2020, 11:36 PM
Donalda Feith
Donalda Feith - avatar