Guest User

InteractionHolder.cs

a guest
Jul 3rd, 2018
6,369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class InteractionHolder : MonoBehaviour {
  6.     [SerializeField]
  7.     GameObject[] objects;
  8.     Vector4[] positions = new Vector4[100];
  9.    
  10.     // Update is called once per frame
  11.     void Update () {
  12.  
  13.         for (int i = 0; i < objects.Length; i++)
  14.         {
  15.             positions[i] = objects[i].transform.position;                  
  16.         }
  17.         Shader.SetGlobalFloat("_PositionArray", objects.Length);
  18.         Shader.SetGlobalVectorArray("_Positions", positions);
  19.        
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment