Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

How to use a templated member in a MonoBehavior?

$
0
0
Hello Community,

am developing a special container type which I'd like to control through a MonoBehavior.
How can I have a member variable in a monobehavior that has a template parameter?

Would like something like this, but that does not compile:

Code (CSharp):
  1.  
  2. public class ChunksManager : MonoBehaviour
  3. {
  4.        [SerializeField] Vector2 chunk_size;
  5.         private ChunksContainer<T> container = null;
  6.  
  7.         public ChunksContainer<T> GetContainer<T>() where T: new()
  8.         {...
How to use a templated member in a MonoBehavior?

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>