Advertisement
LeeMace

Updated

Apr 23rd, 2023
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | Gaming | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Paz : MonoBehaviour
  6. {
  7.     [SerializeField] GameObject samPrefab;
  8.     [SerializeField] GameObject olliePrefab;
  9.     public Sam sam { get; private set; }
  10.     Ollie ollie;
  11.  
  12.     private void Start()
  13.     {
  14.         GameObject samObject = Instantiate(samPrefab);
  15.         GameObject ollieObject = Instantiate(olliePrefab);
  16.         sam = samObject.GetComponent<Sam>();
  17.         ollie = ollieObject.GetComponent<Ollie>();
  18.         sam.Log();
  19.         ollie.Log();
  20.         ollie.Setup(this);
  21.     }
  22. }
  23.  
  24.  
  25. using System.Collections;
  26. using System.Collections.Generic;
  27. using UnityEngine;
  28.  
  29. public class Ollie : MonoBehaviour
  30. {
  31.     public int twenty = 20;
  32.  
  33.     Paz paz;
  34.     Sam sam => paz.sam;
  35.        
  36.     void Start()
  37.     {
  38.     }
  39.  
  40.     public void Setup(Paz paz)
  41.     {
  42.         this.paz = paz;
  43.         //sam = paz.sam;
  44.         print($"Setup {sam.ten}");
  45.     }
  46.        
  47.    
  48.     void Update()
  49.     {
  50.         //print($" {sam.ten}");
  51.     }
  52.     public void Log()
  53.     {
  54.         print($"Ollie {twenty}");
  55.     }
  56. }
Tags: Sam Project
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement