Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Paz : MonoBehaviour
- {
- [SerializeField] GameObject samPrefab;
- [SerializeField] GameObject olliePrefab;
- public Sam sam { get; private set; }
- Ollie ollie;
- private void Start()
- {
- GameObject samObject = Instantiate(samPrefab);
- GameObject ollieObject = Instantiate(olliePrefab);
- sam = samObject.GetComponent<Sam>();
- ollie = ollieObject.GetComponent<Ollie>();
- sam.Log();
- ollie.Log();
- ollie.Setup(this);
- }
- }
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Ollie : MonoBehaviour
- {
- public int twenty = 20;
- Paz paz;
- Sam sam => paz.sam;
- void Start()
- {
- }
- public void Setup(Paz paz)
- {
- this.paz = paz;
- //sam = paz.sam;
- print($"Setup {sam.ten}");
- }
- void Update()
- {
- //print($" {sam.ten}");
- }
- public void Log()
- {
- print($"Ollie {twenty}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement