as before we talk about using , i usually do if else() to in case the property would be…
Jump to turn (13)
- 1as before we talk about using , i usually do if else() to in case the property w
- 2i cant use using , the big problem is that the Material class is not belong to I
- 3it looks like using (var mat = new Material()) , the mat will always be new if t
- 4but is Material class is inherit IDisposable in Unity? how do i check if this cl
- 5can i encapsulate a new Material class that inherit IDisposable class?
- 6what is protected mean ? is that a way likes public or private?
- 7public DisposableMaterial() : base() what is base mean in here? is this like der
- 8is that mean if i new a property in public DisposableMaterial() : base() { publi
- 9so in your public DisposableMaterial() : base() { // constructor code here } we
- 10so in this kind of constructor , the way only set a value that property is alrea
- 11oh , so i can not write the base() after we public Cat() in Cat class right?
- 12so if Animal class has a inherit other class todat , the base() will also have o
- 13okay thanks
- User
as before we talk about using , i usually do if else() to in case the property would be null before. if today i public a property and i want to use using to instead , will code be like this?
public Material Mat;
using(Mat){ // Do something; }
is that right?
- Assistant
Unfortunately, you cannot use the
usingstatement with a class property likeMaterial Matin the way you have shown in your code. Theusingstatement is typically used to ensure that an object is disposed of properly, by calling its method, when it is no longer needed. It is usually used with objects that implement the interface.