Home › Forums › Software Development › Override base class issue: Please help!
Tagged: base class override, script problem
- This topic has 0 replies, 1 voice, and was last updated 7 years, 8 months ago by
Richard Ray Wellman.
- AuthorPosts
- 22/01/2016 at 23:15 #4169
Richard Ray Wellman
ParticipantI am trying to make it possible for a GUI Button to be activated (specifically a GUIRepeatButton) using Tobii’s Eye X Controller’s Gaze Aware Component. I have no idea how to do this. I do not know what to override. I mean I know I’m supposed to override the ProjectedRect (), and it can either be the collider or renderer that is overriden.
Code (csharp):
public virtual ProjectedRect GetProjectedRect()
{
if (_boxCollider != null)
{
return ProjectedRect.GetProjectedRect(_boxCollider, Camera.main, AllowOverlap());
}
return ProjectedRect.GetProjectedRect(GetRenderer().bounds, Camera.main, AllowOverlap());
}The snippet above is what Tobii suggested to change specifically. I have changed it from protected to public so it can be accessed, but I don’t know what to put in the
Code (csharp):
public override ProjectedRect GetProjectedRect()
{
// TODO: Construct a custom ProjectedRect and return it here
}I haven’t the faintest idea how to go about doing the code here. What am I returning exactly? I don’t even understand how this is going to put a GUI on screen. Or rather how to get it to do that using the GazeAwareComponent.
My code ended up looking like this:
Code (csharp):
using UnityEngine;
using System.Collections;public class MoveBox : GazeAwareComponent {
private GUIButton Button;
public override ProjectedRect GetProjectedRect(){
// TODO: Construct a custom ProjectedRect and return it here
return ProjectedRect.GetProjectedRect (Button);
}
}I have tried tons of other things and nothing is working. At one point I thought I had it right because I had a debug log showing up but it was not confined to a box, as long as the sensor picked up my eyes it was printing…
- AuthorPosts
- You must be logged in to reply to this topic.