- Home /
Question by
SARWAN · Nov 29, 2012 at 07:45 AM ·
c#javascriptclass
how to call class details from another class.?
Hi,
I am in the process of converting codes from javascript to CSharp(C#)
This is .js code part:
class BowlingScoreCard extends MonoBehaviour
{
public static var instance : BowlingScoreCard;
public var ContinueBtn : UIButton;
public var BackBtn : UIButton;
public var ScoreText : SpriteText;
public var ExtrasText : SpriteText;
public var OversText : SpriteText;
public var LogoFlag : UIStateToggleBtn;
public var LogoText : SpriteText;
public var bowler : BowlerDetails[]; // Calling details of the bowler from the class below
function ...
{
...
}
}
class BowlerDetails
{
public var Name : SpriteText;
public var Type : SpriteText;
public var Overs : SpriteText;
public var Maiden : SpriteText;
public var Runs : SpriteText;
public var Wickets : SpriteText;
public var ERate : SpriteText;
public var Highlight : UIStateToggleBtn;
public var ClickBtn : UIButton;
public var ProfilePic : GameObject;
}
Here is the Inspector window for that script:
For C# script:
using UnityEngine;
using System.Collections;
public class BowlingScoreCard : MonoBehaviour {
public static BowlingScoreCard instance;
public UIButton ContinueBtn;
public UIButton BackBtn;
public SpriteText ScoreText;
public SpriteText ExtrasText;
public SpriteText OversText;
public UIStateToggleBtn LogoFlag;
public SpriteText LogoText;
public BowlerDetails[] bowler;
void ...() { ... } }
public class BowlerDetails : BowlingScoreCard
{
public SpriteText Name;
public SpriteText Type;
public SpriteText Overs;
public SpriteText Maiden;
public SpriteText Runs;
public SpriteText Wickets;
public SpriteText ERate;
public UIStateToggleBtn Highlight;
public UIButton ClickBtn;
public GameObject ProfilePic;
}
Output for C#(Sharp) was same as .js But in that Bowler part that elements are in the form of GameObject. So, I can't include details of the bowler. like name, type over. How to solve this problem??
inspector.png
(30.9 kB)
c#.pdf
(20.1 kB)
Comment