Tools: String Manipulations Find Dupes My IP Json Formatter Lorem Ipsum More...
Discussion Options
ajax animation

Unity 3D: Cast Transform as Game Script Class in C#, Convert Transform or GameObject to C# Script Class

6/14/2018 3:24:47 PM by: CodeLocker

Get the C# class of a script connected to an object.

View Copy: Content Copied
MyClassName myClassObj = transform.gameObject.GetComponent<MyClassName>();
if (clickableSprite != null)
     //call a function on the attached script
Copy: Content Copied
ajax animation

Get Coding

Store your first code or add more code to your collection.
You must login to report abuse. ×