Created
November 30, 2017 16:40
-
-
Save Santarh/7de86f9a354ee977c2f05de5917b1a4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class Foo | |
{ | |
private readonly int _hoge; | |
public Foo(GameObject target, int hoge) | |
{ | |
_hoge = hoge; | |
target.AddComponent<FooBehaviour>().Init(this); | |
} | |
private class FooBehaviour : MonoBehaviour | |
{ | |
private Foo _self; | |
public void Init(Foo self) | |
{ | |
_self = self; | |
} | |
private void Update() | |
{ | |
Debug.Log(_self._hoge); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment