I have 3D object and I want to make it invisible by turning off its rendering. But when I run the code in runtime it shows ::
" Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.MissingComponentException: There is no 'Renderer' attached to the "3dObject" game object, but a script is trying to access it."
I want to know if There is no renderer then how I am able to see that object in scene/game view. and also in inspector nothing is there (mesh renderer / renderer / mesh filter).
I'm Using c# : this.GetComponent<Renderer>().enabled=true;
I'm using vuforia and want to keep last tracked object on screen after Tracking Lost function is called.
OR Is there any other way to do this...?
I'm new in unity and I know its a pretty basic question but not getting anything. Need Help..
One approach could be: