Question by
DevKonsept · Mar 25 at 10:33 AM ·
c#getcomponentmissing
I wan't to check if variable on a scritp component is missing
As shown on pictures I wan't to destroy an object if it has a missing transform variable on script.
currentLeadTransform is a transform variable. I wan't to destroy gameObject if it is missing(not null). if (gameObject.GetComponent().currentLeadTransform == null) Destroy(gameObject);
I have tried code above but it didn't work. Thanks to everyone who want to help. Much love.
.
dontwork.jpg
(80.9 kB)
missingtrasnform.jpg
(127.3 kB)
Comment
Your answer

Follow this Question
Related Questions
Animation disappears after getComponent? 0 Answers
How can i get component as an abstract base class? 1 Answer
Left hand side of an assignment must be a variable, a property or an indexer 1 Answer
I want to check if variable is missing(not null),Can't check if object has missing variable 0 Answers
GetComponent not working 1 Answer