SelfDestruct.timeTillDestroy Console W

During this lecture, I started getting a warning in the console saying the following:

“Assets\Scripts\SelfDestruct.cs(7,28): warning CS0414: The field ‘SelfDestruct.timeTillDestroy’ is assigned but its value is never used”

Why is this warning being triggered and how do I fix it?

Hi HaggardMelon,

Do you use the variable in your code, if so, simply initialise the variable with = 0f or something like that.

Did this fix it?


See also:

Hi Nina,

I figured out what happened. I had forgotten to remove the first 3f from the Destroy line and insert timeTillDestroy. All good now. Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms