Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public interface IMyInterface
- {
- string MyString { get; set; }
- }
- public class InterfaceTest : MonoBehaviour, IMyInterface
- {
- private string _myString = "";
- public string MyString
- {
- get
- {
- return _myString;
- }
- set
- {
- _myString = value;
- }
- }
- private void Start()
- {
- IMyInterface myInterface = GetComponent<IMyInterface>();
- myInterface.MyString = "Test";
- Debug.Log(string.Format("Interface property string : {0}, local property : {1}", myInterface.MyString, MyString));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement