C
C#6mo ago
Slazmaz

Passing parameters to overloaded constructor

How would I pass the texture2D variable to be handled in the second constructor. Obviously return does not work but that is what I would do if it is was an overloaded function and not a constructor.
No description
5 Replies
ben SKVU4-9YBC
ben SKVU4-9YBC6mo ago
public Sprite(...) : this(...)
Slazmaz
Slazmaz6mo ago
but that wouldn't allow me to pass the new texture2d variable?
ben SKVU4-9YBC
ben SKVU4-9YBC6mo ago
sure it would. public Sprite(string texture, ...) : this(Assets.Textures[texture], ...) {}
Slazmaz
Slazmaz6mo ago
oh yea that did the trick, thanks!
ben SKVU4-9YBC
ben SKVU4-9YBC6mo ago
no problem
Want results from more Discord servers?
Add your server